Copy link to clipboard
Copied
Hi All
I'm trying to open a single page from a multi page pdf using illustrator, edit the page and then save it back to the original multi page pdf, however I'm struggling to get the desired behaviour using a script.
On opening the pdf manually the page selection dialog states "To save this page back to the original multiple-page pdf, use the "Save" command, and this works when I click it, however when I use a script to save the opened pdf it only saves an ai file and doesn't updates the original pdf.
Here's the line in the script I tried to use to get the same behaviour as clicking 'save':
app.activeDocument.save()
Can anyone suggest how I might be able to achieve this in a script? I could consider art boards but it seems there should be a simple way to get the same behaviour as clicking save.
Thanks for any pointers.
If CS6+, you can use:
app.executeMenuCommand('save');
Copy link to clipboard
Copied
If CS6+, you can use:
app.executeMenuCommand('save');
Copy link to clipboard
Copied
Hi moluapple
Thanks for your response, this seems like the right approach however adding app.executeMenuCommand('save') also seems to stop the preceding lines of the script from being run. I've posted a new question looking at this specifically:
Copy link to clipboard
Copied
Think I have the solution:
// Remove a layer from the pdf
app.activeDocument.layers.getByName('Layer 1').remove();
// redraw (otherwise preceding script lines are ignored)
redraw();
// Save the pdf using the menu command
app.executeMenuCommand ('save');