Convert PDF to QR Code using C#

This quick tutorial guides on how to convert PDF to QR code using C#. It contains the details to set the IDE for the development and a list of steps for converting PDF to Barcode using C#. You will learn to fetch all the Barcodes and QR codes from a PDF and display the text for each.

Steps for Converting PDF to QR Code using C#

  1. Set the IDE to use Aspose.PDF and Aspose.BarCode for .NET to read QR codes and barcode
  2. Load the source PDF with QR codes and barcode using the Document object
  3. Iterate through all the pages in the PDF and process the image collection on each page
  4. Save each image as JPG into a memory stream
  5. Instantiate the BarCodeReader object, pass the image memory stream and target decode type
  6. Parse the collection of all the barcodes and QR codes in the image
  7. Display the detected code text and type

These steps describe how to transform PDF to QR code using C#. Set the environment to use both Aspose.PDF and Aspose.BarCode, load the source PDF file with QR codes and barcode, iterate through all or selected pages, and fetch the collection of images on each page. Save each image in the memory stream, use it in BarCodeReader for reading QR codes and barcodes from it, and finally display the code text and type.

Code for PDF to QR Code Converter using C#

The above code has demonstrated the process to create QR code from PDF using C#. We parse all the pages in the PDF and use the image collection on each page to detect the QR and barcode from it. A single image may have a single or multiple QR/barcode read by the ReadBarCodes() method, which is iterated one by one, and its text and code are displayed.

This tutorial has guided us to change PDF to QR code. If you want to generate a new QR or barcode, refer to the article on how to generate QR code in C#.

 English