poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <apa...@gagravarr.org>
Subject Re: Apache POI XWPFDocument to Pdf format
Date Sun, 08 Jun 2014 22:57:13 GMT
On Mon, 9 Jun 2014, Peter Margetiak wrote:
> // 1) Load DOCX into XWPFDocument
> InputStreamin=newFileInputStream(newFile("HelloWord.docx"));
> XWPFDocumentdocument =newXWPFDocument(in);

You're better off loading from the File directly, it's lower memory than 
going via an input stream

> // 2) Prepare Pdf options
> PdfOptionsoptions =PdfOptions.create().fontEncoding("windows-1250");
>
> // 3) Convert XWPFDocument to Pdf
> OutputStreamout=newFileOutputStream(newFile("HelloWord.pdf"));
> PdfConverter.getInstance().convert(document,out,options);

None of these classes come from Apache POI, so I'm minded to blame one of 
those...

> Interesting is that on my Windows8 jdk7 it works without any problem - 
> PDF is OK. On my Ubuntu server oracle sun jdk7, it skip some characters 
> and the results seems like: Aáäbcdeéfghiíjklmnoóôpqrsštuúvwxyýzž

If you ditch all the XPWF bits, and just do it with plain text, does that 
work? My hunch is it's either a bug in the pdf library you're using, or 
you're missing some key fonts on your linux box

Nick

Mime
View raw message