Forums Register Login

Java API to convert from Excel to PDF?

+Pie Number of slices to send: Send
I need a Java API where I can feed an existing Excel spreadsheet file to a method and have it create a PDF version. The Excel was generated using POI.

I looked at a few commercial API's., most notable Adobe. But Adobe appears to use a Session Bean, which I cannot use since no EJB server is available in my environment. I need a plain POJO implementation, not calling any outside service.

I also looked at iText. They talk about converting from PDF to Excel, but not the other way around. Maybe it does, but I can�t find any reference to it.

Any ideas?
+Pie Number of slices to send: Send
I don't know of any library that does this, apart from OpenOffice - it can open XLS files, create PDF files, and has a Java API that you could use to drive this process. That has a steep learning curve, though.

I'd probably create the PDF at the same as the XLS file, using the iText API. Or, if it's not feasible to do it at the same time, use POI to open it later, and then use iText to create the PDF.

(By the way, can you point to where the iText docs talk about PDF-to-XLS conversion? I'd be interested in that.)
+Pie Number of slices to send: Send
I saw it on a forum, but now I can't find it. But I do remember people suggesting using Apache POI rather than iText to generate Excel.
+Pie Number of slices to send: Send
Ah, OK. I've used iText extensively, and have never encountered anything that suggests it might be useful for creating XLS files.
+Pie Number of slices to send: Send
a team in my comp is using this on a project:

import officetools.OfficeFile;
...
FileInputStream fis = new FileInputStream(new File("test.xls"));
FileOutputStream fos = new FileOutputStream(new File("test.pdf"));
OfficeFile f = new OfficeFile(fis,"localhost","8100", true);
f.convert(fos,"pdf");

All possible convertions:
xls --> pdf, html, csv
doc --> pdf, html, txt, rtf
ppt --> pdf, swf
html --> pdf
+Pie Number of slices to send: Send
Also check out the JODConverter library (which uses OpenOffice behind the scenes).
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 22758 times.
Similar Threads
Print a document using java API
Need a Java API for Export to PDF
Need a Java API for Export to PDF
How to Convert word to pdf using java api ??
TIFF. DOC, EXCEL to PDF Converter
Accessing File Formats
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:00:13.