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

Error trying to open pdfs exported by script on a network file server

Advisor ,
Aug 01, 2017 Aug 01, 2017

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!

Screen Shot 2017-08-01 at 3.00.29 PM.png

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!");

TOPICS
Scripting

Views

676

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

Advisor , Dec 19, 2018 Dec 19, 2018

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.

Screen Shot 2018-12-19 at 2.46.55 PM.png

Votes

Translate

Translate
Advisor ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

LATEST

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.

Screen Shot 2018-12-19 at 2.46.55 PM.png

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