This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert Excel to PDF. Help please!

 
Yan Hu
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there:
I need to write some code to convert an Excel file to a PDF file. I googled it for 2 days. I could not find an open source java lib that can directly do that. I am thinking about using POI to read the Excel file and then use IText to write the contents out as a PDF. Does anyone have experience with this kind of conversion? Is there any better lib or solutions? Thanks in advance.
 
Paul Clapham
Sheriff
Posts: 21133
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds like a good start. I don't think you will find any products because there are too many mismatches between the Excel and PDF models to do anything standard. PDF has pages but Excel doesn't. Excel is mainly concerned with rows and columns but PDF isn't. So it's basically up to you to decide how to map from one to the other, and to write code accordingly.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to second what Paul said - there is no general solution. POI or jExcelAPI are your principal ways of reading an XLS file, and iText or PDFBox are the principal ways to generate a PDF.
 
Yan Hu
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys. Now I am testing it using POI and Itext
 
Lorenz Baylon
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah i believe iText and PDFBox are good tools to create a pdf file By the way, how about parsing a PDF file, got any suggestions? Thanks.
 
Joe Ess
Bartender
Posts: 9300
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yan, have a look at OpenOffice.org. It reads Excel files and can export as PDF. I'm using it to translate Word docs to HTML and PDF. You control the application through a network object protocol. The API is non-trivial, but there's plenty of examples in the api documentation and forums.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lhorenz baylon wrote:
how about parsing a PDF file


The Accessing File Formats FAQ -linked in my signature- has some pointers on this.
 
Yan Hu
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys.
 
Lorenz Baylon
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks ulf! juz wanna take the oppotunity, is there a particular java class or jar that would enable extracting of images from a pdf file? thanks
 
Jonathan Hurl
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey im also still looking for this
A friend of mine showed me some page, think it was http://exceltopdf.org/ but I keep getting an error message when opening the pdf i created...
Is someone currently using a site or program of which they know it works well?
thank you
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lorenz

Pdfbox will do that for you although it depends on the image type I believe:

http://pdfbox.apache.org/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic