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

XGraphics.DrawMatrixCode fails with inappropriate error message #361

Open
StepKie opened this issue May 9, 2023 · 3 comments
Open

XGraphics.DrawMatrixCode fails with inappropriate error message #361

StepKie opened this issue May 9, 2023 · 3 comments

Comments

@StepKie
Copy link

StepKie commented May 9, 2023

Somebody created this issue here, and I have the exact same issue when trying to draw a QR code image onto a pdf document:

https://forum.pdfsharp.net/viewtopic.php?f=2&t=4121

My code is basically the same:

string qrString = GetStringForQr(sample);
CodeDataMatrix qrCode = new CodeDataMatrix(qrString, , qrString.Length);
page.DrawMatrixCode(qrCode, QrCodeLocation);

The last line will throw

System.ArgumentNullException : Value cannot be null. (Parameter 'image')

Stack Trace: 
XGraphics.DrawImage(XImage image, Double x, Double y, Double width, Double height)
CodeDataMatrix.Render(XGraphics gfx, XBrush brush, XPoint position)
XGraphics.DrawMatrixCode(MatrixCode matrixcode, XPoint position)

, though the argument is obviously not null (can be verified with debugger).

@amerlin
Copy link

amerlin commented Jun 10, 2023

I have also the same problem. There is a solution? Thanks

@psycrush
Copy link

psycrush commented Aug 1, 2023

I have the same problem. When debugging I saw that the following method always returns null. I guess this is not a bug but not implemented at all.

PdfSharpCore/Drawing.BarCodes/DataMatrixImage.opensource.cs Line 179:

/// <summary>
/// Creates a DataMatrix image object.
/// </summary>
public XImage CreateImage(char[] code, int rows, int columns, int pixelsize)
{
    return null;
}

@StepKie
Copy link
Author

StepKie commented Sep 11, 2023

@ststeiger Any possibility to fix this? Thanks...

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

3 participants