Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

293
Views
How to convert a MS Word doc containing UTF-8 characters to PDF with Apache POI?

For some reason I cannot get the PdfConverter from Apache POI to convert my MS Word document properly on a Linux machine. On Windows and MacOS it seems to work fine but whenever I try it on a Linux machine it basically doesn't convert the UTF-8 characters. I also tried to configure the fontEncoding option which can be passed to the PdfConverter but that doesn't seem to help.

final InputStream in = new FileInputStream(new File("src/test/resources/SOMEDOC.docx"));
final XWPFDocument document = new XWPFDocument(in);
final OutputStream out = new FileOutputStream(new File("target/test.pdf"));
final PdfOptions options = PdfOptions.getDefault();
// This actually breaks the whole conversion. No text will be displayed if you set this font encoding option to UTF-8
options.fontEncoding("UTF-8");
PdfConverter.getInstance().convert(document, out, options);

Does anybody know what I am doing wrong here?

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!