How to render certain HTML entities (such as arrows) in PDF?

Is there an alternative way to render arrows in text?

24th October 2015
admin-marketing

I tried to render ⇒ ⇔ € © → from HTML to PDF with the XMLWorker and iText. Only the copyright and euro symbol appear in the PDF. I used the default font and Arial but without success. Is there a way to get those entities rendered? Is there an alternative way to render arrows in text?

Posted on StackOverflow on Mar 18, 2015 by Code Clown

As you can see in the ParseHtml3 example, it works for me:

Screen shot showing special entities rendered in PDF

Screen shot showing special entities rendered in PDF

This is my code to create the PDF:

public void createPdf(String file) throws IOException, DocumentException {
    // step 1
    Document document = new Document();
    // step 2
    PdfWriter writer =
        PdfWriter.getInstance(document, new FileOutputStream(file));
    // step 3
    document.open();
    // step 4
    String str = "" +
        """ +

Share this article

Contact

Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now