How to use "byte array" as data to write PDF417 barcode?

Discussions about PDF417 barcode reading and writing.
Post Reply
oha
Posts: 5
Joined: Mon Oct 03, 2016 2:38 pm

How to use "byte array" as data to write PDF417 barcode?

Post by oha » Mon Oct 03, 2016 2:55 pm

Hi guys,
please, is there any way how to use "byte array" as barcode data?
Both BarcodePDF417Write method overloads expect "string" as data.
I would like to encode raw byte data -> should be possible with PDF 417 (with use of BarcodePDF417EncodingMode.BarcodePDF417EncodingModeByte), correct?
Any idea how to do that without base64 encoding?

Thank you!
Ondrej

User avatar
Loïc
Site Admin
Posts: 5592
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: How to use "byte array" as data to write PDF417 barcode?

Post by Loïc » Tue Oct 04, 2016 2:59 pm

Hi,

Just pass the byte array as string using the correct encoding:

Code: Select all

string myString = Encoding.GetEncoding(1252).GetBytes(data);
Kind regards,

Loïc

oha
Posts: 5
Joined: Mon Oct 03, 2016 2:38 pm

Re: How to use "byte array" as data to write PDF417 barcode?

Post by oha » Tue Oct 04, 2016 5:12 pm

Hi Loïc,
are you sure it will work?
I mean byte array can contain whatever byte sequence (imagine byte[] from ZIP stream)
I'm afraid that some specific encoding could destroy the data.
What do you think?

Best regards,
Ondrej

User avatar
Loïc
Site Admin
Posts: 5592
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: How to use "byte array" as data to write PDF417 barcode?

Post by Loïc » Tue Oct 04, 2016 5:16 pm

Yes I'm sure.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest