Skip to main content
Loic.Aigon
Legend
December 3, 2010
Answered

Save as PDF with [PDF/X-1a:2001] preset not flattening issue

  • December 3, 2010
  • 2 replies
  • 3276 views

Hi all,

I have a document with some transparency so I want to flatten it while saving to a PDF. In the UI, if I save it using [PDF/X-1a:2001] preset, it's perfeclty flattened.

But if I order the same operation through scripting, it doesn't. What am I doing wrong, it makes me crazy !

var doc=app.activeDocument;

var pdfSaveOptions = new PDFSaveOptions();
pdfSaveOptions.pDFPreset="[PDF/X-1a:2001]";

var pdfFile = new File(Folder.desktop + "/testIllu4.pdf");
doc.saveAs(pdfFile, pdfSaveOptions);

TIA.

Loic

This topic has been closed for replies.
Correct answer Larry G. Schneider

Loic,

Here's a function which has worked for me

function getPDFOptions()
{    var NamePreset = 'pdf map';
   
    // Create the PDFSaveOptions object to set the PDF options
    var pdfSaveOpts = new PDFSaveOptions();
   
    // Setting PDFSaveOptions properties. Please see the JavaScript Reference
    // for a description of these properties.
    // Add more properties here if you like
    pdfSaveOpts.acrobatLayers = true;
    pdfSaveOpts.colorBars = false;
    pdfSaveOpts.colorCompression = CompressionQuality.AUTOMATICJPEGHIGH;
    pdfSaveOpts.compressArt = true; //default
    pdfSaveOpts.embedICCProfile = false;
    pdfSaveOpts.enablePlainText = true;
    pdfSaveOpts.generateThumbnails = true; // default
    pdfSaveOpts.optimization = true;
    pdfSaveOpts.pageInformation = true;
    pdfSaveOpts.pDFPreset = NamePreset;
   
    // uncomment to view the pdfs after conversion.
    // pdfSaveOpts.viewAfterSaving = true;

    return pdfSaveOpts;
}

2 replies

Larry G. Schneider
Community Expert
Larry G. SchneiderCommunity ExpertCorrect answer
Community Expert
December 22, 2010

Loic,

Here's a function which has worked for me

function getPDFOptions()
{    var NamePreset = 'pdf map';
   
    // Create the PDFSaveOptions object to set the PDF options
    var pdfSaveOpts = new PDFSaveOptions();
   
    // Setting PDFSaveOptions properties. Please see the JavaScript Reference
    // for a description of these properties.
    // Add more properties here if you like
    pdfSaveOpts.acrobatLayers = true;
    pdfSaveOpts.colorBars = false;
    pdfSaveOpts.colorCompression = CompressionQuality.AUTOMATICJPEGHIGH;
    pdfSaveOpts.compressArt = true; //default
    pdfSaveOpts.embedICCProfile = false;
    pdfSaveOpts.enablePlainText = true;
    pdfSaveOpts.generateThumbnails = true; // default
    pdfSaveOpts.optimization = true;
    pdfSaveOpts.pageInformation = true;
    pdfSaveOpts.pDFPreset = NamePreset;
   
    // uncomment to view the pdfs after conversion.
    // pdfSaveOpts.viewAfterSaving = true;

    return pdfSaveOpts;
}

Loic.Aigon
Legend
December 23, 2010

Hi Larry,

Thx a lot for your answer. I am away for the holydays but will test yout code when I am back and let you know.

Thanks again and happy holydays to you

Loic

Loic.Aigon
Legend
January 3, 2011

Hi Larry,

Just tried your function and indeed if I have a specific preset, it works. I hoped I could just set the PDF options without calling a preset.

I just looked and it seems like impossible to add a preset into Illustrator

That's really tough.

Thanks a lot anyway for helping.

Loic

Edit : FINALLY, I could get it. I suspected something when I saw into Acrobat that the file didn't contain transparency but was indeed transparent into Illustrator. I forgot to deactivate the editability. And that was all !

var doc=app.activeDocument;

var pdfSaveOptions = new PDFSaveOptions();
pdfSaveOptions.pDFXStandard=PDFXStandard.PDFX1A2001;
pdfSaveOptions.compatibility = PDFCompatibility.ACROBAT4;
pdfSaveOptions.preserveEditability = false;

var pdfFile = new File(Folder.desktop + "/test.pdf");
doc.saveAs(pdfFile, pdfSaveOptions);

Loic

Message was edited by: Loic_aigon

c.pfaffenbichler
Community Expert
Community Expert
December 22, 2010

Aren’t the Standards (»PDF/X-1a:2001« etc.) something quite different than a pDFPreset?

Edit: Namely pDFStandard