forked from Uzi-Granot/PdfFileWriter
-
Notifications
You must be signed in to change notification settings - Fork 1
3.8 Draw PDF417 Barcode
OgreTransporter edited this page Mar 2, 2020
·
1 revision
The DrawPdf417Barcode
method is an example of drawing a PDF417 barcode.
// Draw Barcode
private void DrawPdf417Barcode()
{
// save graphics state
Contents.SaveGraphicsState();
// create PDF417 barcode
Pdf417Encoder Pdf417 = new Pdf417Encoder();
Pdf417.DefaultDataColumns = 3;
Pdf417.Encode(ArticleLink);
Pdf417.WidthToHeightRatio(2.5);
// convert Pdf417 to black and white image
PdfImage BarcodeImage = new PdfImage(Document);
BarcodeImage.LoadImage(Pdf417);
// draw image
Contents.DrawImage(BarcodeImage, 1.1, 5.2, 2.5);
// define a web link area coinsiding with the qr code
double Height = 2.5 * Pdf417.ImageHeight / Pdf417.ImageWidth;
Page.AddWebLink(1.1, 5.2, 1.1 + 2.5, 5.2 + Height, ArticleLink);
// restore graphics sate
Contents.RestoreGraphicsState();
return;
}
This page is a copy from https://www.codeproject.com/Articles/570682/PDF-File-Writer-Csharp-Class-Library by Uzi Granot. The article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL). All rights to the texts and source code remain with Uzi Granot.