Open stefanalt opened 3 years ago
When you say "without changing spacing", are you talking about the ASCII spaces between words? That is, you want to preserve spaces and not collapse them to single spaces? Would you treat a multispace gap as a word, or can it be split for word-wrap purposes? I can see it being useful to preserve spaces, but you have to be careful not to mess up the fitting of lines into a cell of given width. Compare this to HTML <pre>
, where a long line doesn't get wrapped at all.
Yes exactly. I do something like this: code.pdf. You can't see it, but tabs are converted to spaces.
In "code blocks" no space should change, as the space itself is information. If rendering reaches the right border of the cell it wraps overlong text to the next line (See testing memory in my example). One might think of an option that clips overlong lines at the right cell border. But if in doubt, better to look bad than to loose content!
OK, there are several requests here:
For tab expansion, would "tab stop every n-th column" be adequate? E.g., tabexp => 4
means tab stops at 4, 8, 12, etc.
not to forget:
I would prefer tabstop => 4
, but yes that's the right thing. My code currently has a fixed value of 8, I agree this is too limited.
BTW: I render my testreports with proportioal font to save column width. Even then handing tab is crucial.
OK, I think I understand what you're asking for. Into the hopper it goes...
I am in receipt of your codeblock patch and samples (thank you for your work). Let me think it over. I take it you want to do all these things (preserve spaces, tab expansion, word wrap, preserve line ends) as a unit and not separately. I might want to modify it a bit to allow these to be done separately. It looks like you might have been working with a slightly older version of the code (just some minor changes) -- I should be able to figure my way around the differences.
It's your playground ;-) If you come out with too manny single options, you might want to add a combo
codeblock =› 1
Something along these lines will need to be implemented anyway, so that PDF::API2 behaves the same as PDF::Builder. However, I expect to at some point have such capabilities in PDF::Builder itself (HTML markup), so it will become redundant then.
Hi,
for my PDF test report generator I need the ability to render table cells without changing spaceing. The same might be required if you want to render program code to a table cell.
I have implemtented a few simple changes to achieve this, which is sufficient for my purposes. If this feature is interesting for this project I'll be willing to polish it up and share it.
More details