empira / PDFsharp

PDFsharp and MigraDoc Foundation for .NET 6 and .NET Framework
https://docs.pdfsharp.net/
Other
398 stars 91 forks source link

Expose PDFSharp.Drawing.Interpolate as MigraDoc.DocumentObjectModel.Shapes.Image.Interpolate #116

Closed th-joerger closed 1 month ago

th-joerger commented 1 month ago

I was not happy with how MigraDoc was rendering small QR code pngs from ZXing in output pdfs. The solution is simple and straightforward: just deactivate interpolation for the image.

This PR exposes the PDFSharp.Drawing.Interpolate property in MigraDoc as DocumentObjectModel.Shapes.Image.Interpolate.

Test have been added. Removed a large base64 string with unknown origin and sketchy content and replaced it by a Nothing-Up-My-Sleeve-QR-String for security reasons.

Result

Test_Image_Interpolation-WIN-CORE-6.0-109278A999_temp.pdf

ThomasHoevel commented 1 month ago

Thank you very much for your valuable feedback. With the final version of PDFsharp 6.1.0, we include the Interpolate property with the MigraDoc Image class. We did not add an Interpolate parameter to any methods, but it is not needed anyway.

th-joerger commented 1 month ago

Great news!

We did not add an Interpolate parameter to any methods, but it is not needed anyway.

You referring to the XImage CreateXImage(string uri, bool interpolate) method in the ImageRenderer? I guess one could simply use the _image class variable directly as well, but I wanted to keep the option for voluntarily ignoring the setting, if necessary.