954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Looking for API (java) to convert .doc into .pdf

Hi,

I'm looking for an java api which can convert .doc file into .pdf file... i need this solution to work without any intervention of MS Office/Windows.


If anyone have any idea about such api , please reply.

Thanks ahead

Daniel

vedmack
Junior Poster in Training
59 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

Davisor Publisher is a Java API that can convert from a DOC, PPT or PDF to PDF, XHTML, PNG, JPEG, TXT or XML formats. I haven't actually used it before but it seems to be a good one.

darkagn
Veteran Poster
1,197 posts since Aug 2007
Reputation Points: 404
Solved Threads: 200
 

Thx darkagn!

gonna check it it

vedmack
Junior Poster in Training
59 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

Another solution:

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

All possible convertions:
html --> pdf
doc --> pdf, html, txt, rtf
xls --> pdf, html, csv
ppt --> pdf, swf
from dancrintea.ro/html-to-pdf/

bertt
Newbie Poster
1 post since Jan 2009
Reputation Points: 9
Solved Threads: 1
 

iText is a free, open source Java to PDF converter and it offers much more.

verruckt24
Posting Shark
952 posts since Nov 2008
Reputation Points: 485
Solved Threads: 89
 

Verruckt24, I guess the O.P. by now must have already figured out how to accomplish this task.
"bertt" is the culprit who revived this thread older than almost 6 months and whats worse he doesn't even provide a decent answer, let alone use code tags or anything else.

stephen84s
Nearly a Posting Virtuoso
1,443 posts since Jul 2007
Reputation Points: 668
Solved Threads: 154
 

I did not look into iText for last 2 years. Did they extend the scope of documents that can be converted? As far I can remember it was only images gif, png, bmp, tiff, wmf and jpeg (there was problem with JPEG2000 - type of grey colour), html, txt, rtf, xml. Are you sure you can convert office formats like doc, ppt or xls to pdf?

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 
Verruckt24, I guess the O.P. by now must have already figured out how to accomplish this task. "bertt" is the culprit who revived this thread older than almost 6 months and whats worse he doesn't even provide a decent answer, let alone use code tags or anything else.

Yes you are correct, I don't how but the post date somehow skipped my attention here.

verruckt24
Posting Shark
952 posts since Nov 2008
Reputation Points: 485
Solved Threads: 89
 

Actually to convert from .doc to .pdf via Java I could not find a direct method, But I found a two step process,
Access your Microsoft Format files using Apache POI , You can read more about it here .
Next use iText to convert the data you have into a PDF.

stephen84s
Nearly a Posting Virtuoso
1,443 posts since Jul 2007
Reputation Points: 668
Solved Threads: 154
 

I tried the convertion method that bertt's described . bt I can't get the jar that contain the ' import officetools.OfficeFile' can any one please suggest a method to convert HTML to PDF

salinidinesh
Newbie Poster
3 posts since Feb 2009
Reputation Points: 10
Solved Threads: 1
 
I tried the convertion method that bertt's described . bt I can't get the jar that contain the ' import officetools.OfficeFile' can any one please suggest a method to convert HTML to PDF


Thats the reason why his post has received a Bad Rep (RED Mark) and my post which was the actual answer received a Good Rep (Green Mark) if you had cared to observe.

stephen84s
Nearly a Posting Virtuoso
1,443 posts since Jul 2007
Reputation Points: 668
Solved Threads: 154
 

Can anyone please help me ?????

I want to convert HTML to PDF using java code.... please give me a solution.......

salinidinesh
Newbie Poster
3 posts since Feb 2009
Reputation Points: 10
Solved Threads: 1
 

Whats wrong with you the answer has already been given here

verruckt24
Posting Shark
952 posts since Nov 2008
Reputation Points: 485
Solved Threads: 89
 

i don't want to use iTex ... most of the methods described above are not working :(

salinidinesh
Newbie Poster
3 posts since Feb 2009
Reputation Points: 10
Solved Threads: 1
 

Which methods ? Have you even cared to go through the iText library and the Apache POI ? They both are stable production quality libraries.
Do your homework before posting blindly.

verruckt24
Posting Shark
952 posts since Nov 2008
Reputation Points: 485
Solved Threads: 89
 
i don't want to use iTex ... most of the methods described above are not working :(


iText is working fine as long you know how to use it not like brett. iText tutorials , don't forget to download the library file and store it in your project folder

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

You can try JasperReports, but i think that´s for web develop only, anyway you can find something.

danielernesto
Newbie Poster
16 posts since Nov 2007
Reputation Points: 9
Solved Threads: 2
 

Hi,

Iam facing the same issue, have to convert any file come (e.g xls/doc/text...) into pdf for an urgent requrement. i have started with apache poi and itext but succeed. can you please help me with sample code that have both apache POI and itext used say for eample reading an excel and converting it into pdf. please hurry ....


Thanks,
Rajni

Rajni05
Newbie Poster
6 posts since Mar 2009
Reputation Points: 10
Solved Threads: 1
 
Actually to convert from .doc to .pdf via Java I could not find a direct method, But I found a two step process,
  • Access your Microsoft Format files using Apache POI , You can read more about it here .
  • Next use iText to convert the data you have into a PDF.


Hi,

Iam facing the same issue, have to convert any file come (e.g xls/doc/text...) into pdf for an urgent requrement. i have started with apache poi and itext but didnt succeed. can you please help me with sample code that have both apache POI and itext used say for eample reading an excel and converting it into pdf. please hurry ....


Thanks,
Rajni

Rajni05
Newbie Poster
6 posts since Mar 2009
Reputation Points: 10
Solved Threads: 1
 
can you please help me with sample code that have both apache POI and itext used say for eample reading an excel and converting it into pdf. please hurry ....

Yeah before that transfer a million dollars to my account !!!

stephen84s
Nearly a Posting Virtuoso
1,443 posts since Jul 2007
Reputation Points: 668
Solved Threads: 154
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You