This project has moved and is read-only. For the latest updates, please go here.

PDF417 dimension problem

Oct 9, 2014 at 2:12 PM
Edited Oct 10, 2014 at 8:05 AM
Hello, so i am trying to create a PDF417 barcode and put it on a A4 page.

I've read another post on this board about the dimension issue, and tried setting the width and height to 1 so the barcode would be as small as possible. But that doesn't help because the barcode is still huge.

Here's my code:
           BarcodeWriter writer = new BarcodeWriter()
                Format = BarcodeFormat.PDF_417,
                Options = new PDF417EncodingOptions
                   Dimensions = new Dimensions(9, 9, 2, 35),
                   Margin = 0,
                   Height = 1,
                   Width = 1,
                   CharacterSet = "UTF-8",
                   ErrorCorrection = PDF417ErrorCorrectionLevel.L4,

           BitMatrix bitMatrix = writer.Encode(stringForBarCode);
           Bitmap bitmap = writer.Write(bitMatrix);
When i put the bitmap on the A4 page it looks like this:

As you can see, the barcode takes up more than half the page and i need it to be just 1/4 of its current size. I tried scaling the bitmap but it looks bad, and it probably won't work.

Just to make things a bit more clear. The A4 page will be a template that will be printed to an order of payment. This is how it should look:

The barcode on that order is in the same format and has the same data as my barcode, but mine is 4 times bigger.

Is there any way i can make the barcode smaller?

Thank you!
Oct 14, 2014 at 9:17 AM
Edited Oct 14, 2014 at 9:18 AM
Okay, i solved the issue by changing the line thickness in the source to 1 and building a new dll.

But now i have a new issue, the UTF-8 encoding does not work. The barcode should encode the string "Državni proračun", but when i try to decode the resulting barcode it reads "Drravni prorarun". The code i use is the same as the one i posted above.

Is there a solution to that issue?
Oct 14, 2014 at 7:39 PM
The support for UTF-8 encoding isn't fully complete.
And as far as I know a lot of scanners out in the wild have trouble with PDF417 codes and different encodings than ISO8859-1.
Not sure if it is a good idea to use UTF-8 with PDF417.
I would be happy if someone can tell me a working combination of a PDF417 encoder with UTF-8 and a scanner which successfully decodes it.
Oct 15, 2014 at 7:36 AM
Edited Oct 15, 2014 at 7:51 AM
The barcode on the order of payment i posted is in UTF-8 and the banking application we read the barcode with can read it so there are solutions out there. But if it can't be done with ZXing i'll replace the special characters with some that it can encode and it will be fine.

Thank you for your reply and keep up the good work!