VintaSoft Barcode .NET SDK를 사용하여 PDF417 바코드를 인식하고 생성합니다.

블로그 카테고리: 바코드.NET

2026/01/30

VintaSoft Barcode .NET SDK는 Windows, Linux, macOS용 전문 크로스 플랫폼 SDK로, .NET, WPF, 웹, MAUI에서 PDF417 바코드를 인식하고 생성할 수 있습니다. .NET 애플리케이션에 PDF417 바코드를 인식하고 생성하는 기능을 추가하는 데 필요한 코드는 단 몇 줄입니다.

PDF417 바코드란 무엇인가요?

PDF417 바코드는 대용량 데이터(최대 1850자 또는 1108바이트)를 저장하는 데 사용되는 고밀도 다층 2D 바코드입니다. 1991년에 개발되었으며 정부 신분증, 탑승권 및 물류 분야에서 널리 사용됩니다. PDF417 바코드는 코드워드당 4바/4스페이스, 17개 요소 패턴을 사용하며, 내장 오류 수정 기능을 지원하고 컴팩트하고 안정적인 데이터 저장을 제공합니다.

다음은 PDF417 바코드 이미지입니다.


PDF417 바코드는 다음과 같은 데이터 저장 모드를 지원합니다.

PDF417 바코드는 리드-솔로몬 오류 수정 알고리즘을 사용하여 손상된 PDF417 바코드도 인식할 수 있습니다.

PDF417 바코드는 다음과 같은 특수 문자를 인코딩할 수 있습니다.

PDF417 바코드 구조

PDF417 바코드는 여러 모듈로 구성되며, 이 모듈은 세 가지 그룹으로 나눌 수 있습니다.



각 모듈은 검은색 실선 열로 시작하고 흰색 실선 열로 끝나 각 모듈의 시작과 끝을 시각적으로 나타냅니다. 바코드 양쪽에는 콰이어트 존(Quiet Zone)이라고 하는 빈 영역이 있습니다.

시작 및 정지 검색 패턴 바코드의 시작과 끝 영역을 나타냅니다. 바코드 스캐너가 바코드를 감지하는 데 도움이 되지만 데이터는 포함하지 않습니다.

좌측 및 우측 표시기는 바코드의 라인 수, 오류 수정 수준 등과 같은 바코드 정보를 포함합니다.

데이터 코드워드 모듈은 바코드 데이터를 포함합니다. PDF417 바코드의 크기는 인코딩된 데이터 양에 따라 달라집니다. 데이터 코드워드 모듈은 1개에서 30개까지의 코드워드와 3개에서 90개까지의 라인을 포함할 수 있습니다. 위 그림에서 데이터 코드워드 모듈은 행당 4개의 코드워드를 포함하며, 이는 보라색으로 표시되어 있습니다. 위 그림에서 데이터 코드워드 모듈은 4개의 행으로 구성됩니다.

코드워드 17개의 셀로 구성되어 있으며, 4개의 검은색 줄무늬와 4개의 흰색 셀로 이루어져 있어 PDF417이라는 이름이 붙었습니다. 각 데이터는 코드워드 왼쪽에서 오른쪽, 위에서 아래로 읽습니다.


PDF417 컴팩트 바코드란 무엇인가요?

PDF417 컴팩트 바코드는 공간을 절약하기 위해 오른쪽 표시기와 정지 검색 패턴을 제거한 PDF417 바코드의 변형입니다.
다음은 PDF417 컴팩트 바코드 이미지입니다.



Micro PDF417 바코드란 무엇인가요?

마이크로 PDF417 바코드는 PDF417 바코드의 소형 버전입니다. 마이크로 PDF417 바코드는 일반적으로 제품 라벨링, 문서 라벨링 및 의료 분야에서 GS1 DataBar와 같은 복합 코드의 일부로 사용됩니다.


Micro PDF417 바코드는 다음과 같은 데이터 저장 모드를 지원합니다.

마이크로 PDF417 바코드는 다음과 같은 특수 문자를 인코딩할 수 있습니다.

AAMVA 바코드란 무엇입니까?

AAMVA(DL/ID 카드 디자인 표준) 바코드 - 운전면허증 정보를 저장하는 PDF417 바코드입니다. VintaSoft Barcode .NET SDK는 AAMVA 형식의 데이터를 인코딩 및 디코딩할 수 있습니다.
AAMVA 바코드 이미지입니다.



XFA 압축 PDF417 바코드란 무엇입니까?

"XFA 압축 PDF417" 바코드는 PDF417 바코드입니다. Adobe XFA 사양에 따라 압축된 데이터를 저장하는 바코드입니다. VintaSoft Barcode .NET SDK는 "XFA Compressed PDF417" 바코드를 생성하고 인식할 수 있습니다.
다음은 "XFA 압축 QR" 바코드 이미지입니다.



특수 문자 "구조 추가"

PDF417 바코드는 특수 문자 "구조 추가"를 지원하여 데이터를 여러 개의 (최대 99,999개) PDF417 바코드로 분할할 수 있습니다. 특수 문자 "구조 추가"는 바코드 내에 인코딩되어 바코드 부분의 개수와 순서를 고유하게 식별할 수 있도록 합니다.

다음은 동일한 텍스트를 더 작은 크기로 표시한 5개의 PDF417 바코드입니다. 이 5개의 PDF417 바코드는 특수 문자 "Structure Append"를 사용하여 단일 값으로 결합됩니다.

다음은 동일한 텍스트를 더 작은 크기로 표시한 5개의 PDF417 바코드입니다. 이 5개의 PDF417 바코드는 특수 문자 "구조 추가"를 사용하여 하나의 값으로 결합됩니다.

VintaSoft Barcode .NET SDK에는 특수 문자 "Structure Append"를 사용하여 분리된 PDF417 바코드 부분에서 데이터를 복구하는 알고리즘이 포함되어 있습니다.


VintaSoft Barcode .NET SDK를 사용하여 어떤 PDF417 바코드를 인식할 수 있습니까?

VintaSoft Barcode .NET SDK는 PDF417, PDF417 Compact, Micro PDF417, AAMVA 및 XFA 압축 PDF417을 포함한 모든 유형의 PDF417 바코드를 인식할 수 있습니다. 고유한 알고리즘을 사용하여 다양한 문제가 있는 이미지에서도 바코드를 빠르게 인식할 수 있습니다. 예를 들어, 다음과 같은 이미지에서 바코드를 인식할 수 있습니다.



카메라로 캡처한 이미지에서 PDF417 바코드를 인식하는 방법을 보여주는 C# 코드입니다.
/// <summary>
/// Reads PDF417 barcodes from a <see cref="System.Drawing.Bitmap"/>.
/// </summary>
/// <param name="bitmap">A bitmap with barcodes.</param>
public static void ReadPdf417BarcodesFromBitmap(System.Drawing.Bitmap bitmap)
{
    // create barcode reader
    using (Vintasoft.Barcode.BarcodeReader reader = new Vintasoft.Barcode.BarcodeReader())
    {
        // specify that reader must search for PDF417 barcodes
        reader.Settings.ScanBarcodeTypes = Vintasoft.Barcode.BarcodeType.PDF417;

        // read barcodes from image
        Vintasoft.Barcode.IBarcodeInfo[] infos = Vintasoft.Barcode.GdiExtensions.ReadBarcodes(reader, bitmap);

        // if barcodes are not detected
        if (infos.Length == 0)
        {
            System.Console.WriteLine("No barcodes found.");
        }
        // if barcodes are detected
        else
        {
            // get information about extracted barcodes

            System.Console.WriteLine(string.Format("{0} barcodes found:", infos.Length));
            System.Console.WriteLine();
            for (int i = 0; i < infos.Length; i++)
            {
                Vintasoft.Barcode.IBarcodeInfo info = infos[i];
                System.Console.WriteLine(string.Format("[{0}:{1}]", i + 1, info.BarcodeType));
                System.Console.WriteLine(string.Format("Value:      {0}", info.Value));
                System.Console.WriteLine(string.Format("Region:     {0}", info.Region));
                System.Console.WriteLine();
            }
        }
    }
}


