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

Script - exportAsSinglePages (true) - a window is opened when process is finished

Community Beginner ,
Oct 19, 2020 Oct 19, 2020

Copy link to clipboard

Copied

Hi,

 

When the exportAsSinglePages is turned to true, Indesign open an os window at the end of the process in different folders.

It is very problematic. I tried to find a solution to off this behaviour but I cannot find anything.

I would like:
- erase the old PDF (not create a folder for each export)
- turn off the 'open os windows' function

In the DOM I cannot find any option to do this.

Anyone have a solution or a workaround, or maybe it is not possible?

 

Regards

TOPICS
Scripting

Views

329

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
Community Expert ,
Oct 19, 2020 Oct 19, 2020

Copy link to clipboard

Copied

Not sure about the folder issue, but you probably want to turn the viewPDF preference off: 

 

 

app.pdfExportPreferences.viewPDF = false;

 

 

 

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
Community Beginner ,
Oct 19, 2020 Oct 19, 2020

Copy link to clipboard

Copied

Thanks for your response.

 

But the problem is not the 

app.pdfExportPreferences.viewPDF

The problem is an operating system window is open at each export (see attached link on Mac).

 

You can reproduce the problem by exporting a PDF with preset from Indesign and select the option 'create separate PDF files'.

After the PDFs was created, an os windows is automatically opened (on Mac OS).

 

Regards 

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
Community Expert ,
Oct 20, 2020 Oct 20, 2020

Copy link to clipboard

Copied

Hi,

 

What version of InDesign are you using, when I select "Create separate PDF Files" the option to view after is greyed out and all the PDF files are created without any OS dialog being shown.

 

Using indesing - 15.1.2

 

Regards

 

Malcolm

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
Community Beginner ,
Oct 20, 2020 Oct 20, 2020

Copy link to clipboard

Copied

Indd version.jpg

15.1.2 UK

OS 10.14.6 : UK

 

I tested on another Mac (10.15.7) with the last version of Indesign (15.1.2 in Japanese language) I have the same problem:

JPN Indd.jpg

 

With script or without script (just manual export) I have the same issue.

 

Regards

 

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
Community Expert ,
Oct 20, 2020 Oct 20, 2020

Copy link to clipboard

Copied

HI,

So is the problem that it opens the folder with the files, or that it shows the above dialog? (the one you attached in the first post).

 

The folder is opened when I run it.

 

Regards

 

Malcolm

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
Community Beginner ,
Oct 20, 2020 Oct 20, 2020

Copy link to clipboard

Copied

Thanls for your help!

 

So is the problem that it opens the folder with the files - YES

 

I would like to desactivate this feature, it poses a problem with script automation.

 

Folder.jpg

 

Another strange behavior:

Indesign Preflight.

Using a script with the option 'exportAsSinglePages' turned to 'true' and the Indesign preflight activated, each preflight report are created in a specific folder:

 

result.jpg

 

Desativate the 'exportAsSinglePages' option and the Indesign preflight will be created at the root of the folder:

Screenshot 2020-10-21 at 9.44.26.jpg

 

It is a little bit strange that the pdf 'exportAsSinglePages' option change the behavior of the preflight report.

 

English is not my native language, I am sorry if my explanation was not very clear.

 

Regards

 

 

 

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
Community Expert ,
Oct 20, 2020 Oct 20, 2020

Copy link to clipboard

Copied

Can you post the relevant code for both the folder and preflight issue? I suspect the folder issue is due to the preflighting. Do you get the folders if preflight is deactivated?

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
Community Beginner ,
Oct 21, 2020 Oct 21, 2020

Copy link to clipboard

Copied

LATEST

Thanks.

 

I cannot copy the original script (too many files), I made a simple script that export PDF that can reproduce the same problem.

I made this script in a very short time, I am very sorry if this not respect the rules of coding.

 

Screenshot 2020-10-21 at 17.07.41.jpg

 

// Options - line 99

Change the variable to false if you want to desactivate the single page pdf export.

var asSinglePagePdf = true; // change this line to false to desactivate as single PDF page option
 

//Preflight - line 96/97

var resultPreflight = this.setPreflight(docRef, false); // comment this line and uncomment the line bellow to desactivate the preflight check

// var resultPreflight = true;
 

 

