Sunday, August 19, 2018

#1 2018-08-07 01:37:25 pm

pcLoadLetter
Member
Registered: 2016-09-23
Posts: 41

Flatten PDFs

So, I have the following script which is supposed to open the pdf, flatten it and save and close it. While it opens the pdf and saves and closes it, it doesn't look like it's flattening it. All the text is editable. Complicated graphics with many pieces are still complicated graphics with many pieces.

How do I get the pdf to flatten?

Applescript:

--Path to PDF
tell application "Finder" to set file_path to POSIX file "/Volumes/NAS/Advertising Department/20_PUBLICATION PDFS/PetCareEvent2_18 (20)_Final_7357 copy.pdf"

--Opening & Flattening the PDF
tell application "Adobe Acrobat"
   open file_path as alias
   tell document 1
       do script "this.flattenPages();"
       
       --Saving & Closing the PDF
       save to file file_path
       close
   end tell
end tell

Last edited by pcLoadLetter (2018-08-07 01:37:38 pm)

Offline

 

#2 2018-08-07 08:05:21 pm

Budgie
Member
From:: New Zealand
Registered: 2005-02-22
Posts: 648

Re: Flatten PDFs

hI

I have had issues with "do script" and "do script file" for ages, so opted to use the "Preflight" part of Acrobat
which for me is a fantastic resource, very powerful part of acrobat I have found.

If your not sure where it is, goto  edit, preflight,  under the "profiles tab", select "show all", type "Flatten" in the find area
then select  "Flatten transparency (high resolution)" then edit,  from this part you can navigate your way around, make
your own custom set up etc etc, it takes a bit of getting used to but worth the mucking around, well for me it was.

so try this, it uses a built in profile in acrobat, of which you can alter to suit your own needs, or you
can create your own profile.


Applescript:

--Path to PDF
tell application "Finder" to set file_path to POSIX file "/Volumes/NAS/Advertising Department/20_PUBLICATION PDFS/PetCareEvent2_18 (20)_Final_7357 copy.pdf"

--Opening & Flattening the PDF
tell application "Adobe Acrobat"
   open file_path as alias
   tell document 1
       
       do script "var oProfile = Preflight.getProfileByName('Flatten transparency (high resolution)')
       this.preflight(oProfile);
       "

       --Saving & Closing the PDF
       save to file file_path
       close
   end tell
end tell


Cheers
Budgie

"There's no shame in accepting aid from others... but perhaps there is a  responsibility."    - Batman

Offline

 

#3 2018-08-08 12:04:57 pm

pcLoadLetter
Member
Registered: 2016-09-23
Posts: 41

Re: Flatten PDFs

Thank You!!! smile
That made the pdf work for the people here who were having trouble printing it. Now, I can just add it to the AppleScript that makes the pdf book. smile

Offline

 
pornplaybb.com shemalevids.org macromastiavideo.com

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)