• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java API to convert from Excel to PDF?

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.)
 
M Burke
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, OK. I've used iText extensively, and have never encountered anything that suggests it might be useful for creating XLS files.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also check out the JODConverter library (which uses OpenOffice behind the scenes).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic