Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

294
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda