Hello,
I can draw and write in my PDF without any problem.
Now, I want to generate a dataMatrix in a pdf with PdfSharp.
A problem occured when I run the DrawMatrixCode
// Version : 1.50.5147
Code:
using PdfSharp.Drawing;
using PdfSharp.Drawing.BarCodes;
using PdfSharp.Pdf;
Code:
PdfDocument document = new PdfDocument();
document.Info.Title = "Sample title";
PdfPage page = document.AddPage();
page.Width = XUnit.FromMillimeter(500);
page.Height = XUnit.FromMillimeter(500);
XGraphics gfx = XGraphics.FromPdfPage(page);
CodeDataMatrix dm = new CodeDataMatrix("test", 26)
{
Size = new XSize(XUnit.FromMillimeter(15), XUnit.FromMillimeter(15))
};
gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(100, 100));
// // ----> System.ArgumentNullException
// HResult=0x80004003
// Message=The value can't be
// Nparameter name : image
// Source=PdfSharp
// call stack :
// à PdfSharp.Drawing.XGraphics.DrawImage(XImage image, Double x, Double y, Double width, Double height)
// à PdfSharp.Drawing.BarCodes.CodeDataMatrix.Render(XGraphics gfx, XBrush brush, XPoint position)
// à PdfSharp.Drawing.XGraphics.DrawMatrixCode(MatrixCode matrixcode, XBrush brush, XPoint position)