|
@@ -193,8 +193,6 @@ namespace QuestPDF.Drawing
|
|
|
content.InjectDependencies(pageContext, canvas);
|
|
content.InjectDependencies(pageContext, canvas);
|
|
|
content.VisitChildren(x => (x as IStateResettable)?.ResetState());
|
|
content.VisitChildren(x => (x as IStateResettable)?.ResetState());
|
|
|
|
|
|
|
|
- LayoutOverflowPageMarker? layoutOverflowPageMarker = null;
|
|
|
|
|
-
|
|
|
|
|
while(true)
|
|
while(true)
|
|
|
{
|
|
{
|
|
|
var spacePlan = content.Measure(Size.Max);
|
|
var spacePlan = content.Measure(Size.Max);
|
|
@@ -227,12 +225,6 @@ namespace QuestPDF.Drawing
|
|
|
|
|
|
|
|
if (pageContext.CurrentPage >= Settings.DocumentLayoutExceptionThreshold)
|
|
if (pageContext.CurrentPage >= Settings.DocumentLayoutExceptionThreshold)
|
|
|
{
|
|
{
|
|
|
- if (Settings.EnableDebugging)
|
|
|
|
|
- {
|
|
|
|
|
- ApplyLayoutDebugging();
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
canvas.EndDocument();
|
|
canvas.EndDocument();
|
|
|
ThrowLayoutException();
|
|
ThrowLayoutException();
|
|
|
}
|
|
}
|
|
@@ -241,27 +233,19 @@ namespace QuestPDF.Drawing
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (Settings.EnableDebugging)
|
|
|
|
|
+ {
|
|
|
|
|
+ ConfigureLayoutOverflowMarker();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
void ApplyLayoutDebugging()
|
|
void ApplyLayoutDebugging()
|
|
|
{
|
|
{
|
|
|
- if (layoutOverflowPageMarker == null)
|
|
|
|
|
- {
|
|
|
|
|
- layoutOverflowPageMarker = new LayoutOverflowPageMarker();
|
|
|
|
|
-
|
|
|
|
|
- content.CreateProxy(child =>
|
|
|
|
|
- {
|
|
|
|
|
- layoutOverflowPageMarker.Child = child;
|
|
|
|
|
- return layoutOverflowPageMarker;
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- layoutOverflowPageMarker.PageNumbersWithLayoutIssues.Add(pageContext.CurrentPage);
|
|
|
|
|
-
|
|
|
|
|
content.RemoveExistingProxies();
|
|
content.RemoveExistingProxies();
|
|
|
|
|
|
|
|
content.ApplyLayoutOverflowDetection();
|
|
content.ApplyLayoutOverflowDetection();
|
|
|
content.Measure(Size.Max);
|
|
content.Measure(Size.Max);
|
|
|
|
|
|
|
|
- var overflowState = content.ExtractProxyOfType<OverflowDebuggingProxy>();
|
|
|
|
|
|
|
+ var overflowState = content.ExtractElementsOfType<OverflowDebuggingProxy>().FirstOrDefault();
|
|
|
overflowState.ApplyLayoutOverflowVisualization();
|
|
overflowState.ApplyLayoutOverflowVisualization();
|
|
|
|
|
|
|
|
content.ApplyContentDirection();
|
|
content.ApplyContentDirection();
|
|
@@ -269,6 +253,25 @@ namespace QuestPDF.Drawing
|
|
|
|
|
|
|
|
content.RemoveExistingProxies();
|
|
content.RemoveExistingProxies();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ void ConfigureLayoutOverflowMarker()
|
|
|
|
|
+ {
|
|
|
|
|
+ var layoutOverflowPageMarker = new LayoutOverflowPageMarker();
|
|
|
|
|
+
|
|
|
|
|
+ content.CreateProxy(child =>
|
|
|
|
|
+ {
|
|
|
|
|
+ layoutOverflowPageMarker.Child = child;
|
|
|
|
|
+ return layoutOverflowPageMarker;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ var pageNumbersWithLayoutIssues = content
|
|
|
|
|
+ .ExtractElementsOfType<LayoutOverflowVisualization>()
|
|
|
|
|
+ .SelectMany(x => x.Flatten())
|
|
|
|
|
+ .SelectMany(x => x.Value.VisibleOnPageNumbers)
|
|
|
|
|
+ .Distinct();
|
|
|
|
|
+
|
|
|
|
|
+ layoutOverflowPageMarker.PageNumbersWithLayoutIssues = new HashSet<int>(pageNumbersWithLayoutIssues);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
void ThrowLayoutException()
|
|
void ThrowLayoutException()
|
|
|
{
|
|
{
|