Monday, March 18, 2013

Cropping Margins Existing Template PDF with PDFTK

The key of the re-centering or re-margining is the /Mediabox reference... we have to pan the original template in PDF... ON THE UNCOMPRESSED PDF... The media box [0,0,612,792]
  • Move the box up: [0 -70 612 722]
  • Move the box down: [0 70 612 862]
  • Move the box left: [70 0 682 792]
  • Move the box right: [-70 0 542 792]
 1273  pdftk S89E.pdf output S89E.unc.pdf uncompress
 1274  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[-70 0 542 812\]/g'< S89E.unc.pdf > S89.resized.pdf
Examples
 1301  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[0 70 612 862\]/g'< S89E.unc.pdf > S89.resized.pdf
 1304  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[0 -70 612 722\]/g'< S89E.unc.pdf > S89.resized.pdf
 1305  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[70 0 682 792\]/g'< S89E.unc.pdf > S89.resized.pdf
 1306  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[-70 0 542 792\]/g'< S89E.unc.pdf > S89.resized.pdf

No comments:

Post a Comment