PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Oct 28, 2020 2:42 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: Wed Apr 01, 2020 2:16 pm 
Offline

Joined: Wed Apr 01, 2020 2:12 pm
Posts: 1
I import the PDFSharp 1.50.5147 version using NuGet and tried to generate the matrix code using the code below

Code:
var myXSize = new XSize(130, 130);
var myNewCode = new PdfSharp.Drawing.BarCodes.CodeDataMatrix("Content", 144, myXSize);
var myXPoint = new XPoint(630, 50);
//gfx.DrawMatrixCode(myNewCode, myXPoint);

But when I execute the code it return error "Value cannot be null. Parameter name: image" as below:

Code:
[ArgumentNullException: Value cannot be null.
Parameter name: image]
   PdfSharp.Drawing.XGraphics.DrawImage(XImage image, Double x, Double y, Double width, Double height) +174
   PdfSharp.Drawing.BarCodes.CodeDataMatrix.Render(XGraphics gfx, XBrush brush, XPoint position) +2637
   PdfSharp.Drawing.XGraphics.DrawMatrixCode(MatrixCode matrixcode, XPoint position) +147
   learners.pages.Class.ViewCompletedAssessment.btnDownloadCert_Click(Object sender, EventArgs e) in E:\Inetpub\wwwroot\learners\learners\pages\Class\ViewCompletedAssessment.aspx.cs:181
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11758656
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5028

It seems that the "DrawMatrixCode" function will call "DrawImage" function and I dig the source code and found it should run the code below:

Code:
if (MatrixImage == null)
                MatrixImage = DataMatrixImage.GenerateMatrixImage(Text, Encoding, Rows, Columns);

However, it seems that the image is not generated. Does anyone can come up with some advise?


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: No registered users and 19 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