I'm printing barcode using the Barcode Writer in Pure PostScript library.
I figured out everything but the result size of the canvas. I'm calling Gostscript with this command
-dSAFER -dBATCH -dNOPAUSE -r350 -sDEVICE=pnggray -dTextAlphaBits=4 -sOutputFile=test.png barcode_with_sample.ps
Inside of the barcode_with_sample.ps I call
20 755 moveto (2001010042569) (includetext) /ean13 /uk.co.terryburton.bwipp findresource exec
showpage
Everything is exactly as I want it but the resulted file is 2975x3850. I need just 600x220 from the top of left corner.
Even generating the output is pretty resource intensive, because it's so huge file.
Any idea how to get only the exact part of the canvas and not the whole page?
Thank you
You can set the page size with -dDEVICEWIDTHPOINTS & -dDEVICEHEIGHTPOINTS (there are 72 points to an inch), but you'll need to change the 20 755 moveto to something like 20 10 moveto. The 755 equals about 10.5 inches, so when you shrink the page 0.629" high (45.26 points/220 pixels) the 755 will be 10" inches off the page. Making the 20 10 moveto to 20 5 moveto will move it down a bit and 20 15 moveto would move it up a bit.
gswin32c -dDEVICEWIDTHPOINTS=123.43 -dDEVICEHEIGHTPOINTS=45.26 -dSAFER -dBATCH -dNOPAUSE -r350 -sDEVICE=pnggray -dTextAlphaBits=4 -sOutputFile=test.png trash.ps