QuestPDF measuring text
The docs don't say anything about the ability to get the text size before rendering.
https://www.questpdf.com/api-reference/text.html
I need to select the largest string that will fit in an amount of space. I have manually computed the space that will be available for the piece of text so that I could check if it would fit. However, no such function seems to exist? I need a more or less precise measurement to make sure this piece of text never wraps or gets clipped.
Text | QuestPDF
Open-source modern .NET library for PDF document generation. Offering comprehensive layout engine powered by concise and discoverable C# Fluent API.
2 Replies
maybe something like this https://github.com/QuestPDF/QuestPDF/discussions/789#discussioncomment-8492819
GitHub
Text Clipping · QuestPDF QuestPDF · Discussion #789
Hello Marcin and community, I've been trying to figure out how to clip text instead of wrapping within a table layout. If a certain piece of text was longer than the width of the Canvas availab...
Thanks, I'll try it momentarily
Well the problem is that virtually everything in their library is internal for some reason. I mean, it's fine if the abstraction could cover any use case, but that's not the case. The thing you sent requires you having a font object, but there's no public method for getting it out of a text descriptor. Neither can you get the font size and other information without reflection.
I'm still in the process of trying to get it to work.
But I will have to reimplement some stuff and use reflection