For Using BC.NetPdfBarcodeReader.All
Read and recognize 2d & 1d barcodes from PDF document page(s) at fast speed.
It's easy to use BC.NetPdfBarcodeReader.All library to scan and read barcodes from PDF in your .NET/C#/VB.NET projects. Linear and 2D barcodes, like QR Code, Data Matrix, PDF417, Code 128, Code 39, EAN-13, EAN-8, UPC-A, UPC-E, and Interleaved 2 of 5, can be read from PDF file. Here we will show you how to read barcode from PDF in C# & VB.NET within simple steps. Please firstly download and get the free trial library (BC.NetPdfBarcodeReaderTrial.All.dll). And the only thing for the integration of our library is to add your project reference to it.
We take the Console Application as an example of how to use BC.NetPdfBarcodeReader.All library to scan and read 1D & 2D barcodes from PDF document page(s). For ease of use, here are simple code examples for C# and VB.NET developers (see as follows). Moreover, a demo project is included in our free trial package. You can download a free trial to see more.
PLEASE NOTE: You need to copy BC.Resources.dll from x86 or x64 folder of the trial package to your C# project bin directory, Bin\Debug. For VB.NET project, you also need to do this but should copy the dll to your project folder Bin\x86\Debug or Bin\x64\Debug. Moreover, the first character of barcode will be recognized as "BC.Trial" for trial package.
This section includes several pieces of using BC.NetPdfBarcodeReader.All library to read barcodes from PDF in C# and VB.NET programming, which includes, 1. Scan and read one type barcode(s) from one PDF page 2. Scan and read one type barcode(s) from multiple PDF pages 3. Scan and read multiple types of barcodes from one PDF page 4. Scan and read multiple types of barcodes from multiple PDF pages
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using BC.NetPdfBarcodeReaderTrial.All;
using BC.NetPdfBarcodeReaderTrial.Pdf;
namespace BCNetPdfBarcodeReader
{
class Program
{
static void Main(string[] args)
{
ReadOneBarcodeTypeFromOnePdfPage();
//ReadMultipleBarcodeTypesFromOnePdfPage();
//ReadOneBarcodeTypeFromMultiplePdfPages();
//ReadMultipleBarcodeTypesFromMultiplePdfPages();
}
public static void ReadOneBarcodeTypeFromOnePdfPage()
{
PdfDoc pdf = new PdfDoc("test.pdf");
pdf.SetDPI = 72;
Image pageImage = pdf.ConvertToImage(0, 1000, 1000);
Bitmap bitmap = new Bitmap(pageImage);
string[] data = NetPdfBarcodeReader.Recognize(bitmap, NetPdfBarcodeReader.Code128);
foreach (string result in data)
{
Console.WriteLine(result);
}
Console.ReadKey();
}
public static void ReadMultipleBarcodeTypesFromOnePdfPage()
{
PdfDoc pdf = new PdfDoc("test1.pdf");
pdf.SetDPI =72;
Image pageImage = pdf.ConvertToImage(0, 2500, 1000);
Bitmap bitmap = new Bitmap(pageImage);
string[] data = NetPdfBarcodeReader.Recognize(bitmap, NetPdfBarcodeReader.Code128);
foreach (string result in data)
{
Console.WriteLine(result);
}
string[] data1 = NetPdfBarcodeReader.Recognize(bitmap, NetPdfBarcodeReader.Qrcode);
foreach (string result in data1)
{
Console.WriteLine(result);
}
Console.ReadKey();
}
public static void ReadOneBarcodeTypeFromMultiplePdfPages()
{
PdfDoc pdf = new PdfDoc("test2.pdf");
pdf.SetDPI = 72;
for (int i = 0; i < pdf.FilePageCount; i++)
{
Image pageImage = pdf.ConvertToImage(i, 1200, 1200);
Bitmap bitmap = new Bitmap(pageImage);
//pageImage.Save("Page" + i + ".jpg", ImageFormat.Jpeg);
string[] data = NetPdfBarcodeReader.Recognize(bitmap, NetPdfBarcodeReader.Code128);
foreach (string result in data)
{
Console.WriteLine(result);
}
}
Console.ReadKey();
}
public static void ReadMultipleBarcodeTypesFromMultiplePdfPages()
{
PdfDoc pdf = new PdfDoc("test3.pdf");
pdf.SetDPI = 72;
for (int i = 0; i < pdf.FilePageCount; i++)
{
Image pageImage = pdf.ConvertToImage(i, 1000, 1200);
Bitmap bitmap = new Bitmap(pageImage);
pageImage.Save("Page" + i + ".jpg", ImageFormat.Jpeg);
string[] data = NetPdfBarcodeReader.Recognize("Page" + i + ".jpg", NetPdfBarcodeReader.Code128);
foreach (string result in data)
{
Console.WriteLine(result);
}
string[] data1 = NetPdfBarcodeReader.Recognize("Page" + i + ".jpg", NetPdfBarcodeReader.Qrcode);
foreach (string result in data1)
{
Console.WriteLine(result);
}
}
Console.ReadKey();
}
}
}
Imports System
Imports System.IO
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Drawing
Imports System.Drawing.Imaging
Imports BC.NetPdfBarcodeReaderTrial.All
Imports BC.NetPdfBarcodeReaderTrial.Pdf
Module BCNetPdfBarcodeReader
Public Sub Main()
ReadOneBarcodeTypeFromOnePdfPage()
'ReadMultipleBarcodeTypesFromOnePdfPage()
'ReadOneBarcodeTypeFromMultiplePdfPages()
'ReadMultipleBarcodeTypesFromMultiplePdfPages()
Public Sub ReadOneBarcodeTypeFromOnePdfPage()
Dim pdf As PdfDoc = New PdfDoc("test.pdf")
pdf.SetDPI = 72
Dim pageImage As Image = pdf.ConvertToImage(0, 1000, 1000)
Dim bitmap As Bitmap = New Bitmap(pageImage)
Dim data As String() = NetPdfBarcodeReader.Recognize(bitmap, NetPdfBarcodeReader.Code128)
For Each result As String In data
Console.WriteLine(result)
Next
Console.ReadKey()
End Sub
End Sub
Public Sub ReadMultipleBarcodeTypesFromOnePdfPage()
Dim pdf As PdfDoc = New PdfDoc("test1.pdf")
pdf.SetDPI = 72
Dim pageImage As Image = pdf.ConvertToImage(0, 2500, 1000)
Dim bitmap As Bitmap = New Bitmap(pageImage)
Dim data As String() = NetPdfBarcodeReader.Recognize(bitmap, NetPdfBarcodeReader.Code128)
For Each result As String In data
Console.WriteLine(result)
Next
Dim data1 As String() = NetPdfBarcodeReader.Recognize(bitmap, NetPdfBarcodeReader.Qrcode)
For Each result As String In data1
Console.WriteLine(result)
Next
Console.ReadKey()
End Sub
Public Sub ReadOneBarcodeTypeFromMultiplePdfPages()
Dim pdf As PdfDoc = New PdfDoc("test2.pdf")
pdf.SetDPI = 72
For i As Integer = 0 To pdf.FilePageCount - 1
Dim pageImage As Image = pdf.ConvertToImage(i, 1200, 1200)
Dim bitmap As Bitmap = New Bitmap(pageImage)
Dim data As String() = NetPdfBarcodeReader.Recognize(bitmap, NetPdfBarcodeReader.Code128)
For Each result As String In data
Console.WriteLine(result)
Next
Next
Console.ReadKey()
End Sub
Public Sub ReadMultipleBarcodeTypesFromMultiplePdfPages()
Dim pdf As PdfDoc = New PdfDoc("test3.pdf")
pdf.SetDPI = 72
For i As Integer = 0 To pdf.FilePageCount - 1
Dim pageImage As Image = pdf.ConvertToImage(i, 1000, 1200)
Dim bitmap As Bitmap = New Bitmap(pageImage)
pageImage.Save("Page" & i & ".jpg", ImageFormat.Jpeg)
Dim data As String() = NetPdfBarcodeReader.Recognize("Page" & i & ".jpg", NetPdfBarcodeReader.Code128)
For Each result As String In data
Console.WriteLine(result)
Next
Dim data1 As String() = NetPdfBarcodeReader.Recognize("Page" & i & ".jpg", NetPdfBarcodeReader.Qrcode)
For Each result As String In data1
Console.WriteLine(result)
Next
Next
Console.ReadKey()
End Sub
End Module
Besides reading barcodes from PDF in C# & VB.NET applications, we also provide .NET barcode reading solution and .NET Core barcode reading solution for various image formats. Interested? You may click to see the relatively online tutorials: BC.NetBarcodeReader.All online tutorial and BC.NetCoreBarcodeReader.All online tutorial.
What search words did you use for finding BC.NetPdfBarcodeReader.All? Our .NET pdf barcode reader can be found by words like read barcode from pdf c#, c# read barcode from pdf file, read barcode from pdf vb.net, vb.net read barcode from pdf file, read barcodes from pdf .net, .net read barcodes from pdf, read barcode from pdf asp.net, asp.net read barcode from pdf, read barcode from pdf c# web application, c# read barcode from pdf in web application, read barcode from pdf c# windows application, c# read barcode from pdf in windows application, read barcode from pdf free code example, read barcode from pdf free api, read barcode from pdf free sdk, how to read barcode from pdf file vb.net, how to scan barcode from pdf file asp.net application, how to recognize barcode from pdf file c#, how to decode barcode from pdf file .net windows application, etc.