Creating separate pages pdf using (exportAsSinglePages, singlePagesPDFSuffix).

Community Beginner ,
Mar 18, 2022 Mar 18, 2022

Copy link to clipboard

Copied

How to create single pages pdf for the selected range using script. Unable to find a solution through the forum except looping through pages.

 

TOPICS
Scripting

Views

100

Likes

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

correct answers 1 Correct answer

Adobe Community Professional , Mar 18, 2022 Mar 18, 2022
Hi @Singaaram , there are the exportAsSinglePages and  singlePagesPDFSuffix properties in pdfExportPreferences. This exports pages 2 and 4 to a chosen folder using the PDF/X-4 preset var f = Folder.selectDialog("Select a folder for the PDF pages"); var doc = app.documents.item(0); var n = doc.name.replace(/\.[^\.]+$/, '') var thePath = f + "/" + n + ".pdf"; var preset=app.pdfExportPresets.itemByName("[PDF/X-4:2008]"); //the exportAsSinglePages property set to true exports single pages. T...

Likes

Translate

Translate
Adobe Community Professional ,
Mar 18, 2022 Mar 18, 2022

Copy link to clipboard

Copied

Presumably, you are aware of the "Create Separate PDF Files" facility in the Export Adobe PDF dialogue box?

 

separate PDFs.jpg

Likes

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 ,
Mar 18, 2022 Mar 18, 2022

Copy link to clipboard

Copied

Hi Derek,

 

Thanks. Yes I am aware of that. But in a scripting I don't know how to integrate this in pdf creation.

I have this code only. But this did not worked for ranges. So I had to make alternate solution. 

myPages = theDoc.pages;
for (i = 0; i < myPages.length; i += 1) {
myPage = myPages[i];
myPageName = padder(i + 1, 2);
myPageRange = myPage.name;
myFilePath = myFolder + "/" + docNameNoExt + "_Big_" + myPageName + ".pdf";
myPerPageFile = new File(myFilePath);
app.pdfExportPreferences.pageRange = myPageRange;
theDoc.exportFile(ExportFormat.pdfType, myPerPageFile, false, myPDFExportPreset);
}
function padder(n, width, leadingSymbol) {
leadingSymbol = leadingSymbol || "0";
n = n + "";
return n.length >= width ? n : new Array((width - n.length) + 1).join(leadingSymbol) + n;
}

Likes

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 Community Professional ,
Mar 18, 2022 Mar 18, 2022

Copy link to clipboard

Copied

Hi @Singaaram , there are the exportAsSinglePages and  singlePagesPDFSuffix properties in pdfExportPreferences. This exports pages 2 and 4 to a chosen folder using the PDF/X-4 preset

 

 

var f = Folder.selectDialog("Select a folder for the PDF pages"); 
var doc = app.documents.item(0);
var n = doc.name.replace(/\.[^\.]+$/, '')
var thePath = f + "/" +  n + ".pdf";
var preset=app.pdfExportPresets.itemByName("[PDF/X-4:2008]");


//the exportAsSinglePages property set to true exports single pages. The singlePagesSuffix set to _the page number
app.pdfExportPreferences.properties = {pageRange:"2,4", exportAsSinglePages:true, singlePagesPDFSuffix:"_^P"}
doc.exportFile(ExportFormat.pdfType, File(thePath));

 

 

Likes

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 ,
Mar 18, 2022 Mar 18, 2022

Copy link to clipboard

Copied

LATEST

Hi @rob day, Thank you so much.

That works perfectly.🤟🏼🤩 

Likes

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