From 77b8f04659e1013040db690bb5c6357b5f18b5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Zi=C4=85bek?= Date: Fri, 19 Nov 2021 00:50:38 +0100 Subject: [PATCH] Synced to 2021.12-alpha0 --- QuestPDF.ReportSample/Tests.cs | 11 +++++++++-- QuestPDF/Drawing/DocumentGenerator.cs | 14 +++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/QuestPDF.ReportSample/Tests.cs b/QuestPDF.ReportSample/Tests.cs index 6983880..f31ba6f 100644 --- a/QuestPDF.ReportSample/Tests.cs +++ b/QuestPDF.ReportSample/Tests.cs @@ -22,11 +22,18 @@ namespace QuestPDF.ReportSample } [Test] - public void GenerateAndShow() + public void GenerateAndShowPdf() { var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"test_result.pdf"); Report.GeneratePdf(path); - + Process.Start("explorer.exe", path); + } + + [Test] + public void GenerateAndShowXps() + { + var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"test_result.xps"); + Report.GenerateXps(path); Process.Start("explorer.exe", path); } diff --git a/QuestPDF/Drawing/DocumentGenerator.cs b/QuestPDF/Drawing/DocumentGenerator.cs index 57a5b67..a370db6 100644 --- a/QuestPDF/Drawing/DocumentGenerator.cs +++ b/QuestPDF/Drawing/DocumentGenerator.cs @@ -113,16 +113,16 @@ namespace QuestPDF.Drawing void ThrowLayoutException() { - throw new DocumentLayoutException("Composed layout generates infinite document.") + var message = $"Composed layout generates infinite document. This may happen in two cases. " + + $"1) Your document and its layout configuration is correct but the content takes more than {documentMetadata.DocumentLayoutExceptionThreshold} pages. " + + $"In this case, please increase the value {nameof(DocumentMetadata)}.{nameof(DocumentMetadata.DocumentLayoutExceptionThreshold)} property configured in the {nameof(IDocument.GetMetadata)} method. " + + $"2) The layout configuration of your document is invalid. Some of the elements require more space than is provided." + + $"Please analyze your documents structure to detect this element and fix its size constraints."; + + throw new DocumentLayoutException(message) { ElementTrace = debuggingState?.BuildTrace() ?? "Debug trace is available only in the DEBUG mode." }; - throw new DocumentLayoutException( - $"Composed layout generates infinite document. This may happen in two cases. " + - $"1) Your document and its layout configuration is correct but the content takes more than {documentMetadata.DocumentLayoutExceptionThreshold} pages. " + - $"In this case, please increase the value {nameof(DocumentMetadata)}.{nameof(DocumentMetadata.DocumentLayoutExceptionThreshold)} property configured in the {nameof(IDocument.GetMetadata)} method. " + - $"2) The layout configuration of your document is invalid. Some of the elements require more space than is provided." + - $"Please analyze your documents structure to detect this element and fix its size constraints."); } }