PDF Viewer

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Jamie37
Posts: 53
Joined: Sat Dec 19, 2015 1:45 pm

Re: PDF Viewer

Post by Jamie37 » Tue Feb 16, 2016 12:15 am

Sorry for the confusion. It is an IOS app but I am probably just not understanding sorry.

Jamie

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: PDF Viewer

Post by quailcreek » Tue Feb 16, 2016 12:39 am

Ahh... that's what I though. Take a look at my first post in this thread. If you do a copy file like yo did. It puts the file into the engine folder of the app container. It's best to copy it to the documents folder. Then just read it from there.
Tom
MacBook Pro OS Mojave 10.14

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: PDF Viewer

Post by Klaus » Tue Feb 16, 2016 9:48 am

Hi Tom,
quailcreek wrote:If you do a copy file like yo did. It puts the file into the engine folder of the app container.
It will end up in -> specialfolderpath("resources") as I wrote a couple of times!
OK, on iOS systems this is the same as the ENGINE folder, but for crossplatform reasons
we should get used to use specialfolderpath("resources") :D
Read up the definition of this folder in the dictionary.

But I see this is obviously some version of LC 8, maybe another yet undiscovered bug of that DEVELOPER preview? :D
Jamie, can you try this with version 7.x to be sure?



Best

Klaus

Jamie37
Posts: 53
Joined: Sat Dec 19, 2015 1:45 pm

Re: PDF Viewer

Post by Jamie37 » Tue Feb 16, 2016 11:29 pm

Hello,

Thank you both for your help. It is very much appreciated. I have tried using version 7.1.1. However still no luck. This is the code I have on the card

Code: Select all

global sBrowserId

on openCard
    browserOpen
end openCard

on browserOpen
    -- We pass the windowId of the stack to revBrowser 
    -- so that it can determine which window to place the
    -- browser object into
    put the windowid of this stack into tWinID

    -- Open the browser, using the windowId and initial url
    put revBrowserOpen(tWinID,"") into sBrowserId

    -- Set some basic properties for the browser
    revBrowserSet sBrowserId, "showborder","true"
    revBrowserSet sBrowserId, "rect",rect of image "browser image"
end browserOpen

on browserClose
    revBrowserClose sBrowserId
end browserClose
And this is the code I have on the button...

Code: Select all

global sBrowserId

on mouseUp
   put specialfolderpath("resources") & "/TEST.pdf" into tPDFFile
   browserSetURL tPDFFile
end mouseUp

the browserSetURL handler is implemented in the card script

on browserSetURL tPDFFile
    ## Set the url to be displayed to the given url
    revBrowserSet sBrowserId, "url", ("file://" & tPDFFile)
end browserSetURL
Thanks
Jamie

Post Reply