2 Replies Latest reply on Aug 8, 2011 7:31 AM by AgsmithMS

    [JS IDS CS5] PDFCrop not working for me.

    AgsmithMS

      I have a PDF that I want to place into a new document.  It is getting cropped when I place it.  I changed the app.pdfPlacePreferences.pdfCrop to PDFCrop.CROP_CONTENT_VISIBLE_LAYERS, but it is still getting cropped.

       

       

      var leftSideFile = new File(app.scriptArgs.getValue("LeftSideFilePath"));
      var rightSideFile = new File(app.scriptArgs.getValue("RightSideFilePath"));
      var outputFile = new File(app.scriptArgs.getValue("OutputFilePath"));
      
      var myDocument = app.documents.add();
      
      with (myDocument.documentPreferences) {
          pageHeight = "720pt";
          pageWidth = "1404pt";
          pageOrientation = PageOrientation.LANDSCAPE;
          documentBleedBottomOffset = "9pt";
          documentBleedTopOffset = "9pt";
          documentBleedInsideOrLeftOffset = "9pt";
          documentBleedOutsideOrRightOffset = "9pt";
      }
      
      var viewprefs = myDocument.viewPreferences;
      viewprefs.horizontalMeasurementUnits = MeasurementUnits.POINTS;
      viewprefs.verticalMeasurementUnits = MeasurementUnits.POINTS;
      
      app.pdfPlacePreferences.pdfCrop = PDFCrop.CROP_CONTENT_VISIBLE_LAYERS;
      
      var test = myDocument.pages.item(0).place(leftSideFile, [0, 0])[0];
      
      var outputpath = app.scriptArgs.getValue("OutputFilePath");
      
      if (outputpath.indexOf(".pdf") != -1) {
          var preset = app.pdfExportPresets.item("[Smallest File Size]").duplicate();
          preset.useDocumentBleedWithPDF = true;
          preset.cropMarks = true;
          myDocument.exportFile(
                    ExportFormat.pdfType,
                    File(outputFile),
                    preset
                    );
      }
      
      else if (outputpath.indexOf(".indd") != -1) {
          myDocument.save(outputFile);
      }
      myDocument.close(SaveOptions.no);
      

       

      Here's a screenshot of the PDF I'm placing.  I included crop marks to make the bleed area more visible:

      leftsidePDFTopWithCropMarks.JPG

       

      Here's a screenshot of the output file.  As you can see, the PDF file was cropped when I placed it:

      OutputFileWithCrops.JPG

       

      What am I doing wrong?