Usig pdf file in REALBasic

Discussion in 'Mac Programming' started by mahaboob, Aug 3, 2009.

  1. mahaboob macrumors member

    Joined:
    Jul 10, 2008
    #1
    I need to launch a pdf file when clicking the help button.
    So I used the code :
    Code:
      Dim f as FolderItem
      f = GetFolderItem("MyHelp.pdf")
      f.Launch
    
    and I imported the MyHelp.pdf file into the project.
    When I'm running the application the file is launched.
    But After building the application and I ran the application, it is not opening.
    So I checked it with f.LastErrorCode and it shows error code 101(file not found). How can I use the pdf file in my application?
    I need to distribute the application with this help file.

    I'm using Realbasic 2007 R5 on Mac OS X 10.5

    Thanks in advance
    mahaboob
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    Note: I don't know RealBasic

    A quick google came up with a few threads that suggest using:
    Code:
    app.ExecutableFile.AbsolutePath
    To get the path to your executable inside your bundle. You can then move to the resources directory (or wherever the PDF is ending up in your bundle) and open it up.

    -Lee
     
  3. blaster_boy macrumors 6502

    blaster_boy

    Joined:
    Jan 31, 2004
    Location:
    Belgium
    #3
    I don't know Realbasic either, but it seems to me that you need to specify the path where your helpfile is located. Inside the project the executable probably sees it, once compiled it will need to be specified.

    For easy testing, I would put the pdf in the same folder as where your executable is created and create a variable to the pdf using for the filepath the result of app.ExecutableFile.AbsolutePath + the name of the pdf.

    In pseudocodish:
    Code:
    var x=app.ExecutableFile.AbsolutePath + "MyHelp.pdf"
    f=GetFolderItem(x)
    f.launch
    You might want to print f or x to verify that the filepath is created correctly.
     
  4. lazydog macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #4
    It's been a while since I did any RB, but it sounds like you're including the pdf in your project as a resource and so you would access it using the getresource() (I think) methods. Perhaps it would be easier to just distribute the pdf file with the executable, especially if your app is cross platform. Best to ask on the RealBasic forum over at RealSoftware if you haven't already.

    b e n
     
  5. mahaboob thread starter macrumors member

    Joined:
    Jul 10, 2008

Share This Page