PDA

View Full Version : Usig pdf file in REALBasic




mahaboob
Aug 3, 2009, 03:40 AM
I need to launch a pdf file when clicking the help button.
So I used the 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



lee1210
Aug 3, 2009, 09:20 AM
Note: I don't know RealBasic

A quick google came up with a few threads that suggest using:
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

blaster_boy
Aug 3, 2009, 01:14 PM
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:
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.

lazydog
Aug 3, 2009, 01:24 PM
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

mahaboob
Aug 5, 2009, 12:04 AM
Thanks
Now it is working well