Skip to end of metadata
Go to start of metadata

Recognize Barcode from Word Document

In this article, we will recognize the barcode from a Word document using Aspose.BarCode and Aspose.Words. We will follow the below steps for reading barcode from the Word document:

  1. Extract image from Word document using Aspose.Words for .NET.
  2. Save the extracted image as a stream.
  3. Pass the image in the form of the stream to Aspose.BarCode for .NET.
  4. Read the barcode from the image.

Use Aspose.Words.Document class to open the Word document. Call Document.GetChildNodes() method to get a collection of all the shapes (including images) in the Word document. In a for each loop on the collection, check if the shape has an image using Shape.HasImage property and called Shape.ImageData.Save() method and save the image to stream. Initialize Aspose.BarCodeRecognition.BarCodeReader class with the stream and DecodeType and then call BarCodeReader.Read() method to read the barcodes from the stream (image). The sample code snippet is given below:


The evaluation version of Aspose.BarCode for .NET can only recognize Code39 barcodes. If the image contains a barcode of other than Code39 symbology type, a valid license must be set. For getting a temporary license for 30 days, please visit for more details.

  • No labels