Page 1 of 1

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

Posted: Wed Jul 15, 2020 2:26 pm
by karmacomposer
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

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

Posted: Thu Jul 16, 2020 10:46 am
by AxWald
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!

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

Posted: Thu Jul 16, 2020 5:28 pm
by karmacomposer
Thank you.

That 100% worked.

I did not know that command.

Mike