OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Broken PDF after conversion with xdocreport

  • Thread starter Thread starter irina_sklv
  • Start date Start date
I

irina_sklv

Guest
I use the xdoc report library for converting files from docx to PDF. When I run appl on the local server, I get a fine result. When I run on a production server with a Linux shell output pdf is broken, it opened, but there is no text, but only pieces are present. pom:

Code:
   <dependency>
        <groupId>fr.opensagres.xdocreport</groupId>
       <artifactId>fr.opensagres.xdocreport.converter.docx.xwpf</artifactId>
        <version>1.0.6</version>            
    </dependency>
    <dependency>
        <groupId>fr.opensagres.xdocreport</groupId>
        <artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
        <version>1.0.6</version>
   </dependency>
        <dependency>
        <groupId>fr.opensagres.xdocreport</groupId>
        <artifactId>fr.opensagres.xdocreport.document.docx</artifactId>
        <version>1.0.6</version>
    </dependency>
  <dependency>
        <groupId>fr.opensagres.xdocreport</groupId>
        <artifactId>fr.opensagres.xdocreport.template.velocity</artifactId>
        <version>1.0.6</version>
  </dependency>
  <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itextpdf</artifactId>
        <version>5.4.2</version>
    </dependency>

Java code:

Code:
    InputStream in = new FileInputStream(getTemplatePath());
    IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in,
            TemplateEngineKind.Velocity);
    IContext context = report.createContext();
    FieldsMetadata metadata = report.createFieldsMetadata();

    fillContext(context, metadata, data);

    Options options = Options.getTo(ConverterTypeTo.PDF).via(
            ConverterTypeVia.XWPF);
    report.convert(context, options, stream);

    byte[] toByteArray = stream.toByteArray();
    return toByteArray;
}

Thanks for the advice
<p>I use the xdoc report library for converting files from docx to PDF. When I run appl on the local server, I get a fine result. When I run on a production server with a Linux shell output pdf is broken, it opened, but there is no text, but only pieces are present.
pom:</p>

<pre><code> <dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.converter.docx.xwpf</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document.docx</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.template.velocity</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.4.2</version>
</dependency>
</code></pre>

<p>Java code:</p>

<pre><code> InputStream in = new FileInputStream(getTemplatePath());
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in,
TemplateEngineKind.Velocity);
IContext context = report.createContext();
FieldsMetadata metadata = report.createFieldsMetadata();

fillContext(context, metadata, data);

Options options = Options.getTo(ConverterTypeTo.PDF).via(
ConverterTypeVia.XWPF);
report.convert(context, options, stream);

byte[] toByteArray = stream.toByteArray();
return toByteArray;
}
</code></pre>

<p>Thanks for the advice</p>
Continue reading...
 

Latest posts

Online statistics

Members online
0
Guests online
2
Total visitors
2
Ads by Eonads
Top