Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:36:28+00:00 2026-06-14T13:36:28+00:00

I am using flying saucer with iText 2.1.7 for converting html to pdf .

  • 0

I am using flying saucer with iText 2.1.7 for converting html to pdf. It works fine, but the problem occurs when there are some chinese, korean, etc characters in the html.

I get unexpected characters in my PDF instead of the normal chinese characters

I found this issue opened, so I assume there is currently no way of making flying saucer into rendering the PDF correctly?

PS: I also found this issue, but I can’t understand the solution they have provided.

This is the code that I am using

String doc = file.toURI().toURL().toString();
ITextRenderer renderer = new ITextRenderer();
renderer.getFontResolver().addFont (
    "C:\\ARIALUNI.TTF",
     BaseFont.IDENTITY_H,
     BaseFont.EMBEDDED
);
renderer.setDocument(doc);
String outputFile = "report.pdf";
OutputStream os = new FileOutputStream(outputFile);

renderer.layout();
renderer.createPDF(os);
os.flush();
os.close();

Where file is the html which I am trying to convert.

Is there some other way or library to do the same?

This is the css that i am using

@font-face {
  font-family: "Arial";
  src: url("media/arialuni.ttf");
 -fs-pdf-font-embed: embed;
 -fs-pdf-font-encoding: Identity-H; 
}

The HTML file that I need to convert

These are the re-compiled flying saucer jar compatible with itext 2.1..x

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:36:29+00:00Added an answer on June 14, 2026 at 1:36 pm

    Your font is probably not embedded in the PDF file. ( How do I know if the fonts in a PDF file are embedded or not? )

    Every font has a name, ARIALUNI.TTF defines Arial Unicode MS, you should use that.

    So change this:

    @font-face {
        font-family: Arial1;
        src: url("arialuni.ttf");
        -fs-pdf-font-embed: embed;
        -fs-pdf-font-encoding: Identity-H;
    }
    
    * {
            font-family: Arial1;
    }
    

    To this:

    @font-face {
        font-family: Arial Unicode MS;
        src: url("arialuni.ttf");
        -fs-pdf-font-embed: embed;
        -fs-pdf-font-encoding: Identity-H;
    }
    
    * {
            font-family: Arial Unicode MS;
    }
    

    This way the font will be embedded.

    And you don’t need to call renderer.getFontResolver().addFont, the css is enough.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a PDF using Flying Saucer (which dumps out CSS/HTML to iText to
I am using Flying Saucer to render some PDF documents from strings to HTML.
I'm using xhtmlrenderer (Also known as Flying Saucer) with iText to convert HTML to
I'm trying to convert strict XHTML to PDF using flying saucer and iText. I've
I'm using flying saucer xhtmlrenderer for building pdf documents. Everything worked fine until now
I'm compiling a PDF using iText and Flying Saucer, and unfortunately, I can't seem
I am doing conversion from XHTML to PDF using flying saucer, it works perfectly
I recently start using flying-saucer library to generate a pdf from html web page.
I am using Flying Saucer to generate pdf from webpages . I came across
I'm using the flying-saucer library to generate a PDF in a servlet that then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.