aspose file tools*
The moose likes I/O and Streams and the fly likes Convert Excel to PDF. Help please! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Convert Excel to PDF. Help please! " Watch "Convert Excel to PDF. Help please! " New topic
Author

Convert Excel to PDF. Help please!

Yan Hu
Greenhorn

Joined: Sep 07, 2004
Posts: 19
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.


Programming is an art<br />Yan Hu
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18659
    
    8

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
Marshal

Joined: Mar 22, 2005
Posts: 42285
    
  64
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.


Ping & DNS - my free Android networking tools app
Yan Hu
Greenhorn

Joined: Sep 07, 2004
Posts: 19
Thank you guys. Now I am testing it using POI and Itext
Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
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.


I just cant look, its killing me.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42285
    
  64
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

Joined: Sep 07, 2004
Posts: 19
Thank you guys.
Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
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

Joined: Oct 02, 2013
Posts: 2
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

Joined: Nov 09, 2011
Posts: 1030
    
    5

Lorenz

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

http://pdfbox.apache.org/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert Excel to PDF. Help please!