[barcode] rotating a barcode
Alessandro Rubini
rubini@gnu.org
Thu, 14 Nov 2002 09:20:33 +0100
Hi.
> Just check out the site and drop me an email --
> and, yes, I'll happily ship to Italy).
Thanks :)
> At any rate, one small thing I'd like to be able to do is rotate a barcode
> 90 degrees. [...]
Since you include the generated postscript in a bigger document, I think
the best solution is to use postscript's management of device space.
If you want the bottom-left corner of the barcode (i.e., bottom-right
of the drawing as seen on the page) to be at pos XPOS,YPOS, you can
print the barcode at offset 0,0 and the do this stuff:
gsave
XPOS YPOS translate
90 rotate
<postscript generated by GNU barcode>
grestore
This uses the "graphic state" stack, saving and then restoring the
previous transformation matrix and changing the current transformation
before including the barcode. Note that this approach is safe with any
other trasnformation that you may want to apply (like mpage, psnup or
anything else).
> After looking at the postscript output, I tried doing a regular expression
> which swapped the x and y coordinates. So, this:
> [...]
> That seemed like a reasonable approach and the result was a barcode, but
> the bars get munged somehow and are not decodable.
I think the problem here is the one outlined by Christoph Pross.
Please tell me if you have problems with the approach outlined above.
BTW: if you want to see translate and rotate in action in some _simple_
postscript, you might want to look at my business cards, written with vi.
ftp://ar.linux.it/pub/misc/bigghietti.ps.gz
Hope this helps
/alessandro, who knows the best drawing program is metapost, after vi.
--
Alessandro Rubini, free software developer.
Device drivers, embedded systems, courses.
http://ar.linux.it/