AAMVA 바코드를 생성하고 인식하는 방법을 보여주는 C# 코드입니다.
/// <summary>
/// Generates and recognizes AAMVA barcode.
/// </summary>
public static void GenerateAndRecognizeAamvaBarcode()
{
    // create DL data elements
    AamvaDataElement[] dlElements = new AamvaDataElement[] {
        new AamvaDataElement(AamvaDataElementIdentifiers.DAQ, "C12345678"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DCS, "CARPENTER"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DDE, "N"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DAC, "JON"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DDF, "N"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DAD, "T"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DDG, "N"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DCA, "D"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DCB, "1"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DCD, "NONE"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DBD, "10052015"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DBB, "07241984"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DBA, "01092022"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DBC, "1"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DAU, "067 in"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DAY, "BLK"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DAG, "3211 SANCTUARY LANE"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DAI, "LOUISVILLE"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DAJ, "KY"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DAK, "123454321"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DCF, "9876543210123456"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DCG, "USA"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DCK, "1234567890123456"),
        new AamvaDataElement(AamvaDataElementIdentifiers.DDB, "01062016")
    };

    // create ZK data elements
    AamvaDataElement[] zkElements = new AamvaDataElement[] {
        new AamvaDataElement("ZKA", "Y"),
        new AamvaDataElement("ZKB", "TEST"),
        new AamvaDataElement("ZKC", "9876"),
        new AamvaDataElement("ZKD", "DUP"),
    };

    // create subfiles
    AamvaSubfile[] subfiles = new AamvaSubfile[]{
        new AamvaSubfile("DL", dlElements),
        new AamvaSubfile("ZK", zkElements)
    };
    
    // create AAMVA barcode value
    AamvaBarcodeValue barcodeValue = new AamvaBarcodeValue(AamvaVersionLevel.AAMVA2016, 636046, 0, subfiles);
    
    // generate barcode image
    using (VintasoftBitmap barcodeImage = GenerateAamvaBarcode(barcodeValue))
    {
        // recognize barcode value
        AamvaBarcodeInfo recognizedBarcode = RecognizeAamvaBarcode(barcodeImage);

        // check value
        if (barcodeValue.ToString() != recognizedBarcode.AamvaValue.ToString())
            throw new ApplicationException();

        // print value
        Console.WriteLine("Version:         {0}", recognizedBarcode.VersionLevel);
        Console.WriteLine("Country:         {0}", recognizedBarcode.CountryId);
        Console.WriteLine("IIN:             {0}", recognizedBarcode.IssuerIdentificationNumber);
        Console.WriteLine("License number:  {0}", recognizedBarcode.LicenseNumber);
        Console.WriteLine("First name:      {0}", recognizedBarcode.FirstName);
        Console.WriteLine("Family name:     {0}", recognizedBarcode.FamilyName);
        Console.WriteLine("Middle name:     {0}", recognizedBarcode.MiddleName);
        Console.WriteLine("Sex (1=M;2=F):   {0}", recognizedBarcode.Sex);
        Console.WriteLine("Eye color:       {0}", recognizedBarcode.EyeColor);            
        Console.WriteLine("Date of birth:   {0}", recognizedBarcode.DateOfBirth.ToShortDateString());
        Console.WriteLine("Issue date:      {0}", recognizedBarcode.IssueDate.ToShortDateString());
        Console.WriteLine("Expiration date: {0}", recognizedBarcode.ExpirationDate.ToShortDateString());
        Console.WriteLine("State code:      {0}", recognizedBarcode.AddressStateCode);
        Console.WriteLine("City:            {0}", recognizedBarcode.AddressCity);
        Console.WriteLine("Postal code:     {0}", recognizedBarcode.AddressPostalCode);
        Console.WriteLine("Street:          {0}", recognizedBarcode.AddressStreet1);
        Console.WriteLine();
        Console.WriteLine("Data elements:");
        foreach (AamvaSubfile subfile in recognizedBarcode.Subfiles)
        {
            Console.WriteLine("[{0}] subfile:", subfile.SubfileType);
            foreach (AamvaDataElement dataElement in subfile.DataElements)
            {
                if (dataElement.Identifier.VersionLevel != AamvaVersionLevel.Undefined)
                    Console.Write("  [{0}] {1}:", dataElement.Identifier.ID, dataElement.Identifier.Description);
                else
                    Console.Write("  [{0}]:", dataElement.Identifier.ID);
                Console.WriteLine(" {0}", dataElement.Value);
            }
        }
    }
}

