Page 1 of 1

hhPDFViewer v086 issues with local PDFs

Posted: Thu Feb 21, 2019 3:23 am
by bsnipes
I have tried to get the hhpdfviewer stack from http://livecodeshare.runrev.com/stack/916/ to work with local PDFs from both Windows and Linux using both 9.0.1 and 9.0.2 without success. It works with pulling PDFs from online as in the example PDF URL when the stack is opened. When I try to open a local PDF, the viewing area stays blank and the page count doesn't update. If I try to click for the next page, I get the attached error in a revErrorDisplay box. What I am looking to do is create a program to view local PDFs, page down through them and "tag" pages (just keep a list of the current page when the spacebar is pressed). The I will process the PDF using the list as a guide later.

If anyone has an idea as to why the hhPDFViewer won't work for me or where to look next, I would appreciate the guidance.

Re: hhPDFViewer v086 issues with local PDFs

Posted: Thu Feb 21, 2019 5:43 pm
by [-hh]
The error is from the browser widget I already worked around in the sample stack.
Just now this is caused from a simple typo I overlooked after testing:

In the scripts of both fields "URL1" and "URL2"
change "hhTemplate" to "hhtemplate".
This doesn't affect Mac. I'll update the sample stack this evening.

Come back if it doesn't work for you.

Re: hhPDFViewer v086 issues with local PDFs

Posted: Thu Feb 21, 2019 9:37 pm
by bsnipes
Thanks for looking into it! I just tested on Windows and the filename change didn't make a difference there (because of case insensitivity on the filesystem?). But I did find one issue using the debug feature and stepping through line by line looking at the variables. The pdfdata was never populated in the URL1 field script.
In the openLocal script, "binfile://" is prepended to the chosen file. If I remove the "//" then it will open the local files properly at least on Windows. I plan on trying Linux shortly.

Re: hhPDFViewer v086 issues with local PDFs

Posted: Fri Feb 22, 2019 12:00 am
by [-hh]
Yes, the case sensitivity repairs the stack for linux, the binfile-prefix repairs it for Windows (forgot to denote the latter, sorry).

It is both already in the updated version "hhPDFViewer_v090" on "Sample Stacks" or
http://livecodeshare.runrev.com/stack/916/
uploaded this evening.
Tested to work here with LC 902 on MacOS 10.14, Win 7+10, Ubuntu1604.

This project isn't perfect. I wrote it especially for the rotate-feature. And in order to display local files with pdfjs without using a server. For other uses usually the ordinary pdf-plugins are better.

Re: hhPDFViewer v086 issues with local PDFs

Posted: Wed Feb 27, 2019 10:51 pm
by [-hh]
It's much better now in version 1.0.0.
It doesn't need a temporary filesystem any more and has an (optional) text layer for copying text from the PDF.
See the description here:
viewtopic.php?p=173724#p173724