C# Barcode Generator Library
How to create, insert barcode to existing PDF?


How to create, add QR Code and barcode image to existing PDF document in C# ASP.NET Core, MVC, WinForms, WPF apps?









How to create, insert QR Code barcode in existing PDF file using C#?


The following content and C# sample source code to show how to create, insert QR Code barcode image to an existing PDF file using C#.NET.

  1. Create a new QRCode object, with data to encode.
  2. Customize and apply QR Code barcode dimension size options
  3. Create a new PDFDocument from an existing PDF file
  4. Get a new PDFPage object from the first page of the PDF document
  5. Generate and print QR Code on the PDFPage object on the specified location
  6. Save the PDF file



            QRCode barcode = new QRCode();
            barcode.Data = "https://www.rasteredge.com";

            barcode.AutoResize = true;
            barcode.Resolution = 1200;
            barcode.UOM = UnitOfMeasure.INCH;
            barcode.BarcodeWidth = 1.5f;
            barcode.BarcodeHeight = 1.5f;

            String inputFilePath = @"C:\Input\RasterEdge.com\test-document.pdf";
            String outputFilePath = @"C:\Output\RasterEdge.com\barcode-qrcode-pdf.pdf";

            PDFDocument doc = new PDFDocument(inputFilePath);
            //  Draw the barcode at position (100, 200) in pixels on the 1st page.
            PDFPage page = (PDFPage)doc.GetPage(0);
            barcode.DrawBarcode(page, 120, 200);

            doc.Save(outputFilePath);


Run the C# code, you will get the following PDF file with QR Code inserted.







How to create, add barcode vector image (EPS) to existing PDF file using C#?


Coming soon.

XImage.Barcode Generator supports generating barcode images in EPS format. We are working on inserting EPS file to PDF pages.