XGraphics.DrawMatrixCode fails with inappropriate error message
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).
I have also the same problem. There is a solution? Thanks
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;
}
https://github.com/ststeiger/PdfSharpCore/blob/c918cbf79c0f6c0e13d71fee551286357140b665/PdfSharpCore/Drawing.BarCodes/DataMatrixImage.opensource.cs#L181
@ststeiger Any possibility to fix this? Thanks...