Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can we generate a Datamatrix code in base64 (or byte[]) #510

Open
abennouna12 opened this issue Jul 12, 2023 Discussed in #509 · 1 comment
Open

How can we generate a Datamatrix code in base64 (or byte[]) #510

abennouna12 opened this issue Jul 12, 2023 Discussed in #509 · 1 comment

Comments

@abennouna12
Copy link

Discussed in #509

Originally posted by abennouna12 July 12, 2023
Hello,

I was using Datamatrix.Net to generate a Datamatrix code.

Today we have migrated to .NET 7 and this generation doesn't work anymore.

So I want to use ZXing.Net to generate this Datamatrix but I didn't find documentation about the subject.

Does anyone have an idea ?

Thanks.

I have started by writing these two lines but I want to convert the result into Base64 strinr or Vyte[] Without using System.Drawing

var writer = new DataMatrixWriter();
var image = writer.encode(content, BarcodeFormat.DATA_MATRIX, 300, 300);
@micjahn
Copy link
Owner

micjahn commented Jul 18, 2023

The main question is: what should be "inside" the base64 / byte[] representation? Should it be the contents of a JPG or BMP file which represents the generated datamatrix image? Or only the RGB values without any specific file format information?
How do you want to process the base64 string / byte array after generation?
The DataMatrixWriter class in your snippet gives you a BitMatrix instance. It doesn't use System.Drawing.

If you only need the raw RGB values you can use the class BarcodeWriterPixelData.

Alternatively you can use the class BarcodeWriterSvg if want to generate a scalable SVG image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants