diff --git a/QuestPDF/Drawing/DocumentGenerator.cs b/QuestPDF/Drawing/DocumentGenerator.cs index fa31288..be8d0ac 100644 --- a/QuestPDF/Drawing/DocumentGenerator.cs +++ b/QuestPDF/Drawing/DocumentGenerator.cs @@ -148,6 +148,7 @@ namespace QuestPDF.Drawing $"Please analyze your documents structure to detect this element and fix its size constraints."; content.RemoveExistingProxies(); + content.RemoveExistingContainers(); content.ApplyLayoutDebugging(); content.Measure(Size.Max); diff --git a/QuestPDF/Drawing/Proxy/LayoutErrorAnalyzer.cs b/QuestPDF/Drawing/Proxy/LayoutErrorAnalyzer.cs index 85bf659..dfeb825 100644 --- a/QuestPDF/Drawing/Proxy/LayoutErrorAnalyzer.cs +++ b/QuestPDF/Drawing/Proxy/LayoutErrorAnalyzer.cs @@ -23,6 +23,14 @@ namespace QuestPDF.Drawing.Proxy x.CreateProxy(y => y is ElementProxy proxy ? proxy.Child : y); }); } + + public static void RemoveExistingContainers(this Container content) + { + content.VisitChildren(x => + { + x.CreateProxy(y => y is Container container ? container.Child : y); + }); + } public static LayoutErrorTrace CollectLayoutErrorTrace(this Container content) {