Set Height is auto Canvas to draw in QUESTPDF library C#

I am using QUESTPDF library in my C# application to generate pdf file. i use this code below to draw cross X (2 intersecting lines not x char) in specific row cell :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>column.Item().Height(50).Canvas((canvas, size) =>
{
using var paint = new SKPaint
{
Color = SKColors.Black,
StrokeWidth = 1
};
canvas.DrawLine(0, 0, size.Width, size.Height, paint);
canvas.DrawLine(0, size.Height, size.Width, 0, paint);
});
</code>
<code>column.Item().Height(50).Canvas((canvas, size) => { using var paint = new SKPaint { Color = SKColors.Black, StrokeWidth = 1 }; canvas.DrawLine(0, 0, size.Width, size.Height, paint); canvas.DrawLine(0, size.Height, size.Width, 0, paint); }); </code>
column.Item().Height(50).Canvas((canvas, size) =>
        {
            using var paint = new SKPaint
            {
                Color = SKColors.Black,
                StrokeWidth = 1
            };
            canvas.DrawLine(0, 0, size.Width, size.Height, paint);
            canvas.DrawLine(0, size.Height, size.Width, 0, paint);
        });

The problem here is i hard code in “.Height(50)” method mean its height is alway 50. If i dont set the height of it. a exception will be thrown :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>QuestPDF.Drawing.Exceptions.DocumentLayoutException
HResult=0x80131500
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 250 pages. In this case, please increase the value QuestPDF.Settings.DocumentLayoutExceptionThreshold static property. 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.
Source=QuestPDF
StackTrace:
at QuestPDF.Drawing.DocumentGenerator.<RenderPass>g__ThrowLayoutException|10_1[TCanvas](<>c__DisplayClass10_0`1& )
at QuestPDF.Drawing.DocumentGenerator.RenderPass[TCanvas](PageContext pageContext, TCanvas canvas, Container content, DebuggingState debuggingState)
at QuestPDF.Drawing.DocumentGenerator.RenderSingleDocument[TCanvas](TCanvas canvas, IDocument document, DocumentSettings settings)
at QuestPDF.Drawing.DocumentGenerator.GeneratePdf(Stream stream, IDocument document)
at QuestPDF.Fluent.GenerateExtensions.GeneratePdf(IDocument document, String filePath)
at esl_data_transformer.esl_product_export_buying_guide_forward.<ExportPdfNew>d__9.MoveNext() in D:work_spacesource_gitIGHIHG.ESL.Core.DataTransformeresl-data-transformeresl_product_export_buying_guide_forward.cs:line 140
</code>
<code>QuestPDF.Drawing.Exceptions.DocumentLayoutException HResult=0x80131500 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 250 pages. In this case, please increase the value QuestPDF.Settings.DocumentLayoutExceptionThreshold static property. 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. Source=QuestPDF StackTrace: at QuestPDF.Drawing.DocumentGenerator.<RenderPass>g__ThrowLayoutException|10_1[TCanvas](<>c__DisplayClass10_0`1& ) at QuestPDF.Drawing.DocumentGenerator.RenderPass[TCanvas](PageContext pageContext, TCanvas canvas, Container content, DebuggingState debuggingState) at QuestPDF.Drawing.DocumentGenerator.RenderSingleDocument[TCanvas](TCanvas canvas, IDocument document, DocumentSettings settings) at QuestPDF.Drawing.DocumentGenerator.GeneratePdf(Stream stream, IDocument document) at QuestPDF.Fluent.GenerateExtensions.GeneratePdf(IDocument document, String filePath) at esl_data_transformer.esl_product_export_buying_guide_forward.<ExportPdfNew>d__9.MoveNext() in D:work_spacesource_gitIGHIHG.ESL.Core.DataTransformeresl-data-transformeresl_product_export_buying_guide_forward.cs:line 140 </code>
QuestPDF.Drawing.Exceptions.DocumentLayoutException
  HResult=0x80131500
  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 250 pages. In this case, please increase the value QuestPDF.Settings.DocumentLayoutExceptionThreshold static property. 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.
  Source=QuestPDF
  StackTrace:
   at QuestPDF.Drawing.DocumentGenerator.<RenderPass>g__ThrowLayoutException|10_1[TCanvas](<>c__DisplayClass10_0`1& )
   at QuestPDF.Drawing.DocumentGenerator.RenderPass[TCanvas](PageContext pageContext, TCanvas canvas, Container content, DebuggingState debuggingState)
   at QuestPDF.Drawing.DocumentGenerator.RenderSingleDocument[TCanvas](TCanvas canvas, IDocument document, DocumentSettings settings)
   at QuestPDF.Drawing.DocumentGenerator.GeneratePdf(Stream stream, IDocument document)
   at QuestPDF.Fluent.GenerateExtensions.GeneratePdf(IDocument document, String filePath)
   at esl_data_transformer.esl_product_export_buying_guide_forward.<ExportPdfNew>d__9.MoveNext() in D:work_spacesource_gitIGHIHG.ESL.Core.DataTransformeresl-data-transformeresl_product_export_buying_guide_forward.cs:line 140

But if i set height. There will be some cases where because of hard code height it will be offset from other columns like this :

I want to ask if there is a way without hard code set Height of it. The height will automatically expand to accommodate columns containing other text characters.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật