Scaling preformatted text to fit the page width
Posted: Fri Feb 04, 2022 7:56 pm
Hi everyone,
We sometimes run into problems when we have wide text content in our <pre> elements, such as columnar reports from a software program:
Sometimes we are able to manually edit the output in a text editor to remove whitespace width or shorten names; but sometimes that isn't enough.
We also have an @outputclass value of smallfonts that applies CSS to reduce the font size by 1pt, and a value of wide that applies CSS to move the left margin leftward.
But sometimes, even manual editing, plus smallfonts, plus wide aren't enough. (This typically occurs with tabular reports in which every column is significant to the example.)
I thought about implementing additional @outputclass values (smallerfonts? smallestfonts??) to reduce the font size even more. But that is granular by construction, and it's a bit hacky and company-specific.
Does PDF Chemistry have some magic way to scale a <pre> to precisely as small as it needs to be to fit the available width? Then we could just apply @outputclass="wide" plus this additional magic property, let the text scale into that, and call it good.
Thanks!
We sometimes run into problems when we have wide text content in our <pre> elements, such as columnar reports from a software program:
Code: Select all
prompt> report_something -wide
Name Status Configuration Options Attributes
----------------------------------------------------------------------------------------------------------
some_hierarchical_path/lower_level_path/object_1 valid foo=1, bar=2 -something x, y, z
some_hierarchical_path/lower_level_path/object_2 invalid foo=3, baz=4 -nothing q, r, s
We also have an @outputclass value of smallfonts that applies CSS to reduce the font size by 1pt, and a value of wide that applies CSS to move the left margin leftward.
But sometimes, even manual editing, plus smallfonts, plus wide aren't enough. (This typically occurs with tabular reports in which every column is significant to the example.)
I thought about implementing additional @outputclass values (smallerfonts? smallestfonts??) to reduce the font size even more. But that is granular by construction, and it's a bit hacky and company-specific.
Does PDF Chemistry have some magic way to scale a <pre> to precisely as small as it needs to be to fit the available width? Then we could just apply @outputclass="wide" plus this additional magic property, let the text scale into that, and call it good.
Thanks!