opensagres / xdocreport

XDocReport means XML Document reporting. It's Java API to merge XML document created with MS Office (docx) or OpenOffice (odt), LibreOffice (odt) with a Java model to generate report and convert it if you need to another format (PDF, XHTML...).
https://github.com/opensagres/xdocreport
1.23k stars 373 forks source link

DOCX to PDF via xwpf problems #241

Open valex128 opened 7 years ago

valex128 commented 7 years ago

There are found few problems with docx conversation. All issues putted into one sample docx, and when it convert to pdf.

You can found it on google folder: https://drive.google.com/drive/folders/0B8lh2rOFt1iYT0tNMkExLWl6ZWc?usp=sharing

valex128 commented 7 years ago

Using next java-code for converting:

DocumentKind documentKind;

    switch (mimeType) {
        case ODF: {
            documentKind = DocumentKind.ODT;
            break;
        }
        case XWPF: {
            documentKind = DocumentKind.DOCX;
            break;
        }
        default:
            throw new RuntimeException("Unsupported mimetype");
    }
    Options options = Options.getFrom(documentKind).to(ConverterTypeTo.PDF);
    IConverter converter = ConverterRegistry.getRegistry().getConverter(options);
    converter.convert(documentStream, pdfStream, options);

with configuration in pom.xml

fr.opensagres.xdocreport
        <artifactId>fr.opensagres.xdocreport.converter.docx.xwpf</artifactId>
        <version>1.0.6</version>