Creating characters from HTML characters in FPDF

I have a government client who requires a legal section symbol (& sect;) in their documents. When creating documents on a web page, this symbol is created with § or § .

I cannot figure out how to get any of them to work in a PDF document created using FPDF. I tried the iconv and utf8_decode methods, but none of them worked. Any ideas?

+4
source share
2 answers

You are looking for html_entity_decode() .

+7
source

There is an easier way to do this:

You can create a section symbol using FPDF using the ascii: chr(167) code.

Good practice to make it permanent. At the top of your script add:

 define('SECTION',chr(167)); 

Now you can use SECTION in your script to print the euro symbol. For instance:

 echo SECTION.'1.1'; 

Β§1.1 : Β§1.1

Note. This will also work for other characters with chr(ascii) , where ascii is the character of the ascii character. You can find an overview of ascii codes on this page: http://www.atwebresults.com/ascii-codes.php?type=2

+2
source

Source: https://habr.com/ru/post/1389073/


All Articles