This sample demonstrates how to read barcode from PDF using BarCode Reader SDK in Visual C# and Visual Basic .NET and ASP.NET

You can find the full source code of this sample in ExamplesAdvanced ExamplesAdvancedBarcodes From PDF folder of Bytescout BarCode Reader SDK installation.

Visual Basic .NET (VB.NET)

Imports System.Drawing
Imports Bytescout.BarCodeReader

Class Program
	Friend Shared Sub Main(args As String())
        Dim barcodeReader As New Reader()
		Dim imgNum As Integer = 1

        Console.WriteLine("Reading barcode(s) from image #{0}", imgNum)

        Dim barcodes As FoundBarcode() = barcodeReader.ReadFrom("example.pdf")

        For Each barcode As FoundBarcode In barcodes
            Console.WriteLine("   Found barcode with type '{0}' and value '{1}'", barcode.Type, barcode.Value)
        Next

        Console.WriteLine()
        Console.WriteLine("Press any key to continue.")
        Console.ReadKey()
	End Sub
End Class

Visual C# .NET (C# .NET)

using System;
using System.Drawing;
using Bytescout.BarCodeReader;

namespace BarcodesFromPDF
{
	class Program
	{
		static void Main(string[] args)
		{
			Reader barcodeReader = new Reader();
			int imgNum = 1;

					Console.WriteLine("Reading barcode(s) from PDF");

					FoundBarcode[] barcodes = barcodeReader.ReadFrom("example.pdf");

					foreach (FoundBarcode barcode in barcodes)
						Console.WriteLine("   Found barcode with type '{0}' and value '{1}'", barcode.Type, barcode.Value);

			Console.WriteLine();
			Console.WriteLine("Press any key to continue.");
			Console.ReadKey();
		}
	}
}