From 828bb867370715e974022c15e681db2782a09bfa Mon Sep 17 00:00:00 2001 From: Bebo-Maker Date: Wed, 23 Mar 2022 08:35:53 +0100 Subject: [PATCH] Fix MaxWidth calculation when pages are empty. --- QuestPDF.Previewer/InteractiveCanvas.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QuestPDF.Previewer/InteractiveCanvas.cs b/QuestPDF.Previewer/InteractiveCanvas.cs index 63ca72b..0494878 100644 --- a/QuestPDF.Previewer/InteractiveCanvas.cs +++ b/QuestPDF.Previewer/InteractiveCanvas.cs @@ -26,7 +26,7 @@ class InteractiveCanvas : ICustomDrawOperation private const float SafeZone = 50f; public float TotalHeight => Pages.Sum(x => x.Size.Height) + (Pages.Count - 1) * PageSpacing; - public float MaxWidth => Pages.Max(x => x.Size.Width); + public float MaxWidth => Pages.Any() ? Pages.Max(x => x.Size.Width) : 0; public float MaxTranslateY => -(Height / 2 - SafeZone) / Scale; public float MinTranslateY => (Height / 2 - SafeZone) / Scale - TotalHeight;