Can LiveCode display PDF files on Mobile device?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Can LiveCode display PDF files on Mobile device?
Can LiveCode Read PDF files?
Thanks,
David
Thanks,
David
Last edited by DR White on Thu Jan 26, 2017 11:34 pm, edited 3 times in total.
Re: Can LiveCode Read PDF files?
Hi David,
on macOS and iOS you can display PDF files in a browser object/widget right out of the box,
on Windows the Acrobat Reader web plug-in has to be installed on the target machine.
No idea about Android, sorry.
Best
Klaus
on macOS and iOS you can display PDF files in a browser object/widget right out of the box,
on Windows the Acrobat Reader web plug-in has to be installed on the target machine.
No idea about Android, sorry.
Best
Klaus
Re: Can LiveCode Read PDF files?
Klaus,
Where can I go to learn about using the browser widget?
I don't see it in the dictionary.
Thanks,
David
Where can I go to learn about using the browser widget?
I don't see it in the dictionary.
Thanks,
David
Re: Can LiveCode Read PDF files?
Hi David,
in the dictionary (LC >=
select "Browser" in the popup menu on the topleft side "Choose API: ..."!
Basically you drag a browser widget to a card, set its height and width and just set its url to an internet url or:
...
put specialfolderpath("resources") & "/pdf_files/a_pdf.pdf" into tPDFFIle
## The neccessary trick:
replace SPACE with "%20" in tPDFFile
set the URL of widget "your browser widget name here" to tPDFFile
...
You get the picture.
Best
Klaus
in the dictionary (LC >=

Basically you drag a browser widget to a card, set its height and width and just set its url to an internet url or:
...
put specialfolderpath("resources") & "/pdf_files/a_pdf.pdf" into tPDFFIle
## The neccessary trick:
replace SPACE with "%20" in tPDFFile
set the URL of widget "your browser widget name here" to tPDFFile
...
You get the picture.

Best
Klaus
Re: Can LiveCode Read PDF files?
Klaus,
Thanks for the help, but, I am not having any success.
There really is not much info on setting up the widget "Browser"
Would it be too much to give me a sample stack to view a PDF file?
Thanks,'
David
Thanks for the help, but, I am not having any success.
There really is not much info on setting up the widget "Browser"
Would it be too much to give me a sample stack to view a PDF file?
Thanks,'
David
Re: Can LiveCode Read PDF files?
Hi David,
OK, here is a quick example.
Tested on my Mac and works with LC 9 dp4, but should of course work with all versions <= 8!
Best
Klaus
OK, here is a quick example.

Tested on my Mac and works with LC 9 dp4, but should of course work with all versions <= 8!
Best
Klaus
- Attachments
-
- browsertest.livecode.zip
- (1.1 KiB) Downloaded 284 times
Re: Can LiveCode Read PDF files?
Klaus,
WOW!!
That works Beautifully!!
Now, I will spend some time studying it to see how you did it.
Thanks so MUCH,
David
WOW!!
That works Beautifully!!
Now, I will spend some time studying it to see how you did it.
Thanks so MUCH,
David
Re: Can LiveCode Read PDF files? - Solved
Hi David,
you're welcome!
But this is really no rocket science!
Best
Klaus
you're welcome!
But this is really no rocket science!

Best
Klaus
Re: Can LiveCode Read PDF files? - Solved
Klaus,
My humblest apology. I should have mentioned that I was working on an IOS mobile app.
Your stack works great on desktop, but not on mobile.
Thanks,
David
My humblest apology. I should have mentioned that I was working on an IOS mobile app.
Your stack works great on desktop, but not on mobile.
Thanks,
David
Re: Can LiveCode Read PDF files?
Hm, try this:
1. add a PDF fle to the iOS standalone via the "Copy files" tab in the standalone builder settings
2. Use a little variation of my first script snippet:
...
put specialfolderpath("resources") & "/your_pdf_here.pdf" into tPDFFIle
## The neccessary trick:
replace SPACE with "%20" in tPDFFile
set the URL of widget "your browser widget name here" to tPDFFile
...
Should work on iOS, but maybe not in the simulator, which has some quirks, so they say...
1. add a PDF fle to the iOS standalone via the "Copy files" tab in the standalone builder settings
2. Use a little variation of my first script snippet:
...
put specialfolderpath("resources") & "/your_pdf_here.pdf" into tPDFFIle
## The neccessary trick:
replace SPACE with "%20" in tPDFFile
set the URL of widget "your browser widget name here" to tPDFFile
...
Should work on iOS, but maybe not in the simulator, which has some quirks, so they say...

Re: Can LiveCode display PDF files on Mobile device?
Klaus,
I have tweaked your stack several ways, but could not get the mobile browser to display a PDF.
I have attached your stack with the changes that I made and also the pdf file that I
used.
Thanks for everyone's time and effort,
David
I have tweaked your stack several ways, but could not get the mobile browser to display a PDF.
I have attached your stack with the changes that I made and also the pdf file that I
used.
Thanks for everyone's time and effort,
David
- Attachments
-
- CR65 Layout.pdf.zip
- (178.64 KiB) Downloaded 205 times
-
- browsertest.livecode 2.zip
- (2.49 KiB) Downloaded 234 times
Re: Can LiveCode display PDF files on Mobile device?
Hi David,
use -> specialfolderpath("resources")
This happens to be the same as -> specialfolderpath("engine") on mobile,
but might change in future versions, since the ENGINE folder is really TABOO for us!
AND specialfolderpath("resources") does also work in the IDE, it returns the folder where (current) stack resides,
so no need to use anything else during development! But that should not hinder your PDF from being displyed!
Add two SLASHES to the URL and try again:
Best
Klaus
use -> specialfolderpath("resources")
This happens to be the same as -> specialfolderpath("engine") on mobile,
but might change in future versions, since the ENGINE folder is really TABOO for us!

AND specialfolderpath("resources") does also work in the IDE, it returns the folder where (current) stack resides,
so no need to use anything else during development! But that should not hinder your PDF from being displyed!
Add two SLASHES to the URL and try again:
Code: Select all
...
set the URL of widget "Browser" to ("file://" & tPdfFile)
...
Best
Klaus
Re: Can LiveCode display PDF files on Mobile device?
Klaus,
Made recommended changes, but still does not work.
Thanks,
David
Made recommended changes, but still does not work.
Thanks,
David
Re: Can LiveCode display PDF files on Mobile device?
Sorry, I do not develop for mobile, so no brilliant ideas in the moment...
Re: Can LiveCode display PDF files on Mobile device?
Klaus,
Your insight is always appreciated.
Thank Again,
David
Your insight is always appreciated.
Thank Again,
David