I have an issue with drawing an image on a PDF header. I am using .NET Core 3.1, Syncfusion.DocIO.Net.Core V 21.1.37, Syncfusion.DocIORenderer.Net.Core V 21.1.35, Syncfusion.Pdf.Net.Core V 31.1.35. The image I am trying to print on the page is 206x32 and gets printed much larger and in the wrong resolution.
Here is the code i use to draw this image on the page
logopath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "inspection", "HeaderLogo.png");
var sr = File.OpenRead(logopath);
logo = new PdfBitmap(sr);
RectangleF bounds = new RectangleF(0, 0, pdfDocument.Pages.GetClientSize().Width, logo.Height < 50 ? 50 : logo.Height + 5);
PdfPageTemplateElement header = new PdfPageTemplateElement(bounds);
header.Graphics.DrawImage(logo, new PointF(0, 0), new SizeF(logo.Width, logo.Height));
This code does work on another application that I work with that is a Web application and API using AspNet.Mvc V 5.2.6. However they do use the same version of Syncfusion and the web applications implementation prints the image properly with the correct resolution. Is there a difference between the version of Syncfusion that is used for a MVC application that could effect the result?
The result we are looking for that the Web application is producing:
We have checked the same scenario on our end with both the ASP .Net core web application and the MVC application and the results were the same. We have attached both samples for your reference. we request you try this on your end and let us know the result.
Asp .Net MVC Application: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SyncfusionFieldTest1782624872
Asp .Net MVC core application: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ImportExport-2079097750
We request you share the modified sample and the steps to replicate the issue with us. So that we can assist you further on this.
Thank you for your reply, but I am having difficulties starting the Asp .NET MVC core application that you provided as there are a few required documents that are not provided in the ZIP file. The Annotation.pdf, Annotations.json, ExportedFields.json, ExportedOutput.pdf and input.pdf documents.
I have removed them from the project. You can ignore and delete those missing files since that is not related to our sample. We have attached the modified sample for your reference. Please try this on your end and let us know the result.