//////////////////////////////////////////////////////////////////// // Draw Barcode //////////////////////////////////////////////////////////////////// private void DrawBarcode() { // save graphics state Contents.SaveGraphicsState(); BarcodeEAN13 Barcode1 = new BarcodeEAN13("1234567890128"); Contents.DrawBarcode(1.3, 7.05, 0.012, 0.75, Barcode1, ArialNormal, 8.0); PdfQRCode QRCode = new PdfQRCode(Document, "http://www.codeproject.com/Articles/570682/PDF-File-Writer-Csharp-Class-Library-Version", ErrorCorrection.M); Contents.DrawQRCode(QRCode, 6.0, 6.8, 1.2); // define a web link area coinsiding with the qr code Page.AddWebLink(6.0, 6.8, 7.2, 8.0, "http://www.codeproject.com/Articles/570682/PDF-File-Writer-Csharp-Class-Library-Version"); // restore graphics sate Contents.RestoreGraphicsState(); return; }
//////////////////////////////////////////////////////////////////// // Draw Barcode //////////////////////////////////////////////////////////////////// private void DrawBarcode() { // save graphics state Contents.SaveGraphicsState(); // draw EAN13 barcode BarcodeEAN13 Barcode1 = new BarcodeEAN13("1234567890128"); Contents.DrawBarcode(1.3, 7.05, 0.012, 0.75, Barcode1, ArialNormal, 8.0); // create QRCode barcode QREncoder QREncoder = new QREncoder(); // set error correction code QREncoder.ErrorCorrection = ErrorCorrection.M; // set module size in pixels QREncoder.ModuleSize = 1; // set quiet zone in pixels QREncoder.QuietZone = 4; // encode your text or byte array QREncoder.Encode(ArticleLink); // convert QRCode to black and white image PdfImage BarcodeImage = new PdfImage(Document); BarcodeImage.LoadImage(QREncoder); // draw image (height is the same as width for QRCode) Contents.DrawImage(BarcodeImage, 6.0, 6.8, 1.2); // define a web link area coinsiding with the qr code Page.AddWebLink(6.0, 6.8, 7.2, 8.0, ArticleLink); // restore graphics sate Contents.RestoreGraphicsState(); return; }