Open PDf inside of rev?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 56
- Joined: Sat Jun 20, 2009 2:41 pm
Open PDf inside of rev?
What is the best way to open a pdf?
Do you have to check to see if they have acrobat, etc then open?
I was programming in another high level language that had a built in pdf reader so this was super easy...?
Is there any way to have this in Runrev?
Thanks!
Do you have to check to see if they have acrobat, etc then open?
I was programming in another high level language that had a built in pdf reader so this was super easy...?
Is there any way to have this in Runrev?
Thanks!
-
- Posts: 56
- Joined: Sat Jun 20, 2009 2:41 pm
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Well, MacOSX ships with Preview, a quite capable PDF reader among other things. Most Linux distributions ship with Xpdf, Evince or KPDF. And most Windows boxes I've come accross had Acrobat Reader installed.
You can always put a download link for Acrobat Reader right next to your own app's download, so they can fetch it from Adobe's website if needed.
Jan Schenkel.
You can always put a download link for Acrobat Reader right next to your own app's download, so they can fetch it from Adobe's website if needed.
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
-
- Posts: 56
- Joined: Sat Jun 20, 2009 2:41 pm
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
The "launch url" command will launch a given URL or file path with the application currently registered with the OS to handle that type:
Code: Select all
answer file "Select a PDF File:" with type "PDF File|pdf"
if it is empty then exit to top
launch url ("file:"&it)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 56
- Joined: Sat Jun 20, 2009 2:41 pm
hmmm. I've got to have this super, super simple. Last time we had an app where people had to do anything but click a button and the pdf opened we had refunds...
I'm still not clear on what the path would be to the pdf if it was embedded into the program?
I'm pretty sure I'm going to have to use an installer to add some of the other files to a folder. I can just add the pdf to that folder as well maybe....
I'm still not clear on what the path would be to the pdf if it was embedded into the program?
I'm pretty sure I'm going to have to use an installer to add some of the other files to a folder. I can just add the pdf to that folder as well maybe....
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
The key is to build a path to the file based on its relative position to your executable, using something like this:
Code: Select all
on mouseUp
launch url PDFPath()
end mouseUp
-- Somewhere in your centralized code:
-- This function assumes you have a folder containing your PDFs
-- named "PDF Folder" in the same directory as your app:
function PDFPath
return AppPath()&"PDF Folder/MyPDF.pdf"
end PDFPath
-- This function returns the path to the executable on Windows
-- and the .app bundle on OS X:
function AppPath
put the filename of this stack into tPath
set the itemdel to "/"
If (IsOSX()) then
get offset(".app/Contents/MacOS/", tPath)
if it > 0 then -- 2.4.3 or later
delete char it to len(tPath) of tPath
end if
end if
delete last item of tPath
return tPath &"/"
end AppPath
function IsOSX
if the platform is not "MacOS" then return false
get the systemversion
set the itemdel to "."
if item 1 of it >= 10 then return true
return false
end IsOSX
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn