• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Printing in a PDF with Filename - Folder and Filename are ignored

Explorer ,
Jun 06, 2017 Jun 06, 2017

Copy link to clipboard

Copied

With a script for Illustrator I try to make the printing-process for our staff easier. They need to specify different Folders for A4 and A3 PDFs.

First thoughts: I have Illustrator-Files with different Artboard-sizes and Page Orientations. Our RIP does not recognize the document-pages being A4 or A3. So I have to split the File in at least two PDFs, one is A4, one is A3. All of them must be in Portrait-Mode so that A4 and A3 is used completely. Printing in a PDF (Windows workflow) works with PrintOrientation set to AUTOROTATE.

Rotating the artboards with all Objects and save as PDF would be great but I figured out it's pretty complicated. So I would like to go on with printing in a PDF and using the Autorotate feature.

Where I am stuck: The filename and the printJobOptions seem to be ignored. I need to specify the path of the filename and the Media-Size but the PDF-Settings of the virtual PDF-Printer I am using as standard seem to be used first and all the properties in the Script are overwritten. This is the Standard-Setting of the PDF:

AdobePDF.png

This is the script so far:

#target Illustrator

#targetengine main

/*

var originalInteractionLevel = userInteractionLevel;

userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

*/

var docRef = app.activeDocument;

var options = new PrintOptions();

/* printJobOptions.printPreset = 'Netzfeld-test'; */

// Printer

options.printerName = 'Adobe PDF';

options.PPDName = 'Adobe PDF';

// Fonts

var fontOpts = new PrintFontOptions();

fontOpts.downloadFonts = PrintFontDownloadMode.DOWNLOADCOMPLETE;

fontOpts.fontSubstitution = FontSubstitutionPolicy.SUBSTITUTETINT;

options.fontOptions = fontOpts;

// Color

var colorOptions = new PrintColorManagementOptions();

colorOptions.intent = PrintColorIntent.RELATIVECOLORIMETRIC;

colorOptions.colorProfileMode = PrintColorProfile.CUSTOMPROFILE;

colorOptions.name = "Coated FOGRA39 (ISO 12647-2:2004)";

options.colorManagementOptions = colorOptions;

// Seperation

var sepOptions = new PrintColorSeparationOptions();

sepOptions.convertSpotColors = true;

sepOptions.overPrintBlack = true;

sepOptions.colorSeparationMode = PrintColorSeparationMode.COMPOSITE;

sepOptions.colorProfileMode = PrintColorProfile.SOURCEPROFILE;

options.colorSeparationOptions = sepOptions;

// Print Coordinates

var coordinateOptions = new PrintCoordinateOptions();

coordinateOptions.emulsion = false; // reverse from right to left

coordinateOptions.fitToPage = false; // fit artwork to page size

coordinateOptions.position = PrintPosition.TRANSLATECENTER;

coordinateOptions.orientation = PrintOrientation.AUTOROTATE;

options.coordinateOptions = coordinateOptions;

// Filename and Artboards are ignored

var printJobOptions = new PrintJobOptions();

options.printJobOptions = printJobOptions;

// Filename

var docPath = new File('C://_temp//bla.pdf');

printJobOptions.file = docPath;

// Artboards

printJobOptions.designation = PrintArtworkDesignation.VISIBLEPRINTABLELAYERS;

printJobOptions.printArea = PrintingBounds.ARTBOARDBOUNDS;

printJobOptions.collate = true;

printJobOptions.printAllArtboards = false;

printJobOptions.artboardRange = '1';

// Print

docRef.print(options);

/*

userInteractionLevel = originalInteractionLevel;

*/

What's wrong with it? What's missing?
The example in the Scripting Manual of Illustrator on page 176 doesn't seem to work either when I print to PDF: http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2017/Illustrator_JavaScript...

TOPICS
Scripting

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Jun 06, 2017 Jun 06, 2017

Copy link to clipboard

