Embed PDF inline with HTML source in HTMLViewer

FYI… what I posted above DOES work on IE10 … I’m using OSX 10.11.3 where all I get is a white screen.

Kimball… white screen with gray outline on OSX, works fine when run remotely on Win10

10.11.3

The PDF doesn’t display in the little iframe for me, it’s just blank and empty. I do not, however, get the “find the plugin” window. It does let me open the PDF in Preview using the system-level right-click menu. PDF controls also appear, however they are outside the HTML Viewer (and even the window)

Have you ever installed Adobe Acrobat or Adobe Acrobat Reader on this Mac, or any Mac you may have migrated to this system?

I got exact same results as Tim… but everything I read indicates Adobe PDF reader is NOT required, and the HTML works if loaded directly into SAFARI. I also tried HTMLVIEW in both “native” and “webkit” mode with same results.

FYI… I DO have Adobe reader installed on my Win10 Machine

The behaviour on OS X definitely strikes me as an Apple bug because of how the HTMLViewer works on OS X

What I was trying to get at was whether it’s an Apple bug or an Adobe bug for Kimball.

10.11.3. What do I win?

For what it’s worth, I do have Acrobat Pro installed.

10.11.3, works fine here. No Adobe products on this computer.

Stupid question: can you render the pdf to a picture and then create your html with the picture?

I just tested under 10.10.4. No problem.

So, it appears that I’m pretty unique in getting the specific Adobe error, at least in the context of a Xojo-built app. It is not unique across all mac users, though most of the instances I’ve found of this problem are pretty old.

There is definitely some inconsistency with respect to how well-supported loading a PDF into an HTMLViewer is, though, as it seems to basically rely on whatever the OS is going to do, which seems to vary based on what pdf plugins you may have available, what OS version+browser version you are using, etc.

Bottom line: poor user experience for my users - I’m going to have to approach this problem differently.

Thanks, everyone, for the testing.

It does appear to be an Apple bug
But there may be a workaround and that is making the HTMLViewer layer backed
We’ve seen other bugs disappear by making things layer backed before too - which really makes it obvious its an Apple bug

Try putting this in the open event of the window containing the HTMLViewer (or in the Open event of the HTMLViewer) & see if it helps

 declare sub setWantsLayer lib "AppKit" selector "setWantsLayer:" (view as integer, value as Boolean)
 setWantsLayer(myHTMLViewer.Handle, true)

The Adobe prompt I have no idea where that comes from

I just took Kimballs code which did NOT work previously, added Normans declare and IT WORKS!

  declare sub setWantsLayer lib "AppKit" selector "setWantsLayer:" (view as integer, value as Boolean)
  setWantsLayer(me.Handle, true)
  me.LoadPage(PAGE_HTML, specialFolder.Temporary.child("test.txt"))

just one change… myHTMLViewer.Handle becomes me.handle

Another confirmed: Adding the declare makes the PDF show up here.
The PDF control still appears outside the window, though.

It’s coming from whatever Adobe plugin was installed.

Follow up: I found an old Adobe Reader plugin in /Library/Internet Plug-ins that was dated 2008. Deleted that, and my adobe error message disappeared, and I started getting the white box with a frame but no PDF loaded that Dave S and others have reported. I then added Norman’s code to the open event (note the change to me.Handle that Dave points out) and it is now working correctly.

For any who may be curious about what the call to setWantsLayer is doing under the hood, here are the apple docs on the function.

Yay … Apple bug !
Will have to make sure there’s a radar filed for this

And glad to know making it layer backed fixed things
Not sure its a general fix for all kinds of issues but, a I said, this isn’t the first time we’ve seen making a control layer backed fixes some oddities.

I’ve been trying to track down a bug that’s been haunting me for years. Large PDFs don’t render properly when automatic resizing is turned on (or zoom). This is a problem when using either the HTMLViewer or a PDFView in a Xojo window. I’ve tried adding the above declare to the window Open event and to the HTMLViewer Open event, but they don’t fix the problem. Can anyone confirm with a large PDF that they see this (I can supply the PDF)? And Norman, are there any other declares you think might be worth trying?