PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 7:04 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Aug 02, 2021 11:50 am 
Offline

Joined: Mon Aug 02, 2021 7:29 am
Posts: 1
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)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 47 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group