/// <summary>
/// Generates the AAMVA barcode image.
/// </summary>
/// <param name="barcodeValue">The barcode value.</param>
private static VintasoftBitmap GenerateAamvaBarcode(AamvaBarcodeValue barcodeValue)
{
    // create barcode writer
    using (BarcodeWriter writer = new BarcodeWriter())
    {
        // encode AAMVA barcode to writer settings
        BarcodeSymbologySubsets.AAMVA.Encode(barcodeValue, writer.Settings);

        // generate barcode image
        return writer.GetBarcodeAsVintasoftBitmap();
    }
}

/// <summary>
/// Recognizes the AAMVA barcode from image.
/// </summary>
/// <param name="barcodeImage">The barcode image.</param>
private static AamvaBarcodeInfo RecognizeAamvaBarcode(VintasoftBitmap barcodeImage)
{
    // create barcode reader
    using (BarcodeReader reader = new BarcodeReader())
    {
        // specify that AAMVA barcode must be recognized
        reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.AAMVA);

        // recognize barcodes
        IBarcodeInfo info = reader.ReadBarcodes(barcodeImage)[0];

        // return information about recognized AAMVA barcode
        return (AamvaBarcodeInfo)info;
    }
}


Adobe XFA 사양에 따라 압축된 데이터를 저장하는 PDF417 바코드를 생성하고 인식하는 방법을 보여주는 C# 코드입니다.
/// <summary>
/// Generates PDF417 barcode with XFA compression.
/// </summary>
public void GeneratePdf417BarcodeWithXfaCompression()
{
    string barcodeText =
        "https://www.vintasoft.com/vsbarcode-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vstwain-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vstwain-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vsimaging-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vsannotation-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vspdf-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vsjbig2-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vsjpeg2000-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vsdoccleanup-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vsocr-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vsdicom-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vsformsprocessing-dotnet-index.html" + System.Environment.NewLine +
        "https://www.vintasoft.com/vsoffice-dotnet-index.html";

    // create the barcode writer
    using (Vintasoft.Barcode.BarcodeWriter barcodeWriter = new Vintasoft.Barcode.BarcodeWriter())
    {
        // create the XFA compressed PDF417 barcode symbology
        Vintasoft.Barcode.SymbologySubsets.XFACompressedPDF417BarcodeSymbology xfaCompressedPdf417BarcodeSymbology =
            new Vintasoft.Barcode.SymbologySubsets.XFACompressedPDF417BarcodeSymbology();
        // encode barcode text using XFA compressed PDF417 barcode symbology
        xfaCompressedPdf417BarcodeSymbology.Encode(barcodeText, barcodeWriter.Settings);

        // save the barcode image to a file
        barcodeWriter.SaveBarcodeAsImage("pdf417-barcode-with-xfa-compression.png");
    }
}

