Export independently PDF with script
Hi, I'm trying to export my pages base on a text box of my file: its a document of multiple cerifications so every page has the name of each person that participated. I'm trying to automaticize the process of exportation to have a pdf of every page with the name of the person based on the text box that has it written. I tagged each box with "nombreDestinatario" but it doesn't work. Also, I don't know if the ExportPreset it's ok.
I appreciate if you can help me 🙂
(I don't want to keep writting on each file the corresponded name hahah there are 40 pages)
var myDocument = app.activeDocument;
var myPages = myDocument.pages;
var myPage, myTextFrame, myFileName;
for (var i = 0; i < myPages.length; i++) {
myPage = myPages[i];
myTextFrame = null;
for (var j = 0; j < myPage.textFrames.length; j++) {
if (myPage.textFrames[j].label == "nombreDestinatario") {
myTextFrame = myPage.textFrames[j];
break;
}
}
if (myTextFrame != null) {
myFileName = myTextFrame.contents + ".pdf";
var myFile = new File("/Users/andrea/Desktop/alumnos/" + myFileName);
var myPDFExportPreset = app.pdfExportPresets.item("[PDF/X-3:2002]");
myDocument.exportFile(ExportFormat.pdfType, myFile, false, myPDFExportPreset, myPage);
} else {
alert("No se encontró la caja de texto 'nombreDestinatario' en la página " + (i+1));
}
}
