Page 1 of 1

PdfSettings parameter

PostPosted: Sun Sep 11, 2011 8:00 pm
by jason
tosswang wrote:
By the way,the method output of org.docx4j.convert.out.pdf.PdfConversion is added a parameter,How should I set this parameter?


This was a contribution from Alberto, introduced in http://www.docx4java.org/trac/docx4j/changeset/1631 - which as per the commit message is about flexibility in how images are handled during conversion.

As per the CreatePdf sample, you can just pass a new PdfSettings() object (or null).

Code: Select all
         org.docx4j.convert.out.pdf.PdfConversion c
            = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage);
         
         OutputStream os = new java.io.FileOutputStream(inputfilepath + ".pdf");         
         c.output(os, new PdfSettings() );


If you look at PdfSettings, you'll see that right now it just implements AbstractConversionSettings.

If you haven't setImageHandler yourself explicitly, viaXSLFO/Conversion will set PdfSettings up with a new PDFConversionImageHandler, so things should just work.