Table position issue while convert to PDF (xdocreport)

1.6k Views Asked by At

I am using xdocreport for templating and converting docx to PDF. In my docx template I have an image, text paragraph and table (they are placed in this order). When I try to convert this file to PDF the result file have another structure - table, image, text paragraph. This is my code:

    InputStream is = new FileInputStream(CustomTemplate.TEMPLATES_PATH + template.getTemplatePathName());
    IXDocReport report;
    report = XDocReportRegistry.getRegistry().loadReport(is,TemplateEngineKind.Velocity);
    IContext context = report.createContext();

    FieldsMetadata metadata = new FieldsMetadata();
    metadata.addFieldAsImage("signature");
    metadata.addFieldAsImage("logo");
    report.setFieldsMetadata(metadata);

    processPredefinedParams(context, templateParams, user);
    processUserProvidedParams(context, templateParams);

    Options options = Options.getTo(ConverterTypeTo.PDF);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    report.convert(context, options, out);  

For converting to PDF I am using docx4j converter. How can I resolve this issue?

0

There are 0 best solutions below