Copy link to clipboard
Copied
Hello -
I try to write up a script that will generate a PDF on the fly.
The PDF must embed the "ICC profile" and must have all images embedded.
The PDF is generated, but neither the "ICC profile" nor "images" are embed ![]()
Any idea why?
Here is a snippet of my code:
#target Illustrator
#targetengine main
app.activeDocument.selection = null; // Ensure there is nothing in the document selected already. This way you only get the selection you want.
app.redraw();
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var myDoc = app.activeDocument;
var myLayers = myDoc.layers;
var PDF_HRpreset = "[Press Quality]";
var HighResOpts = new PDFSaveOptions(); // Create the PDFSaveOptions object to set the PDF options/properties
HighResOpts.embedICCProfile = true;
HighResOpts.pDFPreset = PDF_HRpreset;
//
// Embed ALL images (So we don't loose images' links when we open the PDF with Illustrator <- Client's late request)
//
if ( myDoc.length > 0 ) {
while ( app.activeDocument.placedItems.length > 0 ) {
placedArt = app.activeDocument.placedItems[0];
placedArt.embed();
}
}
myDoc.saveAs(File("~/Desktop" + "/" + myDoc.name.replace(".ai", "_MOCKUP.pdf")), lowResOpts);
Thank you for any help. Regards,
- Dimitri
Message was edited by: Vasily Hall
you probably need
HighResOpts.colorProfileID = ColorProfile.INCLUDEALLPROFILE;
about embedding...your problem is line 25
Copy link to clipboard
Copied
you probably need
HighResOpts.colorProfileID = ColorProfile.INCLUDEALLPROFILE;
about embedding...your problem is line 25
Copy link to clipboard
Copied
Good morning Carlos -
Thank you for your quick reply.
I'll definitively give it a try and give some feedback.
Regards,
- Dimitri
Copy link to clipboard
Copied
Hello Carlos -
Thx, it works like a charm ![]()
Solution to embed the profiles is thus:
HighResOpts.colorProfileID = ColorProfile.INCLUDEALLPROFILE;
Regarding the embed all images problem, I finally decided to work with this piece of code:
//
// Embed ALL images (So we don't loose images' links when we open the PDF with Illustrator <- Client's late request)
//
function embedInAllDocuments_fct() {
var placedArt;
for (var i=app.documents.length-1; i>-1; i--) {
while ( app.documents.placedItems.length > 0 ) {
placedArt = app.documents.placedItems[0];
placedArt.embed();
}
}
}
So, thank you again Carlos for your time and knowledge 🙂
Regards,
- Dimtiri
Copy link to clipboard
Copied
you're welcome,
but did you see what the issue was with line 25 in your first script?
Copy link to clipboard
Copied
Nope… 😞
Except if "MyDoc" was undefined or something like this.
I'm sorry.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now