Reliable IOS and ANDROID pdf viewing

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
istech
Posts: 199
Joined: Thu Sep 19, 2013 10:08 am

Reliable IOS and ANDROID pdf viewing

Post by istech » Sat May 18, 2024 9:46 am

Hi Livecoders,

I do hope all are doing well.

I have an issue I hope someone can shine a light on. I am trying to view pdf's on both IOS and ANDROID mobile platforms. I have checked a couple solutions on the forums but none have been reliable. The current one that comes close to working is having a google embed which works on both platforms but only 80% of the time. Is there a way to make this option consistent? I have added a hander to reset the url on the browser widget when it fails which has slightly improved the failure rate but am really looking for a permanant solution. Any help would be appreciated.

LC- 9.6.11
browser widget

source link
https://stackoverflow.com/questions/74 ... ing-first

Code: Select all

on updateLatestBullet
   local tLink
   
   put the url of widget "bullet" of cd "BULLET" into tLink
   
   put the htmltext of widget "bullet" of cd "BULLET" into tResult
   
   if tResult is "<html><head></head><body></body></html>" then 
      
      set the url of widget "bullet" of cd "BULLET" to empty
      set the HTMLTEXT of widget "bullet" of cd "BULLET" to empty
      wait 500 milliseconds with messages
      set the url of widget "bullet" of cd "BULLET" to tLink
      
   else
      
      exit updateLatestBullet
      
   end if
   
end updateLatestBullet

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

Re: Reliable IOS and ANDROID pdf viewing

Post by FourthWorld » Sat May 18, 2024 4:44 pm

istech wrote:
Sat May 18, 2024 9:46 am
The current one that comes close to working is having a google embed which works on both platforms but only 80% of the time. Is there a way to make this option consistent?
Possibly, if we can determine the difference between the working and non-working instances.

Do you find patterns to the failures? (by document, session duration, phone model, etc)

Another option:

Are you limited to PDF? If you don't have a choice you don't have a choice, but most PDFs are delivered with a fixed size far larger than can be gracefully viewed on a small screen, requiring horizontal scrolling with every line in addition to vertical scrolling.

ePub offers an alternative designed to reflow based on display area, and depending on how the document is used there may be other options as well.

Of course the viability of alternatives will depend on sourcing. If it's stuff you make, you can make it in a mobile-friendly format. But if you need to work with stuff others make, it's only been a decade and a half and it seems it may be be a few more years before many information providers realize that handheld devices have been invented. 🙂
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

istech
Posts: 199
Joined: Thu Sep 19, 2013 10:08 am

Re: Reliable IOS and ANDROID pdf viewing

Post by istech » Sun May 19, 2024 6:52 pm

Hi Richard,

Thanks for chiming in. Hope you are doing well.

Currently, pdf is the only option for use. So no go on that front. I have definitely looked into seeing what the cause of the intermittent empty call. Nothing definitive at the moment. Narrowed down to either goggle embed issue or a browser widget cache problem. I saw a post with simular issue but the result was the bug had been fixed. May look to export the pages from the pdf to some images and go from there.

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

Re: Reliable IOS and ANDROID pdf viewing

Post by Klaus » Sun May 19, 2024 7:06 pm

There is a PDF widget form LC, but it cannot be bought separately, which is a shame. :(
It is part of the "Pro Pack"*, which costs 328.90 Euro PLUS VAT. :shock:

*This also contains:
Mobile Debugger
Script profiler
tsNet Pro
mergAccessory (Bluetooth on iOS and whatnot...)

istech
Posts: 199
Joined: Thu Sep 19, 2013 10:08 am

Re: Reliable IOS and ANDROID pdf viewing

Post by istech » Tue May 21, 2024 3:37 pm

Wow not cheap when you only want one item. I'll think on it. In the meantime will try a couple workarounds. Thanks for your input.

istech
Posts: 199
Joined: Thu Sep 19, 2013 10:08 am

Re: Reliable IOS and ANDROID pdf viewing

Post by istech » Mon May 27, 2024 1:45 pm

Just to update anyone trying this. I resolved this issue by putting a longer wait and a recheck/reset of the URL until the page is rendered.

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

Re: Reliable IOS and ANDROID pdf viewing

Post by FourthWorld » Mon May 27, 2024 4:43 pm

istech wrote:
Mon May 27, 2024 1:45 pm
Just to update anyone trying this. I resolved this issue by putting a longer wait and a recheck/reset of the URL until the page is rendered.
Glad you found a solution. Thank you for sharing what you'd learned.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Talking LiveCode”