using System;
using System.IO;
using System.Text;
using PDFjet.NET;
/**
* Example_12.cs
*
*/
public class Example_12 {
public static void Main(String[] args) {
FileStream fos = new FileStream("Example_12.pdf", FileMode.Create);
BufferedStream bos = new BufferedStream(fos);
PDF pdf = new PDF(bos);
// Before you enable this flag please read PDFJET.ZLIB.TXT
// in the "optional" directory.
// pdf.setCompressor(Compressor.ORIGINAL_ZLIB);
Font f1 = new Font(pdf, "Helvetica");
Page page = new Page(pdf, Letter.PORTRAIT);
StringBuilder buf = new StringBuilder();
StreamReader reader = new StreamReader(
new FileStream("Example_12.cs", FileMode.Open));
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.Flush();
bos.Close();
}
} // End of Example_12.cs
© 2011 Innovatics Inc.
