Converting .xls to .pdf using Java(or not)

2019-05-11 06:36发布

问题:

Is there a way to convert a xls file into a pdf?

I want to make a dynamical report directly to pdf file, but didn't find a way to make dynamic columns on iReport, so I've made a method on Java that exports to xls dynamically.

So I was wondering if is there a way to convert this file to pdf, but it need to be on a method from my code. Or if you have a better idea, it can be used too.

Maybe there's a way to make this pdf file from my code as I did with xls. Please help me out.

Thanks.

回答1:

Try using iText http://itextpdf.com/ - I've used it to create PDFs with columnar structure.



回答2:

In addition to using iText directly, there are a couple report engines that sit on top of it:

  • Eclipse BIRT (using 2.1.7, the last MPL/LGPL version)
  • Jasper Reports (which uses a Very Old version, 1.3.1 IIRC)


回答3:

This is a commercial solution:

http://www.dancrintea.ro/xls-to-pdf/

If you want open source try jakarta POI.



回答4:

Try using the Muhimbi PDF Converter Services. It comes with a Java compatible Web Services based interface and sample code. It does other things as well.

I worked on this application, so the usual disclaimer applies.