Copy link to clipboard
Copied
Hello Forum!
I am getting the below Error message when trying to open pdfs output to specific folders within a project on a network file server created by two specific scripts.
I can use other scripts like the page Exporter Utility or a direct export out of InDesign on the same server/project folder structure without any issue.
Could there possibly be something with the scripts causing this?
Thanks in advance for any help!
The two scripts that are giving me the issue;
var doc = app.activeDocument;
for(var p = 0; p < app.documents[0].pages.length; p=p+2) {
var frames = app.documents[0].pages
.textFrames;
var pdf_name = null;
for(var i = 0; i < frames.length; i++) {
if(frames.paragraphs[0].appliedParagraphStyle.name == 'UAVC-IHD') {
pdf_name = frames.paragraphs[0].contents;
break;
}
}
if(pdf_name != null) {
app.pdfExportPreferences.pageRange =
"+"+( doc.pages
.documentOffset+1 ) + "," +
"+"+( doc.pages[p+1].documentOffset+1 );
var export_preset1 = app.pdfExportPresets.item("[High Quality Print]");
var export_preset2 = app.pdfExportPresets.item("[Smallest File Size]");
var myFolder = app.activeDocument.filePath.parent;
var myDoc = app.activeDocument;
}
myDoc.exportFile(ExportFormat.PDF_TYPE, File(myFolder+'/Final_Deliverables/Publish/' + pdf_name + "HR.pdf"), false, export_preset1);
myDoc.exportFile(ExportFormat.PDF_TYPE, File(myFolder+'/Final_Deliverables/Proofs/' + pdf_name + "-00.pdf"), false, export_preset2);
}
alert("Done Exporting Pdf's!");
And..............
var myDoc = app.activeDocument,
p, i, frames, pdf_name,
myFolder = myDoc.filePath.parent;
for(p = 1; p < myDoc.pages.length; p=p+2) {
frames = myDoc.pages
.textFrames;
pdf_name = null;
for(i = 0; i < frames.length; i++) {
if(frames.paragraphs[0].appliedParagraphStyle.name == 'UAVC-IHD') {
pdf_name = frames.paragraphs[0].contents;
break;
}
}
if(!pdf_name) continue;
app.pdfExportPreferences.pageRange = myDoc.pages[p-1].name + "-" + myDoc.pages
.name;
var export_preset1 = app.pdfExportPresets.item("[High Quality Print]");
var export_preset2 = app.pdfExportPresets.item("[Smallest File Size]");
myDoc.exportFile(ExportFormat.PDF_TYPE, File(myFolder+'/Final_Deliverables/Publish/' + pdf_name + "HR.pdf"), false, export_preset1);
myDoc.exportFile(ExportFormat.PDF_TYPE, File(myFolder+'/Final_Deliverables/Proofs/' + pdf_name + "-00.pdf"), false, export_preset2);
}
alert("Done Exporting Pdf's!");
Here's a script that is used without issue.
d = app.activeDocument;
preset1 = app.pdfExportPresets.itemByName("[High Quality Print]");
preset2 = app.pdfExportPresets.itemByName("[Smallest File Size]");
if (!(preset1.isValid && preset2.isValid)){
alert("One of the Export Options does not exist.");
exit();
}
mDocName = d.name.substr (0, d.name.lastIndexOf(‘.’));
mSourcePath = d.fullName.parent.toString();
mRootPath =mSourcePath.substr (0, mSourcePath.lastIndexOf(‘/’));
mTargetPath=mRootPath.concat(‘/final/’);
mTargetPath1=mRootPath.concat('/Final_Deliverables/Publish/');
mTargetPath2=mRootPath.concat('/Final_Deliverables/Proofs/');
mNameHR = mTargetPath1.concat(mDocName,'HR.pdf');
mName00= mTargetPath2.concat(mDocName,'-00.pdf');
if (!d.saved){
d.save;
}
d.exportFile(ExportFormat.PDF_TYPE, new File(mNameHR), false, preset1);
d.exportFile(ExportFormat.PDF_TYPE, new File(mName00), false, preset2)
alert("Done Exporting Pdf's!");
This issue was resolved awhile ago, just forgot to post a explanation.
The paragraph style "UAVC-IHD" used to name the pdfs through the scripts was also used to create top level bookmarks in the document. The bookmarks were adding a hidden characters anchor points in front of the name. When the pdfs were exported using the scripts they too had the hidden characters anchor points and that's what was preventing the files from being opened on a network sever and causing the error.
Copy link to clipboard
Copied
This issue was resolved awhile ago, just forgot to post a explanation.
The paragraph style "UAVC-IHD" used to name the pdfs through the scripts was also used to create top level bookmarks in the document. The bookmarks were adding a hidden characters anchor points in front of the name. When the pdfs were exported using the scripts they too had the hidden characters anchor points and that's what was preventing the files from being opened on a network sever and causing the error.