Skip to content

Resizing Symbols

Terry Burton edited this page Mar 25, 2014 · 8 revisions

To create a barcode of the required width and height (without stretching the text) perform the following steps, in order.

Starting with this example:

0 0 moveto (977147396801) (includetext)
/ean13 /uk.co.terryburton.bwipp findresource exec

Find the uniform (same x and y) scale factor that makes your output of the required width:

gsave
2 2 scale      %  <-- Add a line like this
0 0 moveto (977147396801) (includetext)
/ean13 /uk.co.terryburton.bwipp findresource exec
grestore

Add a height option that adjusts the bar height appropriately (taking the scaling into account):

gsave
2 2 scale
% Added height=0.8 option to adjust height
0 0 moveto (977147396801) (includetext height=0.8) /ean13 /uk.co.terryburton.bwipp findresource exec
grestore

The result should now be of the intended dimensions with properly scaled (not stretched) text.

Clone this wiki locally