chresben
chresben

Reputation: 17

PDFlib create_textflow --> Unknown option

when I want to create a textflow with the sign "<" in the text I got an error:

$text = 'my test < text<nextline>and a new line';

$tf = PDF_create_textflow($pdf, $text, "fontname=Helvetica encoding=winansi fontsize=11 escapesequence=true fillcolor=black");

PDF_fit_textflow($pdf, $tf, 160, 110, 550, 50, ' minfontsize=8 fitmethod=auto');

Fatal error: Uncaught exception 'PDFlibException' with message 'Unknown option 'text

some ideas?

I already test some escapes without success =(

pdflib full version

Upvotes: 0

Views: 1235

Answers (2)

Przemek
Przemek

Reputation: 1

I just have similar issue and imo the best solution is to set -> begoptlistchar=none. It turns off inline optlist and you don't need to search for other character to redefine or replace < to lt; etc.

Regards

Upvotes: 0

Rainer
Rainer

Reputation: 2185

$text = 'my test < text<nextline>and a new line';

the < is the starting character for an inline option. (as you do exactly in the next word with the option "nextline".)

There are in general two strategies to solve this:

  • The most simple way, is to apply the < as a character reference &lt;. PDFlib will interpreter character references, when you set the option charref=true.
  • you can redefine the option list begin character with the option begoptlistcharto a character which is not used in your text.

This is all described in detail within the PDFlib 9 Tutorial, chapter 9.2.3 "Inline Option Lists and Macros"

I would recommend the first one.

Upvotes: 2

Related Questions