ZXing.Net icon indicating copy to clipboard operation
ZXing.Net copied to clipboard

[bug] Unable to read pdf417 barcode in vba

Open ghost opened this issue 2 years ago • 2 comments

I found a bug, when I use the following vba code to generate pdf417 barcode, after decoding it is empty, why?

Sub test()
    Dim myWriter As New BarcodeWriter, myOptions As New PDF417EncodingOptions, myReader As New BarcodeReader, myPath As String
    
    Set myWriter.Options = myOptions
    With myOptions
        .AspectRatio = PDF417AspectRatio_A1
        .ErrorCorrection = PDF417ErrorCorrectionLevel_L3
        .Margin = 2
    End With
    myWriter.Format = BarcodeFormat_PDF_417
    
    myPath = "C:\test1.png"
    myWriter.WriteToFile "test", myPath, ImageFileFormat_Png
    
    myReader.Options.PossibleFormats.Add BarcodeFormat_PDF_417
    MsgBox myReader.DecodeImageFile(myPath).Text
    
End Sub

When I set AspectRatio to PDF417AspectRatio_A4, it can be read successfully.

test111

Here are the two generated images: test1 test2

ghost avatar Jul 09 '22 02:07 ghost

Is there a solution to this problem? @micjahn

ghost avatar Oct 13 '22 03:10 ghost

Only not to use A1 at the moment. I hadn't the time to look deeper into the code.

micjahn avatar Oct 14 '22 16:10 micjahn