I want to put a long textline, such as "ABCDEFGHIJKLMN", in a fixed-size box.
//already set fontname and fontsize
p.fit_textline("ABCDEFGHIJKLMN",100,500, "boxsize={50 20} fitmethod=clip showborder");
here's the result
[ABCDEFHG]
but i expect it like this
[ABCD...]
you can solve this with Textflow. A sample implementation is located in the PDFlib cookbook: https://www.pdflib.com/pdflib-cookbook/textflow/continue_note_after_text/
The trick is, that you leave at the end of the box a space with createlastindent={rightindent=" + textwidth + "}
. The space of the textwidth
is the length of the "...", which you can determine with p.info_textline()
before.