0

I have a PDF document that can be any size and I would like to burn in or insert a trim box into that PDF using PHP. Possibly with Imagemagick but do not know the command to run (not sure if one even exists)

I did a lot of searching and havent found anything that answers my question so I am hoping someone may know. I would provide code but I do not even know what commands to use to provide any code of what I have tried. Any help please?

Yeak
  • 2,470
  • 9
  • 45
  • 71

2 Answers2

0

You need to use a framework that allows you to alter an existant pdf. Zend-pdf is a framework like that. http://framework.zend.com/manual/1.12/en/zend.pdf.html

chris-l
  • 2,802
  • 1
  • 18
  • 18
  • So, you only want to resize the pdfs to a fixed size, having the end result like **an image**? It would be an image (or maybe a serie of images), not a pdf anymore. You are ok with that? – chris-l Aug 13 '13 at 19:31
0

After going through lots of cropping tools using command line, nothing was working perfectly as I expected. I tried Ghostscript and Imagemagick, they have the script but it doesn't work as I want, so my favorite tool now for this and it works perfectly it called Briss and its a free tool that you can find here as an example for the command, you will need to call this command using PHP :

 java -jar briss-0.9.jar -s original.pdf -d cropped.pdf -c 0.11/0.08/0.11/0.08:0.11/0.08/0.11/0.08

And this is an explanation for each value from the left in inch

 First  param : Upper  space for even 
 Second param : Right  space for even 
 Third  param : bottom space for even 
 Forth  param : left   space for even

 Sixth   param : Upper  space for odd 
 Seventh param : Right  space for odd 
 Eighth  param : bottom space for odd 
 Ninth   param : left   space for odd

Hope it helps

Moak
  • 12,596
  • 27
  • 111
  • 166
mmoghrabi
  • 1,233
  • 1
  • 14
  • 23