[SOLVED] How to load a pdf file and then save it through programming?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
karmacomposer
Posts: 361
Joined: Wed Apr 27, 2011 2:12 pm

[SOLVED] How to load a pdf file and then save it through programming?

Post by karmacomposer » Wed Jul 15, 2020 2:26 pm

I have tried to load a pdf file as a binary file and then save it as binary and the resulting saved file is not able to be opened by anything.

I have successfully done this with almost all other binary file types without incident.

How does one load a pdf file (not to show it, just to load it), process it (I already can do that) and then save it back again as a correct
pdf file that will open natively?

Thanks for your help.

Mike
Last edited by karmacomposer on Thu Jul 16, 2020 5:29 pm, edited 1 time in total.

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: How to load a pdf file and then save it through programming?

Post by AxWald » Thu Jul 16, 2020 10:46 am

Hi,

try this:

Code: Select all

on mouseUp
   answer file "Load what?"
   put URL ("binfile:" & it) into myPDF
   --  do something with myPDF
   ask file "Save to:"
   put myPDF into URL ("binfile:" & it)
end mouseUp
Key is to specify the "binfile:" URL scheme. Works here.

Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

karmacomposer
Posts: 361
Joined: Wed Apr 27, 2011 2:12 pm

Re: How to load a pdf file and then save it through programming?

Post by karmacomposer » Thu Jul 16, 2020 5:28 pm

Thank you.

That 100% worked.

I did not know that command.

Mike

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”