Crop Stamps.com PDF label
I'm working on converting from Endicia to Stamps.com for m开发者_运维技巧y ecommerce store. For first-class international labels, Stamps.com currently forces the label to be in PDF format in a standard 8x11 size document. This prevents the label from being printed directly to a Zebra printer (as we currently do).
What I'm looking to do is take the existing pdf that is returned, crop the size to the 4"x6" area that contains the actual label and save/print. Ideally this will be done either in PHP or cli via system call from PHP.
Any libraries, functions, or other suggestions will be appreciated.
you could try pdfbox: http://pdfbox.apache.org/ library has nice functions for media/crop box extraction, creating new pdfs and printing.
In the last API release Stamps.com address this particular problem to be able to return 4"x6" PNG label not the 4x6 label inside 8x11 page.
Checkout latest API release (v24) printLayout property with Normal6x4CN2 option or similar.
This should work. But I can't still bring it to work correctly myself. :-)
From a purely PDF standpoint, this is fairly simple. You just change the "media box" and/or "crop box" of the page in question.
From my (limited) experience, PHP PDF libraries tend to center on generating PDFs rather than manipulating existing one.
You may try striPDF. It automatically removes white margins from PDF files.
Stamps.com will not let you print a 4x6 label as pdf, it will only print it to a zebra printer. The only way I was able to do this was print as 4x6 inside 8x11 page and then cropping the picture in adobe acrobat pro. The actual label is 4x6 so it will crop perfectly.
精彩评论