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.
- Create a new QR Code barcode object, and set the QR Code data text.
- Customize QR Code barcode dpi, width, height options
- Create a new PPTXDocument object from an existing PowerPoint (.pptx) file
- Get a PPTXPage object from the first slide of the PowerPoint document
- Generate and insert QR Code on the PPTXPage object on the specified region
- 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);