Using the BarCode2D class to draw PDF417 barcode

using System;
using System.IO;
using System.Text;

using PDFjet.NET;

/**
 *  Example_12.cs
 *
 */
public class Example_12 {
    public static void Main(String[] args) {
        PDF pdf = new PDF();
        Font f1 = new Font(pdf, "Helvetica");

        Page page = new Page(pdf, Letter.PORTRAIT);

        StringBuilder buf = new StringBuilder();
        StreamReader reader =
                new StreamReader("Example_12.cs");
        String line = null;
        while ((line = reader.ReadLine()) != null) {
            buf.Append(line);
            // Both CR and LF are required by the scanner!
            buf.Append((char) 13);
            buf.Append((char) 10);
        }
        reader.Close();

        BarCode2D code2D = new BarCode2D(buf.ToString());
        code2D.SetPosition(100, 60);
        code2D.DrawOn(page);

        TextLine text = new TextLine(f1,
                "PDF417 barcode containing the program that created it.");
        text.SetPosition(100, 40);
        text.DrawOn(page);

        pdf.Wrap();
        pdf.Save("Example_12.pdf");
    }

}   // End of Example_12.cs
Example_12.pdf

© 2007 Innovatics Inc.