How do I open a pdf file via a link on a website?

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Peter@multidesk.se
Posts: 136
Joined: Fri Oct 14, 2011 6:53 am

How do I open a pdf file via a link on a website?

Post by Peter@multidesk.se »

I have tried with both Widget browser and mobileControlCreate but when I click on a link on the page, nothing happens. However, it works in my IDE...

Anyone know why?

///Peter
/*Whats all the fuss with c# ?*/
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: How do I open a pdf file via a link on a website?

Post by jmburnod »

Hi Peter,
This sound like a missing inclusion
Jean-Marc
https://alternatic.ch
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How do I open a pdf file via a link on a website?

Post by Klaus »

Hi Peter,

if I remember correctly, we cannot display a PDF file in a browser on Android, because Android does not support this.


Best

Klaus
Peter@multidesk.se
Posts: 136
Joined: Fri Oct 14, 2011 6:53 am

Re: How do I open a pdf file via a link on a website?

Post by Peter@multidesk.se »

It works in the android phone's default browser. if there is a missing inclusion, which one? :?

///Peter
/*Whats all the fuss with c# ?*/
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How do I open a pdf file via a link on a website?

Post by Klaus »

Hi Peter,

no missing inclusion or whatever, it just does not work in the LC browser on Android.


Best

Klaus
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: How do I open a pdf file via a link on a website?

Post by FourthWorld »

Another good question might be why one would want to attempt to read a PDF on a small screen.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: How do I open a pdf file via a link on a website?

Post by bogs »

This isn't meant to be sarcastic or me having a problem with what your saying Richard, but I've seen some pretty dang big android screens, almost big enough to tempt me to buy a mobile device (if I had any use for it).

Aside from that, how would reading a pdf file on (device x of your choice) be any different than reading a web page on (device x of your choice) ?
Image
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: How do I open a pdf file via a link on a website?

Post by FourthWorld »

bogs wrote: Tue May 04, 2021 10:16 pm This isn't meant to be sarcastic or me having a problem with what your saying Richard, but I've seen some pretty dang big android screens, almost big enough to tempt me to buy a mobile device (if I had any use for it).

Aside from that, how would reading a pdf file on (device x of your choice) be any different than reading a web page on (device x of your choice) ?
Most PDFs are formatted for printing on standard size paper (in US, 8.5x11"). On a full-sized tablet (3% of usage), designed as they are to match a page, in portrait mode PDFs work great. On a desktop (45% of usage) the full width is available, so only vertical scrolling is occasionally needed. But on a phone (52% of usage) it means tediously scrolling around the document both horizontally and vertically while reading each line.

If the destination for the document is a printer, PDF is an excellent choice. For all other use cases I use different formats, depending on what's needed.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: How do I open a pdf file via a link on a website?

Post by AxWald »

Hi,

Very often the use of PDFs is questionable, IMHO - the PDF format was meant as a read-only, digital version of a printed page. There's quite some use cases where it actually makes sense - the digital transmission of documents (in a legal sense), for instance.

Most often, though, a PDF isn't more than the misguided effort of a "web-designer" to display data in a fancy way without the added expense to "html/CSS" it, or the result of a moronic default setting of a cheap consumer scanner.

In any case, the existence of PDF is a reality.
There's (desktop) browsers that display PDFs, but that's often not quite the best choice. On Android it's expected to have a dedicated PDF viewer for this, IMHO a good choice.

Some readers I can recommend:
  • FBReader with PDF plugin - A reader for e-book/ text/ comic docs. Enormously configurable, has lots of features and supports a wide range of formats. Free & full version. For those that expect to read a lot.
  • MuPDF - AGPL, small, fast, 3 flavors (full, viewer, mini). For the occaisonal display of PDFs. Or as a second, faster alternative to FBReader.
  • for sure there's a ton more, some of it may be good.
My Android apps suggest the installation of "MuPDF viewer" at 1st startUp & in 'Help' (with an external play store link) *1), so that "launch URL *.pdf" works later.

With a suitable viewer available I cannot see any special problems regarding PDFs, even on small screens. For the user it's the same as navigating most web sites - drag, pinch, swipe. They are well used to this.

For sure, some of us older ones (myself included) will start to pull our few remaining hairs, yelling for the magnifier. Presbyopia is a reality, as is the existence of PDFs. And we better get used to this ;-)

Have fun!

*1): The desktop version comes bundled with "SumatraPDF" that uses the MuPDF engine, too. And my program uses it explicitly, even if other PDF viewers are installed.
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
andresdt
Posts: 156
Joined: Fri Aug 16, 2019 7:51 pm
Contact:

Re: How do I open a pdf file via a link on a website?

Post by andresdt »

Hello, I have faced that problem. In my case, I was not very clear about the structure of the Android apps, the permissions and virtual folders ...
Look up the specialFolderPath function in the dictionary and read the description for its use on Android. That helped me a lot.
Broadly speaking, what happens is that the IDE and the other applications have read permission on the PDF file on the PC. While in Android the thing is very different, since to show the PDF another application is required. What you need to do is copy your PDF to a folder where it can be read by other apps.
Look at the example that I share with you. Use LC 9.6.2 (rc.1) But this should work for all versions.
Just copy the PDF to a folder where other apps have permission. In the example I copy it to specialFolderPath ("documents").
Attachments
OpenPDF_Android.zip
(60.8 KiB) Downloaded 382 times
Be kind, we all have our own wars.
https://torocruzand.com/
Post Reply