I used pdftk
to uncompress a PDF and then opened it as a text file.
I want to edit the /MediaBox field, which is in my case
/MediaBox [0 0 612 792]
I would like to reduce the margins, for instance
/MediaBox [100 0 512 792]
Unfortunately it doesn't work. I can change the 0
into a 2
or a 9
but I cannot put 100
for instance.
Any idea why?
use sed to replace any occurrence
sed 's/MediaBox \[0 0 612 792*/MediaBox \[100 0 512 792]/g'<in.pdf >out.pdf
or podofobox (inside podofo utils)
without needing to uncompress pdf streams first (as needed with pdftk)
podofobox in.pdf out.pdf media 10000 0 51200 79200
as you can see, podofobox uses MediaBox values multiplied by 100, since its scale is a sub multiple, so, you need simply to add two zeroes (00) to values you can read in MediaBox field