New approach for offline viewing PDF inside Android browser

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: New approach for offline viewing PDF inside Android brow

Post by MaxV » Thu Sep 21, 2017 11:58 am

jim1001 wrote:
On mobile all the files selected to include in your app, from the Standalone application settings, are copied in specialFolderPath("Engine").
Well my case is special in that I will be personally installing my app on the few devices that will be using it. The app I’m developing has a lot of media files, eg videos, PDFs, that I don’t want to copy over each time I build & install the app. I will be able to copy these media files to the devices outside LiveCode and reference them by absolute path name from LiveCode.

Anyhow I would still like to understand your suggestion.
copy all files and folder in specialFolderPath("Documents"),
Can you explain this please? What files and folders do you mean? Where, when and how do you do this?
The folder specialFolderPath("engine") on Android is read only. So it's a problem.
the folder specialFolderPath("Documents") it's read and write. No problem with files here.
jim1001 wrote:
overwrite the test.pdf with your file,
Do you mean ... ?
I mean just copy the PDF file to test.pdf :

Code: Select all

put URL ("binfile:path/to/myfile.pdf") into URL ("binfile:" & specialFolderPath("Documents") & "/PDFViewer/pdfjs/web/test.pdf")
then reload the page in the browser to update the reader.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: New approach for offline viewing PDF inside Android browser

Post by jim1001 » Tue Oct 17, 2017 4:09 pm

MaxV ,

Thanks for your latest post which I’ve only just come to look at again.

I wonder if you are able to get this working without copying over files with the app, i.e. by putting the folder pdfjs & its subfolders on your target Android device before installing your app and then referring to them using absolute paths?

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: New approach for offline viewing PDF inside Android browser

Post by jim1001 » Tue Oct 17, 2017 4:34 pm

I wonder if you are able to get this working without copying over files with the app, i.e. by putting the folder pdfjs & its subfolders on your target Android device before installing your app and then referring to them using absolute paths?
I just got this working! Now I'll try copying in a different PDF using the app...

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: New approach for offline viewing PDF inside Android browser

Post by jim1001 » Tue Oct 17, 2017 5:26 pm

Now able to let the user change the PDF displayed in the app by using MaxV's suggestion of copying over the DEFAULT_URL file specified in viewer.js. :D

The first problem I had was specifying the URLs incorrectly. Then when the PDF controls showed without a PDF file (just an empty window) I changed the Minimum Android Version back to 2.3.3 after reading an earlier post by rmuzzini. I needed both these things to be right before everything worked.

Many thanks MaxV & rmuzzini!

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm
Location: Qatar

Re: New approach for offline viewing PDF inside Android browser

Post by Youks » Sat Nov 24, 2018 1:22 pm

Hi Gents,

Could anyone indicate how to use it for online PDF ? I followed all the steps but this doesn't seem to be working for me for PDF not in the phone. Any method?

Thx

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm
Location: Qatar

Re: New approach for offline viewing PDF inside Android browser

Post by Youks » Sun Nov 25, 2018 11:10 am

Hi All,
As minimum built is 4.1 now (2.3.3) not available, therefore this method is still showing blank PDF unfortunately. Any workaround available ?

Thx

capellan
Posts: 654
Joined: Wed Aug 15, 2007 11:09 pm

Re: New approach for offline viewing PDF inside Android browser

Post by capellan » Sun Nov 25, 2018 10:23 pm

Hi Youks,

After downloading MaxV zipped folder, I was able to load an online PDF
after replacing the original button script with this handler:

Code: Select all

on mouseUp
set the url of widget 1 to "https://www.ic.unicamp.br/~pannain/mc404/aulas/pdfs/Art%20Of%20Intel%20x86%20Assembly.pdf"
end mouseUp
Notice that MaxV original script allows you to choose a PDF to display
inside LiveCode Browser, so if you want that users select an online PDF
you could use a locked text field for this.

Al

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: New approach for offline viewing PDF inside Android browser

Post by FourthWorld » Mon Nov 26, 2018 12:44 am

Why does the PDF need to be displayed specifically within a browser object? In most apps that support opening PDFs they launch the build-in PDF viewer in a separate process.

What's in these PDFs?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm
Location: Qatar

Re: New approach for offline viewing PDF inside Android browser

Post by Youks » Mon Nov 26, 2018 5:38 am

Hi Capellan,

I am on LC9.0.1 MAC version, on android your given script doesn't work (blank page) using Max's example. I was hoping to make this work with the PDF.js viewer as well but no joy.

For the purpose of my app i am looking into an embedded browser solution, I am accessing PDF of daily weather charts. As an alternative these charts are available in GIF format but then i lose the functionality of the browser in terms of gesture and zooming.

Thanks

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

Re: New approach for offline viewing PDF inside Android browser

Post by Klaus » Mon Dec 30, 2019 2:40 pm

Hi all,

now that LC 9.6.x will finally support "Print to PDF" on Android, what is
the current state of displying LOCAL PDF files on Androind inside of LC?
Thanks for any insight!


Best

Klaus

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

Re: New approach for offline viewing PDF inside Android browser

Post by Klaus » Sun Jan 05, 2020 5:03 pm

Klaus wrote:
Mon Dec 30, 2019 2:40 pm
Hi all,

now that LC 9.6.x will finally support "Print to PDF" on Android, what is
the current state of displying LOCAL PDF files on Androind inside of LC?
Thanks for any insight!
NOONE? :shock:

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: New approach for offline viewing PDF inside Android browser

Post by bogs » Sun Jan 05, 2020 5:38 pm

Much as I would love to tell you the answer, I just don't happen to know :?

Sorry :cry:
Image

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

Re: New approach for offline viewing PDF inside Android browser

Post by Klaus » Sun Jan 05, 2020 5:49 pm

I really did not intend to sue you for not knowing this, mon ami! 8)

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: New approach for offline viewing PDF inside Android browser

Post by bogs » Sun Jan 05, 2020 6:01 pm

:mrgreen: :mrgreen:
Image

Post Reply

Return to “Android Deployment”