Copied

var docPath = new File('C://_temp//bla.pdf'); <-- can you try with just one single slash last? 'C://_temp/bla.pdf'

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 06, 2017 Jun 06, 2017

Copy link to clipboard

Copied

Thanks for your prompt answer,
I really appreciate this.
I tried this before but it didn't change anything. The complete Filename and Artboards seem to be ignored and the setting from the PDF-Joboption overwrites everything although I haven't set it in the Script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 07, 2017 Jun 07, 2017

Copy link to clipboard

Copied

How about set the file path in the "Adobe PDF Setting" to "Documents/*.pdf", print it and then copy and rename the file to desired folder?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 07, 2017 Jun 07, 2017

Copy link to clipboard

Copied

The Script is only a part of a bigger one and about 50 Designers will use it in a corporate environment to distribute their print-outs on different printers. Renaming and putting the PDF to the Printing Hotfolder would take too long in order to the manual printing in PDF-workflow and it's neccecary to generate at least two PDF-Files (A4 and A3). The Files of the Designers consist of different Artboards with A4 and A3-Pages and different Page-Orientations. The PDFs are about to be saved in different Folders. The Folder-Path and name consists of the printer and the Pagesize.

The RIP does only work with Pages of A4 or A3 and in Portrait-Mode, the small side first.
Therefor I have to rotate the pages.

I made up my mind and consider the second possiblity now:
Export to PDF
The Problem is the rotation of the artboards. I have an idea for a workaround but that's beyond my scripting abilities.

Here is what I've done so far and a better explanation:
download.netzfeld.de/Illustrator-Rotate-Artboards-to-Portrait-ExportPDF.zip


Starting with a small script it's now a little project I cannot complete myself, I think.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 09, 2017 Jun 09, 2017

Copy link to clipboard

Copied

LATEST

Hi, you can test this:

Make mask > rotate mask group > rotate artboard > save pdf.

#target illustrator 

var docRef = app.activeDocument; 

var artboardRef = docRef.artboards;

app.executeMenuCommand ('unlockAll');

var a4 = [], a3 = [];

for(var i=0;i<artboardRef.length;i++){ 

    var top=artboardRef.artboardRect[1] ; 

    var left=artboardRef.artboardRect[0]; 

    var width=artboardRef.artboardRect[2]-artboardRef.artboardRect[0]; 

    var height=artboardRef.artboardRect[1]-artboardRef.artboardRect[3]; 

    app.selection = null;

    if (width > height) {

        var rect = docRef.pathItems.rectangle (top, left, width, height); 

        artboardRef.setActiveArtboardIndex(i);

        app.executeMenuCommand ('selectallinartboard');

        app.executeMenuCommand ('makeMask');

        app.selection[0].rotate(90);

        docRef.fitArtboardToSelectedArt(i);

    }

    if (width > 1000 || height > 1000) {

        a3.push(i+1);

    } else {

        a4.push(i+1);

    }

}

savePDF('_A3', a3.join(','));

savePDF('_A4', a4.join(','));

// Save the artboards to PDF.

function savePDF(size, range) {

    var ordner = '~/desktop/';

    var dateiNameExt = activeDocument.name.split( "." );

    var dateiName = dateiNameExt[dateiNameExt.length-2];

    var destFile = new File (ordner + dateiName + size + ".pdf");

    var pdfSaveOptions = new PDFSaveOptions();

    pdfSaveOptions.generateThumbnails = false; //keine Thumbnails

    pdfSaveOptions.preserveEditability = false; //keine Edierbarkeit, also keine AI-Daten

    // pdfSaveOptions.printerResolution = 300.0; //Optional. Flattening printer resolution. Default: 800.0

    pdfSaveOptions.viewAfterSaving = false; //Ansicht nach der PDF-Erstellung

    pdfSaveOptions.artboardRange = range;

    docRef.saveAs (destFile,  pdfSaveOptions);

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines