Open bmihelac opened 9 years ago
I do not think that hyphenation is supported in pdfmake. It would wrap if your text is Column Column Column Column Column Column Column.
On 17 April 2015 at 12:18, Bojan Mihelac notifications@github.com wrote:
Currently pdfmake wrap content if it does not fit in given cell and if text cannot be wrapped it is diplay and overflows outside of bounds.
Is it possible to hide overflow content?
Example:
var dd = { content: [ { table: { widths: [50], body: [ [{text: 'ColumnColumnColumnColumnColumnColumnColumn'}] ] } }, ],
}
— Reply to this email directly or view it on GitHub https://github.com/bpampuch/pdfmake/issues/264.
@Wabbala I do not want to hyphenate word, I want to cut excessive text that does not fit specified width of cell.
That's currently not supported in pdfmake.
Happy to accept a pull request. Let me know when you need help for it. Am 17.04.2015 14:49 schrieb "Bojan Mihelac" notifications@github.com:
@Wabbala https://github.com/Wabbala I do not want to hyphenate word, I want to cut excessive text that does not fit specified width of cell.
— Reply to this email directly or view it on GitHub https://github.com/bpampuch/pdfmake/issues/264#issuecomment-93979409.
Ok thanks for answer, I will try to make PR for this.
Looking at pdfkit documentation under Text styling there are two options that should be of interest for implementing this option:
I guess we should add width and height options to styling. Am I on the right path?
No, we're not using the pdfkit text
method for writing text. See https://github.com/bpampuch/pdfmake/blob/master/src/printer.js#L257.
Have a look at https://github.com/bpampuch/pdfmake/blob/master/src/layoutBuilder.js and https://github.com/bpampuch/pdfmake/blob/master/src/tableProcessor.js.
Detect, when a line will be to long (you can before you are in the printer) and react to it.
Pull request allows setting of maxHeight
. It works in with text object so it can be used in columns and tables as well.
This is not exactly what I was asking for but still can be usable.
Example input:
var dd = {
content: [
{
text: 'Max one line - Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines',
maxHeight: 15,
marginBottom: 15
},
{
text: 'Max two lines - Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines',
maxHeight: 30,
}
]
}
Result:
Here's my solution at #1733 for this that doesn't use the maxHeight
property.
It measures the text width and truncates with ellipses as necessary.
Currently pdfmake wrap content if it does not fit in given cell and if text cannot be wrapped it is diplay and overflows outside of bounds.
Is it possible to hide overflow content?
Example:
Result:
Wished:
This is not same as #204 as I would like etxt not to be wrapped but cut.