Page 1 of 1
Saving a pdf you are viewing in iOS native browser
Posted: Wed Apr 18, 2012 5:56 pm
by w.wartersGA0dc3
I'm looking for help on the right syntax to save a pdf I'm viewing in a native iOS browser control (set up using MobGUI) to a local directory. What I really want to do then is preview and maybe print this document using the mergDoc external, but any help on taking the url made available on browserFinishedLoading and saving it to the local documents of the user would be appreciated.
Re: Saving a pdf you are viewing in iOS native browser
Posted: Fri Apr 20, 2012 1:54 am
by w.wartersGA0dc3
Well, I sorted it out and thought others would appreciate my solution if you are similarly puzzled. Basically, you get the currently active url doing something like the following:
Code: Select all
global gActiveURL --I use this lots of places, so it is a global
global gActiveURLfile
on browserFinishedLoading pURL
put pURL into gActiveURL
set the itemdelimiter to "/"
put item -1 of pURL into gActiveURLfile
put specialFolderPath("Documents") into tMyDir
put URL(gActiveURL) into URL("binfile:" & tMyDir & "/" & gActiveURLfile)
--this saves the pdf to the users Documents directory
-- the binfile: syntax took a while for me to get
end browserFinishedLoading
To print the file, I did the following using the rreHardCopyPrintPDF external:
Code: Select all
put specialFolderPath("temporary") into tMyDir
put URL(gActiveURL) into URL("binfile:" & tMyDir & "/" & gActiveURLfile)
put "My Print Job Name" into tPrintJob
set the printPaperOrientation to "portrait"
put specialFolderPath("temporary") & "/" & gActiveURLfile into tPDFFile
rreHardcopyPrintPDF tPDFFile, tPrintJob
if the result = "printing cancelled" then
exit to top
end if
Hope this helps.
Re: Saving a pdf you are viewing in iOS native browser
Posted: Fri Apr 20, 2012 5:35 am
by FireWorx
Thanks for posting that. I was watching on the sidelines. Here is a script for updating a PDF file in your documents folder from a new one on a web server. It replaces one with the same name. Also a nifty task.
on mouseUp
/* this is the path to a pdf called "boo" on my server */
put "
http://YourAccount.on-rev.com/boo.pdf" into thenewdocument
/* put the path of the "boo.pdf" into the variable thedocument */
put specialFolderPath("documents") & "/boo.pdf" into thedocument
/* now cange out the content of the "boo.pdf" that is on the server with the one in the docs folder of the app */
put URL (thenewdocument) into URL ("binfile:" & thedocument)
end mouseUp
Thanks again,
Dave
Re: Saving a pdf you are viewing in iOS native browser
Posted: Fri Apr 20, 2012 5:41 am
by FireWorx
Is there a way for me to just load that IOS print external into the copy files section in the standalone settings without having to go through all that xCode stuff in the RunRev link ? It looked complicated.
Dave