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 :
<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 :
<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.