Skip to main content
Known Participant
December 20, 2021
Question

Illustrator has problems opening PDF file editing

  • December 20, 2021
  • 3 replies
  • 1086 views

I use AppleScript to open PDF files for processing. After saving, the PDF file only keeps the pages I opened, and the other pages are gone.

 

For example, my PDF has 8 pages, I opened the first page for processing and saving, and the remaining 7 pages disappeared after saving.

 

set user interaction level to never interact 

set page of PDF file options of settings to "2"

open file fileToOpen without dialogs

set theDoc to the front document

tell theDoc

rasterize source art page items with options {resolution:450}

end tell

save theDoc

close theDoc

set user interaction level to interact with all

 

This topic has been closed for replies.

3 replies

Ton Frederiks
Community Expert
Community Expert
December 21, 2021

If the resulting file has to be a pdf containing only images, Acrobat's Preflight > Fixups may help. You can create (or modify) a fixup that convert the pages into images.

Known Participant
December 21, 2021

thank you for your suggestion. I will give it a try, but I also want to know what went wrong with the code I wrote. This will allow me to use AppleScript better in the future.

Lukas Engqvist
Community Expert
Community Expert
December 21, 2021

Using Illustrator as a PDF editor is a little beyond the scope of the intended use of Illustrator. You may find issues with Fonts, Images and Colour Management depending on what kind of content and how it was created. There are many PDF features not supported by Adobe Illustrator.
I would suggest exploring using Acrobat Pro to fix your PDF files, there are plenty PDF fixups and actions you can automate or convert into Droplets.

Known Participant
December 21, 2021

I know that Illustrator is used to edit PDF will have problems, I only want to use the rasterize function, PDF is generated by indesign, but I did not find this function in indesign and Acrobat Pro, so I did this.

Known Participant
December 21, 2021

You can also export rasterized files directly from InDesign


I want indesign to export to PDF format but the content is rasterized, but I did not find the correct way.

Legend
December 20, 2021

Hello @PTLPP035C36,

 

Can you post the entire code, what you posted doesn't work for us to test it...

 

Regards,

Mike

Known Participant
December 21, 2021

I tried and found that the problem may appear in "open file fileToOpen without dialogs", but I don't know how to modify it. Of course, this is just my personal idea.

 

Please create a multi-page pdf file named "test.pdf" on the desktop.

 

set desktopPath to path to desktop as string
set fileToOpen to desktopPath & "test.pdf"
tell application "Adobe Illustrator"
set user interaction level to never interact
set link pages of PDF file options of settings to false
set page of PDF file options of settings to "2"
open file fileToOpen without dialogs
set theDoc to the front document
tell theDoc
rasterize source art page items with options {resolution:450}
end tell
do javascript "app.executeMenuCommand('save');"
close theDoc
set user interaction level to interact with all
end tell