On Mac the HTML Viewer can render a PDF. I can’t get this behavior to work on Windows. Is there something I can to do make it work, or should I cut my losses and display them another way?
Does using webkit as the renderer solve anything?
Not sure, but that’s a good suggestion. I’ll test that asap. Thanks.
Nope same thing. It asks me if I want to open or save the file. If I select open it launches in Acrobat Reader.
Weird, I just did a test with 2020r1 on Win10 (64 bit), and when I switch the htmlviewer to webkit it works just fine, whether I use loadpage(folderitem) or loadurl(folderitem.nativepath). 2019r3.2 also worked fine but I only tried loadpage. Both 32 bit and 64 bit builds behaved the same.
Also, if I used the native viewer it behaved as you described.
I think it has to do with the browser itself under Windows. For example, all the ones based on Chromium engine will be able to display the PDF file in the HTMLViewer, while Edge and Explorer will refuse and bring the “open with” dialog.
You may also consider using JS libraries like PDF.js
Now I’m really confused. I can open the PDF in the native browser on Windows, so I’m not sure why neither option (with WebKit on or off) won’t work.
I’m a Mac user so these details for Windows are always annoying.
Maybe @Christian_Schmitz has a plugin solution I should investigate.
Because it’s a HTML viewer. The fact that some systems can display a PDF is just an accidental side-benefit. If you want something reliable - don’t use HTMLViewer.
Yes, DynaPDF can render to an image that you can display in a canvas. This is arguably the correct way to display a PDF, as it doesn’t rely on hacks or inconsistent system configurations.
Yeah, I’ll have to do that. It’s a shame. On the Mac it is really slick that you can display it in the HTML browser and the print function prints vector.
Hmmm… I don’t see rendering to a Canvas as “reliable” because you lost all the vectorial quality associated with zoom-in or zoom-out from the displayed page (among other features provided from any pdf viewer based on web).
It’s far more reliable than HTML Viewer and hoping and praying the system the app is running on renders PDF in it’s web browser engine.
DynaPDF allows you to specify the size to render at. This enables zoom functionality, and allows you to print at quality.
I’m shocked that you are actively endorsing unreliable HTML Viewer behavior. Not every system renders PDF in HTML Viewer.
Nop, i was endorsing using a PDF.js library for that purpose.
how to use pdf.js in htmlviewer?
You want to use the viewer example and load it into the htmlviewer