pdfmake icon indicating copy to clipboard operation
pdfmake copied to clipboard

is there any way to determine text metrics (text size)

Open dave-watts opened this issue 11 years ago • 3 comments

I am not sure with the declarative approach it is possible to calculate the size of elements such as text and table sizes (using * width), this in effect means (for instance) that your table can run off the pdf page with dynamic data or on changing paper size. Of course you can always fix the pdf size and look at the table in the created pdf, if too big reduce font sizes, if too small increase them or do padding then go back and change everything so they fit nicely in this particular case (but they why do programming?). If you had text metrics you could know the size of the cells and re-adjust as necessary based on content and paper size.

Cheers

Dave

dave-watts avatar Aug 19 '14 08:08 dave-watts

Maybe a possible declarative approach would just be in the case of cells with fixed width and height to re-size the font of the text to fit within the space (including any padding), same goes for other elements such as nested tables, images etc.

dave-watts avatar Aug 19 '14 08:08 dave-watts

pdfmake 0.2.0 will let you build custom plugins and will expose this functionality

bpampuch avatar Oct 20 '14 14:10 bpampuch

Has this issue been resolved? I've checked the latest version (0.2) and couldn't find any mention of plugins or functionality related to this issue.

In particular, I'm having trouble implementing boxed text. It's unclear whether this limitation is due to the PDF rendering engine. However, based on my research and the discussions I've come across, this seems to be a common pain point for many users.

One feature that seems to be missing is the ability to replicate CSS-like behaviour, such as padding. Adding such functionality would greatly increase the flexibility of the library and address a key usability gap.

suiramdev avatar Dec 16 '24 10:12 suiramdev

+1

cgimenes avatar Apr 17 '25 12:04 cgimenes