hhPDFViewer v086 issues with local PDFs

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
bsnipes
Posts: 14
Joined: Mon Jul 23, 2018 10:12 pm

hhPDFViewer v086 issues with local PDFs

Post by bsnipes » Thu Feb 21, 2019 3:23 am

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.
Attachments
Screenshot_20190220_202001.png

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: hhPDFViewer v086 issues with local PDFs

Post by [-hh] » Thu Feb 21, 2019 5:43 pm

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.
shiftLock happens

bsnipes
Posts: 14
Joined: Mon Jul 23, 2018 10:12 pm

Re: hhPDFViewer v086 issues with local PDFs

Post by bsnipes » Thu Feb 21, 2019 9:37 pm

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.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: hhPDFViewer v086 issues with local PDFs

Post by [-hh] » Fri Feb 22, 2019 12:00 am

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.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: hhPDFViewer v086 issues with local PDFs

Post by [-hh] » Wed Feb 27, 2019 10:51 pm

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
shiftLock happens

Post Reply