opening pdf files

Hello

i want to create an app to read pdf files… i used the example found

Dim pdfFile As FolderItem
pdfFile = GetOpenFolderItem("")
If pdfFile <> Nil Then
pdfFile.Launch
End If

but it says it uses the internal pdfviewer, but when i test it out, it opens a dialogue to specify the pdf file

Is it possible to import it in to project, and let it open there??

Thnx

On Windows your code lets me open a file then shows it in Acrobat Reader. It does not ask for a file again??

Are you on Mac/Win/Linux? I could help with Win.

if you on OSX and drag a PDF into the project, you can open it like this

f=app.ExecutableFile.parent.parent.parent.parent.child("myfile.pdf")
f.launch

that MIGHT even work for WIndows, assuming there is a default PDF reader installed (this is not an issue with OSX, because there IS a default PDF reader installed there)

[quote=182804:@Guido Cautreels]Hello

i want to create an app to read pdf files… i used the example found

Dim pdfFile As FolderItem
pdfFile = GetOpenFolderItem("")
If pdfFile <> Nil Then
pdfFile.Launch
End If

but it says it uses the internal pdfviewer, but when i test it out, it opens a dialogue to specify the pdf file

Is it possible to import it in to project, and let it open there??

Thnx[/quote]

You must be on Windows, which does not open PDF Files as default.

Install Acrobat Reader, or consider acquiring the DynaPDF plugin from MonkeybreadSoftware.net

It helps if people read the question …

?

Sigh. He clearly wants to open the pdf inside his app.

@Guido: there is no “internal” pdf reader in Xojo, what they refer to is the pdf reader installed on your system. That’s what the f.launch will do.

[quote=182840:@Markus Winter]Sigh. He clearly wants to open the pdf inside his app.

@Guido: there is no “internal” pdf reader in Xojo, what they refer to is the pdf reader installed on your system. That’s what the f.launch will do.[/quote]

So for you DynaPDF is an external method ?

Under Windows, HTML Viewer is not able to open PDF. What he got from Internet Explorer with f.launch will happen as well from PDF Viewer if he has not installed Acrobat Reader.

In Mac, a PDF can be put into a picture and displayed into a canvas with Picture.Open(folderitem), or displayed in the HTMLViewer. That is pretty internal to me.

Sigh…

As it is not included with Xojo the answer would be yes :wink:

Guido was referring to an “internal pdf viewer” that he wanted to use. Clearly a misunderstanding on his part.

That being said DynaPDF is a good recommendation …

Wow… I guess we all read a different question… I see no place where he has a requirement of “internal”
He even specified what he tried to do, and that the result was no PDF reader (ie. Acrobat or the like) installed
and asked how to use a FILE into his project and read it there…

“it” refers to the last referred objective noun, which in this case would be “the pdf file”

This would still require a PDF reader, but it doesn’t need to be DynaPDF, unless he wishes to open it in a XOJO controlled window, which is not what I got that he required.

His reference to “internal viewer” was in regard to the error message, not his requirement

Do you want to just display the pdf ? Or alter the pdf ?
That makes a difference.

Assuming you want only to display, and do so within your program not in an external reader, here is a quick-and-dirty example that requires you to have Acrobat Reader installed - just drop a pdf on the window

http://www.retroprograms.com/temp/rbacroread.zip