Search in sources :

Example 1 with PdfSettings

use of org.docx4j.convert.out.pdf.viaXSLFO.PdfSettings in project mdw-designer by CenturyLinkCloud.

the class DocxBuilder method toPdf.

public byte[] toPdf() throws Exception {
    Mapper fontMapper = new IdentityPlusMapper();
    wordMLPackage.setFontMapper(fontMapper);
    org.docx4j.convert.out.pdf.PdfConversion c = // = new org.docx4j.convert.out.pdf.viaHTML.Conversion(wordMLPackage);
    new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage);
    // = new org.docx4j.convert.out.pdf.viaIText.Conversion(wordMLPackage);
    // PdfConversion writes to an output stream
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    c.output(os, new PdfSettings());
    return os.toByteArray();
}
Also used : Mapper(org.docx4j.fonts.Mapper) IdentityPlusMapper(org.docx4j.fonts.IdentityPlusMapper) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IdentityPlusMapper(org.docx4j.fonts.IdentityPlusMapper) PdfSettings(org.docx4j.convert.out.pdf.viaXSLFO.PdfSettings)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PdfSettings (org.docx4j.convert.out.pdf.viaXSLFO.PdfSettings)1 IdentityPlusMapper (org.docx4j.fonts.IdentityPlusMapper)1 Mapper (org.docx4j.fonts.Mapper)1