IronPdf / Iron-Pdf-Documentation

ReadTheDocs Build Files for IronPDF C#/.Net PDF Library http://ironpdf.com
8 stars 2 forks source link

The ImageToPDFConverter CropPage option seems to be inconsistent #21

Open Malithium opened 2 years ago

Malithium commented 2 years ago

I have been experimenting with the ImageToPDFConverter object in .NET Core C# and I have been running into an issue where using the IronPdf.Imaging.ImageBehavior.CropPage option results in the image sizing being off.

I am not doing anything overly complicated:

var sloth = System.IO.Directory.GetCurrentDirectory() + "/Sloth.jpg";

using var slothPDF = ImageToPdfConverter.ImageToPdf(sloth, IronPdf.Imaging.ImageBehavior.CropPage);

slothPDF.SaveAs("SlothTest.pdf");

I have also tried reading the file into a System.Drawing.Image object and passing that in but the results are the same.

Image used in the test: Sloth

Resulting PDF: SlothTest.pdf

My first instinct was that perhaps something is off with the image metadata which is causing this issue, but figured I would raise this here in case it is actually a problem.