PDF in WebHTMLViewer (again)

I know this question was topic a few times. I read all the threads Google could find but must still be doing something stupid.
In a Web app (development on Mac), I use a CopyFiles Build Step to move a PDF file into the resources folder.
I placed a WebHTMLViewer on a WebPage that is supposed to display without a session.
The Viewer’s Shown event goes like

Dim webfile As New WebFile Dim f As FolderItem f = app.ExecutableFile.Parent.Child("Resources").Child("Handbuch TDPortal.pdf") webfile.Session = Nil webfile.MIMEType = "application/pdf" webfile = webfile.Open(f) Me.URL= webfile.URL

The file is found, it exists and it is readable.
The result of the HTMLViewer is always

Any hints are very welcome!

Is your app translocated?

Webfile must be a property of a webpage, so it survives long enough to be downloaded.

D‘oh! Of course!
Thank you!

FWIW we stoped displaying PDFs directly in HTMLViewers and instead display then via gview

Its cleaner and it helps with “print” with various browsers.

(It has the bonus of displaying Excel and Word documents too w/o any coding at all)

my_webhtmlarea.url=“https://docs.google.com/gview?url=URL OF YOUR PDF

Interesting. How hard was the Xojo implementation?

@Jay Menna I tried to implement your suggest…

This URL is a valid PDF link:

I am not doing it run following your instructions…


What am I doing wrong ???


Removed the ’ around the URL.

Thanks for the tip!

Nor with or without the ’ is possible to view the PDF.
In the following link you could see the project in order to see if I am doing something wrong:

[quote=387810:@Mariano Poli]Nor with or without the ’ is possible to view the PDF.
In the following link you could see the project in order to see if I am doing something wrong:
First, you should use the Action event of a button :wink:
Try adding &embedded=true at the end of the URL string. But the URL seems to point to an HTML page?

This might be helpful: https://dzone.com/articles/embedding-google-docs-and

I solved the dilema…

To view PDF file located in my Google Drive in a WebHTMLViewer, I need to use the scrID file attribute

For instance if the scrid of my file is 0B_uY7ds6hYVdUkQ4SE1VT2NVNHNJTmVYZDBESHZSLWt3cjdB

Dim scrID as string
my_webhtmlviewer.URL=“https://docs.google.com/viewer?srcid=” + scrID + _

I hope this would be usefull

Stupid simple. Its just a matter of updating the URL