1 Reply Latest reply on Nov 11, 2011 11:01 AM by Thom Parker

    How to create a new PDF consisting only of the cropped area?

    Larry Tseng Level 1

      Hi,

       

      Is there a way to crop a PDF via javascript in such a way that the new MediaBox contains only the cropped material, where the lower left corner is also located at 0,0? setPageBoxes("Media",...) to match the CropBox doesn’t seem to do it.

      What I need is a scripted method to get around a problem with Acrobat X’s pixel-based compare documents function.  If I crop to trim in both documents for example, it seems to be able to pick out the areas to compare alright, but the annotations that mark any differences are located incorrectly—as if the comparison is performed under one coordinate system and the annotation is handled via another.

      There are ways around this outside of scripting. For example, pdfToolBox5 has a “Set MediaBox to origin” fixup that seems to do the trick, but I’m looking for a scripted method. So far, the only way that I’ve been able to get around the misplaced annotations problem is to export a postscript file after cropping, distill that, and then compare.

       

      Thanks for any help on this.

       

      Larry