(function () {

	this.setPreflight = function (_docRef, _openReport) {
		var docRef = _docRef;
		var openReport = _openReport;
		var myProfile = app.preflightProfiles[0]; // assume that is the [Basic] profile
		if (myProfile.isValid) {
			var myProcess = app.preflightProcesses.add(docRef, myProfile, undefined, undefined);
			myProcess.waitForProcess(undefined);
			var aggregatedResults = [];
			aggregatedResults = myProcess.aggregatedResults;

			if (aggregatedResults.length === 0) {
				myProcess.remove();
				return true;
			} else {
				var path = docRef.filePath;
				var name = "PreflightResults.pdf";
				var file = File(path + "/" + name);
				myProcess.saveReport(file, openReport);
				myProcess.remove();
				return true;
			}
		} else {
			alert("Preflight profile is invalid!");
			return false;
		}


	};

	this.setPdfOption = function (_asSinglePagePdf) {

		var asSinglePagePdf = _asSinglePagePdf;

		app.pdfExportPreferences.standardsCompliance = PDFXStandards.NONE;
		app.pdfExportPreferences.acrobatCompatibility = AcrobatCompatibility.ACROBAT_6;
		app.pdfExportPreferences.exportGuidesAndGrids = false;
		app.pdfExportPreferences.exportLayers = false;
		try {
			app.pdfExportPreferences.exportNonprintingObjects = false;
		} catch (e) {}
		app.pdfExportPreferences.exportReaderSpreads = false;
		app.pdfExportPreferences.generateThumbnails = false;
		try {
			app.pdfExportPreferences.ignoreSpreadOverrides = false;
		} catch (e) {}
		app.pdfExportPreferences.includeBookmarks = true;
		app.pdfExportPreferences.includeHyperlinks = false;
		app.pdfExportPreferences.includeICCProfiles = false;
		app.pdfExportPreferences.includeSlugWithPDF = false;
		app.pdfExportPreferences.includeStructure = false;
		try {
			app.pdfExportPreferences.interactiveElementsOption = 1097887823;
		} catch (e) {}
		app.pdfExportPreferences.subsetFontsBelow = 0;
		app.pdfExportPreferences.colorBitmapCompression = BitmapCompression.JPEG;
		app.pdfExportPreferences.colorBitmapQuality = CompressionQuality.MAXIMUM;
		app.pdfExportPreferences.colorBitmapSampling = Sampling.BICUBIC_DOWNSAMPLE;
		app.pdfExportPreferences.grayscaleBitmapCompression = BitmapCompression.JPEG;
		app.pdfExportPreferences.grayscaleBitmapQuality = CompressionQuality.MAXIMUM;
		app.pdfExportPreferences.grayscaleBitmapSampling = Sampling.BICUBIC_DOWNSAMPLE;
		app.pdfExportPreferences.monochromeBitmapCompression = MonoBitmapCompression.CCIT4;
		app.pdfExportPreferences.monochromeBitmapSampling = Sampling.NONE;
		app.pdfExportPreferences.compressionType = PDFCompressionType.COMPRESS_NONE;
		app.pdfExportPreferences.compressTextAndLineArt = true;
		app.pdfExportPreferences.cropImagesToFrames = true;
		app.pdfExportPreferences.optimizePDF = true;
		app.pdfExportPreferences.colorBars = false;
		app.pdfExportPreferences.colorTileSize = 128;
		app.pdfExportPreferences.grayTileSize = 128;
		app.pdfExportPreferences.cropMarks = true;
		try {
			app.pdfExportPreferences.omitBitmaps = false;
			app.pdfExportPreferences.omitEPS = false;
			app.pdfExportPreferences.omitPDF = false;
		} catch (e) {}
		app.pdfExportPreferences.pageInformationMarks = false;
		app.pdfExportPreferences.pageMarksOffset = "6 pt";
		try {
			app.pdfExportPreferences.simulateOverprint = true;
		} catch (e) {}
		app.pdfExportPreferences.useDocumentBleedWithPDF = true;
		app.pdfExportPreferences.viewPDF = false;

		/** as single page */
		app.pdfExportPreferences.exportAsSinglePages = asSinglePagePdf;

		return true;
	};

	if (app.documents.length > 0) {

		var docRef = app.activeDocument;

		var resultPreflight = this.setPreflight(docRef, false); // comment this line and uncomment the line bellow to desactivate the preflight check
		// var resultPreflight = true;

		var asSinglePagePdf = true; // change this line to true to export as single PDF

		if (resultPreflight) {
			this.setPdfOption(asSinglePagePdf);
			var newPath = Folder(docRef.filePath + "/" + "PdfExportTest");
			if (!newPath.exists) {
				newPath.create();
			}
			var newName = docRef.name.split(".indd")[0] + "_TestByScript" + ".pdf";
			var pdfFile = File(newPath.fsName + "/" + newName);
			docRef.asynchronousExportFile(ExportFormat.PDF_TYPE, pdfFile, false, undefined, undefined, undefined);
		}

	} else {
		alert("Please, open a document!");
	}

})();

 

 

Best regards

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