How to use pdf.js on desktop/mobile to display a PDF

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

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to use pdf.js on desktop/mobile to display a PDF

Post by Klaus » Fri Apr 15, 2022 11:15 am

I don't want to launch another app nor do I want to edit or process the PDFs, only display them inside of LC (browser wigdet).

With -> "Ah, yes, thank you, worth to consider!" I meant your idea to serve these files via the http lib in LC.

stam
Posts: 2633
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: How to use pdf.js on desktop/mobile to disply a PDF

Post by stam » Fri Apr 15, 2022 4:22 pm

Klaus wrote:
Wed Apr 13, 2022 9:04 am
stam wrote:
Tue Apr 12, 2022 10:40 pm
Also, you may want to look at the opensource XPDFReader : http://www.xpdfreader.com/index.html
I've used it before to very successfully extract text from PDF files - it comes with a 'viewer' for win/linux which may be helpful if you don't need to absolutely embed the PDF. It also lets you export each page as JPG so if you wanted to could do this on the fly i guess to show the PDF as an image instead... it's got a huge number of features which i haven't really looked into so might be worth a look?

S.
Thank you, but this is an external application, I just want to display a PDF file inside of my Livecode app.

Since the Windows "default" browser EDGE can display PDF files, I wonder why LC still "sticks" to the CEF stuff.
Maybe it is not as easy to wrap around their web engine as it may be on the Mac, but what do I know?! ;-)
Just in case you missed it - XPDFReader lets you export each page of the PDF as a JPG.
You can do this to an intermediate/temp folder and then seamlessly import the JPG to LC.
Granted, it will be an image and not a PDF, but it may be a quick and dirty way to present the content of the PDF inside your app.

S.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to use pdf.js on desktop/mobile to display a PDF

Post by Klaus » Fri Apr 15, 2022 4:39 pm

Hm, also something to consider, thanks! :-)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to use pdf.js on desktop/mobile to display a PDF

Post by jacque » Fri Apr 15, 2022 5:54 pm

Another idea, if you have control over the PDF, use a converter utility to change it to HTML which will display in the browser.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to use pdf.js on desktop/mobile to display a PDF

Post by Klaus » Fri Apr 15, 2022 6:01 pm

Hi Jaque,

the browser widget for Windows uses the CEF browser, can display PDF file,
but has a 170 MB overhead for runtimes, which I really want to avoid.


Best

Klaus

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to use pdf.js on desktop/mobile to display a PDF

Post by Klaus » Fri Apr 15, 2022 6:03 pm

I actually dropped the idea to use the browser widget on Windows for the above mentioned reason.
If I can reach the target of my crowdfunding campaign, I will probably buy the "Pro pack" which comes with the PDF widget.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to use pdf.js on desktop/mobile to display a PDF

Post by jacque » Fri Apr 15, 2022 6:16 pm

Well, you can display HTML in a field. No browser required. Maybe you've already thought of that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to use pdf.js on desktop/mobile to display a PDF

Post by Klaus » Fri Apr 15, 2022 6:50 pm

Ah, yes, again something to consider, thank you! :-)

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”