Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crop Stamps.com PDF label

I'm working on converting from Endicia to Stamps.com for my 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.

like image 950
Conor Avatar asked Apr 04 '11 15:04

Conor


People also ask

Can you use a label printer with stamps com?

With an online postage service like Stamps.com, you can easily print all USPS shipping labels from the comfort of your home. Stamps.com provides access to all USPS mail classes including First Class Package Service, Parcel Select and Priority Mail.


2 Answers

you could try pdfbox: http://pdfbox.apache.org/ library has nice functions for media/crop box extraction, creating new pdfs and printing.

like image 115
matija kancijan Avatar answered Sep 23 '22 15:09

matija kancijan


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. :-)

like image 45
Vladimir Avatar answered Sep 24 '22 15:09

Vladimir