Barcode aus PDF lesen – Tutorial für C# und VB.NET

  • Home
  • /
  • Articles
  • /
  • Barcode aus PDF lesen – Tutorial für C# und VB.NET

Barcode aus PDF lesen mit Bytescout Barcode Reader SDK. Verwenden Sie folgenden C# und VB.NET Quellcodes um Barcodes aus PDF-Dateien zu lesen.

C#

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

using Bytescout.BarCodeReader;

namespace SimpleTestSharp
{
   class Program
   {
       const string path = "Photo.jpg";

       static void Main(string[] args)
       {
           Console.WriteLine("Reading barcode(s) from image {0}", Path.GetFullPath(path));

           Reader bc = new Reader();

           FoundBarcode[] barcodes = bc.ReadFrom(path);

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

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

Visual Basic .NET

Imports System.IO

Imports Bytescout.BarCodeReader

Module Module1

   Sub Main()
       Dim pat As String = "Photo.jpg"
       Console.WriteLine("Reading barcode(s) from image {0}", Path.GetFullPath(pat))

       Dim bc As New Reader()

       bc.TypeToFind = SymbologyFilter.FindAll

       Dim barcodes As FoundBarcode() = bc.ReadFrom(pat)

       Dim i As Integer
       For i = 0 To barcodes.Length - 1
           Console.WriteLine("Found barcode with type '{0}' and value '{1}'", barcodes(i).Type, barcodes(i).Value)
       Next

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

End Module
prev
next