Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hello @PTLPP035C36,
Can you post the entire code, what you posted doesn't work for us to test it...
Regards,
Mike
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
You can use File > Export to > Image... in Acrobat
Copy link to clipboard
Copied
You can also export rasterized files directly from InDesign
Copy link to clipboard
Copied
I want indesign to export to PDF format but the content is rasterized, but I did not find the correct way.
Copy link to clipboard
Copied
If you are rasterising for print problems you can use "Print as Image" from Acrobat. There is also a setting in InDesign to set balance between if artwork is raster or vector, and you have other options suggested by @Ton Frederiks and Brad @ Roaring Mouse
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.