Putting barcode and text on preprinted labels

Whereas the normal mode is to create a single page output per row of data from the data source, label processing is a special operating mode that enables the printing of multiple label instances on a single page.  The labels are usually printed on corresponding label stock.  

Add barcode or text to filled-out label

Start with label outputs that were already personalized by applications such as Avery Designer, or Microsoft Word MailMerge.   The label instances should be in a PDF document, which will be searched for anchor test.  PDFImprint will replace or augment the printed data with barcodes and/or text.

 

The following example defines a label input with pre-populated data (created and personalized by some other program) then it finds the anchor pattern Name:, and ID:, and places a barcode below the ID text field (default positioning) with the concatenated value of “ID|Name”.

output output.pdf

  input "Label5095_Filled.pdf", label = filled

    anchor pattern="Name:${}"

    anchor pattern="ID:${}"

    barcode target=ID:bl:tl, value="${anchor}|${Name}"

Add barcode or text to blank label

In this example, each label is pre-printed with only the fixed text of the anchor pattern.  No personalized data appears on the label; instead it will be obtained from the Data Source.  In effect PDFImprint will perform the MailMerge function.

 

The following example assumes that the data source specified on the command line creates at least two data source variables: ID and Name.  The input file, Label5095_Blank.pdf, contains multiple labels each having the anchor placement text Name: and ID:

output output.pdf

  input "Label5095_Blank.pdf", label = blank

    anchor pattern="Name:", name=aName

    anchor pattern="ID:", name= aID

    # Add text value after the anchors: Name and ID

    replace  target=aID, to="ID: ${ID}"

    replace target=aName, to="Name: ${Name}"

    # Also add a barcode with value of ID|Name under the ID text

    barcode target=aID:bl:tl, value="${ID}|${Name}"