Question

I would like to be able to add barcodes to generated postscript files. The postscript files are generated by another program and I am unable to change how that program works.

I've found several threads that suggest this might be done this by converting the Postscript files to PDF (Gluing (Imposition) PDF documents; Create two pdfs from one .ps file?; Overlay one pdf or ps file on top of another).

I'd like to know if there is a way to do this without the PDF conversion (to keep things simple, to keep things fast, and to avoid loss of quality). If it turns out that PDF conversion is the only reasonable solution, is there any loss of quality going from Postscript to PDF?

Was it helpful?

Solution

If the generated Postscript is sufficiently nice, you could write something to dig through it, find the showpage command, and just insert some additional drawing commands before it. After all, you don't need to handle the general case, just output from this one program, which should always spit Postscript out the same way.

More generally, you could convert the PS to EPS programmatically, and then embed it into another Postscript file that will draw it, and then the barcode. (Now that I mention this one, it might actually be easier.)

The Postscript Language Reference Manual would come in handy for both of those tasks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top