Browse Source

Fixed an exception that occurred when rendering an image with a zero target size.

Marcin Ziąbek 1 year ago
parent
commit
37b782bd26

+ 3 - 0
Source/QuestPDF/Helpers/Helpers.cs

@@ -108,6 +108,9 @@ namespace QuestPDF.Helpers
 
 
         internal static SkImage ResizeAndCompressImage(this SkImage image, ImageSize targetResolution, ImageCompressionQuality compressionQuality)
         internal static SkImage ResizeAndCompressImage(this SkImage image, ImageSize targetResolution, ImageCompressionQuality compressionQuality)
         {
         {
+            if (targetResolution.Width == 0 || targetResolution.Height == 0)
+                targetResolution = new ImageSize(1, 1);
+            
             return image.ResizeAndCompress(targetResolution.Width, targetResolution.Height, compressionQuality.ToQualityValue(), compressionQuality.ToDownsamplingStrategy());
             return image.ResizeAndCompress(targetResolution.Width, targetResolution.Height, compressionQuality.ToQualityValue(), compressionQuality.ToDownsamplingStrategy());
         }
         }
 
 

+ 2 - 2
Source/QuestPDF/Resources/ReleaseNotes.txt

@@ -27,5 +27,5 @@ Version 2024.12.1
 
 
 Version 2024.12.2
 Version 2024.12.2
 - Enhanced the EnsureSpace element to work dynamically without a pre-configured vertical space threshold.
 - Enhanced the EnsureSpace element to work dynamically without a pre-configured vertical space threshold.
-
-- Improved table rendering stability in rare scenarios.
+- Improved table rendering stability in rare scenarios.
+- Fixed an exception that occurred when rendering an image with a zero target size.