0 Replies Latest reply on Dec 5, 2008 2:10 PM by (Olav_Kvern)

    Error when Placing Blank Page from PDF

    Level 1
      Fellow Scripters,

      I didn't know that InDesign would throw an error when you try to place a blank page from a PDF--but, in some cases, it does. It doesn't do this for all blank pages in PDFs--PDFs with blank pages exported from InDesign, for example, work just fine.

      If you're writing a script that places pages from a PDF, you should be aware of this.

      Note that this affects two of the sample scripts, ImageCatalog and PlaceMultipagePDF.

      If you ever have this problem, you can fix it. In ImageCatalog.jsx, you should search for the line:

      myRectangle.place(File(myFile));
      

      ...and put it inside a try...catch statement:

      try{
      
      myRectangle.place(File(myFile));
      }
      catch (myError){}

      Next, you'll need to look for the lines:

      //File name
      
      case 0:
      myLabel = myLink.name;
      break;
      //File path
      case 1:
      myLabel = myLink.filePath;
      break;

      And change them to this:

      //File name
      
      case 0:
      try{
      myLabel = myLink.name;
      }
      catch (myError){
      myLabel = "No link";
      }
      break;
      //File path
      case 1:
      try{
      myLabel = myLink.filePath;
      }
      catch (myError){
      myLabel = "No link";
      }
      break;

      Fixing the PlaceMultipagePDF.jsx script is a little bit more difficult. I'll try to post a fixed version later.

      Thanks,

      Ole