C# Barcode Generator Library
How to generate barcode to Microsoft PowerPoint (.pptx) file?


How to create, add barcode to Microsoft PowerPoint (.pptx) document in C# ASP.NET Core, MVC, WinForms, WPF apps?









How to create barcode in PowerPoint document using C#?


The C# sample code below explains how to create, add QR Code barcode image to an existing Microsoft PowerPoint (.pptx) file using C#.NET.

  1. Create a new QR Code barcode object, and set the QR Code data text.
  2. Customize QR Code barcode dpi, width, height options
  3. Create a new PPTXDocument object from an existing PowerPoint (.pptx) file
  4. Get a PPTXPage object from the first slide of the PowerPoint document
  5. Generate and insert QR Code on the PPTXPage object on the specified region
  6. Save the PPTX file



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

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

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

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

            doc.Save(outputFilePath);