Using Barcode Writer in Pure PostScript requires only some basic PostScript knowledge that is easily learned by experimentation. If you do not want to get your hands messy playing with PostScript then you can use one of the project's frontends which hide many of the details.
The best way to get familiar with using the code is to download the monolithic flavour of the latest release and open the
barcode_with_sample.ps file with a text editor.
This file consists of the following sections:
uk.co.terryburton.bwippcategory of named resources.
% --BEGIN RENDERER ...--and
% --END RENDERER ...--.
% --BEGIN ENCODER ...--and
% --END ENCODER ...--.
% --BEGIN SAMPLE--and
% --END SAMPLE--.
This is one example from the samples:
150 750 moveto (0123456789) (includecheck includetext) /interleaved2of5 /uk.co.terryburton.bwipp findresource exec
The meaning of each component of the invocation is as follows:
150 750 moveto % position of the symbol on the canvas (0123456789) % data field: information to encode in the barcode (includetext height=0.75) % options field: symbol properties /interleaved2of5 % the type of barcode /uk.co.terryburton.bwipp findresource exec % plot symbol on the canvas
The acceptable contents of the data field varies between symbologies as defined in the symbology reference.
The acceptable contents of the options field is for the most part common across all of the symbologies as defined in the options reference, however encoder-specific options do exist in some cases and the default values of permitted options varies across symbologies.
Using the references mentioned above you should now be able to experiment by carefully amending the sample section of the file.
You will want to view the result of your changes regularly (since bugs may be hard to track down once introduced) either by using a software PostScript interpreter alongside a viewer or by sending the file to a PostScript enabled printer. Alternatively you can use the web-based generator to see the effect of the options on the output.
To directly print a file to an installed, PostScript-enabled printer in Windows use the following command:
PRINT [/D:device] barcode_with_sample.ps
Alternatively for a printer attached directly to the first parallel port:
COPY /B barcode_with_sample.ps LPT1:
To directly print a file to a PostScript-enabled printer in Linux use the following command:
lpr -Pdevice -o raw barcode_with_sample.ps
Once you are comfortable with amending the
barcode_with_sample.ps file you may want to simplify the file by removing definitions for barcode formats that you do not require bearing in mind the following points:
% --REQUIRES ...metadata. Examining the contents of the PS files created by the web-based generator at http://www.terryburton.co.uk/barcodewriter/generator/ illustrates this point. If you have downloaded the source distribution of BWIPP you can create a standalone file containing only the resources required for a particular symbology by running something like
barcode.psfile and use the
% --BEGIN/END ENCODER ...--and
% --BEGIN/END RENDERER ...--delimiters to extract the relevant named resource definitions into your documents. This will allow you to simply update your project to the latest version of the BWIPP resource by just replacing your
barcode.pswith the latest version. More information is available in the Developer Notes.