Просмотр исходного кода

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

Marcin Ziąbek 11 месяцев назад
Родитель
Сommit
37b782bd26
2 измененных файлов с 5 добавлено и 2 удалено
  1. 3 0
      Source/QuestPDF/Helpers/Helpers.cs
  2. 2 2
      Source/QuestPDF/Resources/ReleaseNotes.txt

+ 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)
         {
+            if (targetResolution.Width == 0 || targetResolution.Height == 0)
+                targetResolution = new ImageSize(1, 1);
+            
             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
 - 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.