/// <summary>
/// Recognizes PDF417 barcode with XFA compression.
/// </summary>
public void RecognizePdf417BarcodeWithXfaCompression()
{
    // create barcode reader
    using (Vintasoft.Barcode.BarcodeReader reader = new Vintasoft.Barcode.BarcodeReader())
    {
        // specify that reader must search for XFA compressed PDF417 barcodes
        reader.Settings.ScanBarcodeSubsets.Add(Vintasoft.Barcode.SymbologySubsets.BarcodeSymbologySubsets.XFACompressedPDF417);

        // read barcodes from image file
        Vintasoft.Barcode.IBarcodeInfo[] barcodeInfos = reader.ReadBarcodes("pdf417-barcode-with-xfa-compression.png");

        // if barcodes are not detected
        if (barcodeInfos.Length == 0)
        {
            System.Console.WriteLine("Barcodes are not found.");
        }
        // if barcodes are detected
        else
        {
            // get information about recognized barcodes

            System.Console.WriteLine(string.Format("{0} barcode(s) found:", barcodeInfos.Length));
            System.Console.WriteLine();
            for (int i = 0; i < barcodeInfos.Length; i++)
            {
                Vintasoft.Barcode.IBarcodeInfo barcodeInfo = barcodeInfos[i];
                System.Console.WriteLine(string.Format("[{0}:{1}]", i + 1, barcodeInfo.BarcodeType));
                System.Console.WriteLine(string.Format("Value:      {0}", barcodeInfo.Value));
                System.Console.WriteLine(string.Format("Region:     {0}", barcodeInfo.Region));
                System.Console.WriteLine();
            }
        }
    }
}


VintaSoft Barcode .NET SDK에서 생성할 수 있는 PDF417 바코드는 무엇입니까?

VintaSoft Barcode .NET SDK는 PDF417, PDF417 Compact, Micro PDF417, AAMVA, XFA 압축 PDF417 등 모든 유형의 PDF417 바코드를 생성합니다.

다음은 PDF417 바코드의 비트맵 이미지를 생성하는 방법을 보여주는 C# 코드입니다.
/// <summary>
/// Returns the PDF417 barcode as <see cref="System.Drawing.Bitmap"/>.
/// </summary>
/// <param name="value">The barcode value.</param>
/// <returns>A <see cref="System.Drawing.Bitmap"/> object.</returns>
public static System.Drawing.Bitmap GetPdf417BarcodeAsBitmap(string value)
{
    // create the barcode writer
    using (Vintasoft.Barcode.BarcodeWriter barcodeWriter = new Vintasoft.Barcode.BarcodeWriter())
    {
        // set barcode writer settings
        barcodeWriter.Settings.Barcode = Vintasoft.Barcode.BarcodeType.PDF417;
        barcodeWriter.Settings.Value = value;

        // get a barcode image as System.Drawing.Bitmap
        return Vintasoft.Barcode.GdiExtensions.GetBarcodeAsBitmap(barcodeWriter);
    }
}


다음은 Micro PDF417 바코드의 비트맵 이미지를 생성하는 방법을 보여주는 C# 코드입니다.
/// <summary>
/// Returns the Micro PDF417 barcode as <see cref="System.Drawing.Bitmap"/>.
/// </summary>
/// <param name="value">The barcode value.</param>
/// <returns>A <see cref="System.Drawing.Bitmap"/> object.</returns>
public static System.Drawing.Bitmap GetMicroPdf417BarcodeAsBitmap(string value)
{
    // create the barcode writer
    using (Vintasoft.Barcode.BarcodeWriter barcodeWriter = new Vintasoft.Barcode.BarcodeWriter())
    {
        // set barcode writer settings
        barcodeWriter.Settings.Barcode = Vintasoft.Barcode.BarcodeType.MicroPDF417;
        barcodeWriter.Settings.Value = value;

        // get a barcode image as System.Drawing.Bitmap
        return Vintasoft.Barcode.GdiExtensions.GetBarcodeAsBitmap(barcodeWriter);
    }
}


다음은 PDF417 바코드의 벡터(SVG) 이미지를 생성하는 방법을 보여주는 C# 코드입니다.
/// <summary>
/// Returns the PDF417 barcode in vector form as a SVG string.
/// </summary>
/// <param name="barcodeValue">Barcode value.</param>
public static void GetPdf417BarcodeAsSvgString(string barcodeValue)
{
    // create the barcode writer
    using (Vintasoft.Barcode.BarcodeWriter barcodeWriter = new Vintasoft.Barcode.BarcodeWriter())
    {
        // set barcode writer settings
        barcodeWriter.Settings.Barcode = Vintasoft.Barcode.BarcodeType.PDF417;
        barcodeWriter.Settings.Value = barcodeValue;

        // generate PDF417 barcode as a SVG string
        return barcodeWriter.GetBarcodeAsSvgFile();
    }
}