Scriptor
Scriptor

Reputation: 1125

Add a prefix in postscript to a barcode / variable

I already have a postscript document made by someone else. This want i want to edit so it change the printed barcode with a prefix and astrix arround it.

Original Code

/Code39 findfont 13 mm scalefont setfont
  10  mm  246 mm moveto   DocumentNo      show
  10  mm  217 mm moveto   PartnoBarcode        show 
  10  mm  189 mm moveto   MUActaulQty       show
  10  mm  168 mm moveto   SupplierNo      show
  10  mm  148 mm moveto   MaterialUnitNo  show

Now i want this last barcode to include a prefix (letters S) and astrix arround the variable. How to do this?

Something like this:

/Code39 findfont 13 mm scalefont setfont
  10  mm  246 mm moveto   DocumentNo      show
  10  mm  217 mm moveto   PartnoBarcode        show 
  10  mm  189 mm moveto   MUActaulQty       show
  10  mm  168 mm moveto   SupplierNo      show
  10  mm  148 mm moveto   (*S) + MaterialUnitNo + (*)  show

Upvotes: 0

Views: 151

Answers (1)

KenS
KenS

Reputation: 31159

You can't use '+', this is PostScript not some other programming language and concatenating strings isn't trivial in this language. Its also rarely required.

The real answer here is that you need to have some comprehension of the programming language, you can't reasonably expect to write or modify programs in a language you don't understand. You should get your employer to pay for some training for you.

In this instance I'll give an answer below, but you really need to develop the appropriate skills if you're going to be asked to do this.

Modified code:

/Code39 findfont 13 mm scalefont setfont
  10  mm  246 mm moveto   DocumentNo      show
  10  mm  217 mm moveto   PartnoBarcode        show 
  10  mm  189 mm moveto   MUActaulQty       show
  10  mm  168 mm moveto   SupplierNo      show
  10  mm  148 mm moveto   (*S) show MaterialUnitNo show (*)  show

Note that I'm assuming here you want the 'prefix' and trailing asterisk also to be part of the barcode, if you don't want that then you'll need to select a different font.

Upvotes: 2

Related Questions