Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Java API to convert Microsoft Word to PDF

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 25-10-2008
Member
 
Join Date: May 2008
Posts: 56
Java API to convert Microsoft Word to PDF
  

I have seen gazillions of messages about this subject, and have followed loads of links from Google to home pages for products that do just this -- for a price.

Is there no way to do this free? Currently we are using a combination of iText and JasperReports to generate PDFs but we also have a case where we have a whole bunch of already-generated Microsoft Word docs. What I would like to be able to do is emulate the Windows "Print to PDF" from my webapp -- create a PDF doc for every Word doc that is exactly the same, then save them as BLOBs in the DB.

The problems are 1) it has to work on a Linux box and 2) I would like to be able to do it for x documents all at once. So obviously, loading the Word doc, printing to a PDF file and uploading that file to the DB isn't gonna fly if the user has to do it 200 times.

Anyone ever did this without having to buy one of those gigantic and expensive professional reporting tools?

Reply With Quote
  #2  
Old 25-10-2008
Member
 
Join Date: Apr 2008
Posts: 1,999
Re: Java API to convert Microsoft Word to PDF

It is even difficult to get this for pay (at least for a non-trivial definition of "working") on Linux. And frankly said, I don't begrudge [sp?] any penny to a programmer who manages to correctly parse and decode any incarnation of the proprietary, badly (if at all) documented Word formats.

As fare as I understand it, the free Apache POI is not ready for handling Word. This leaves very few options.

If it doesn't have to be Java, you could try to use OpenOffice for batch processing (in listen mode). OpenOffice is good at importing Word documents, but not perfect. You could also try some of the other free word processors who do have Word import functions (AFAIR Abiword has one).

Maybe it is simpler to pay the Microsoft tax for a cheap PC with Windows, Word and some VB programmer who hacks some batch processing tool for you.
Reply With Quote
  #3  
Old 25-10-2008
Member
 
Join Date: Apr 2008
Posts: 1,946
Re: Java API to convert Microsoft Word to PDF

You may want to look at 'PDFCreator'.

I just downloaded it yesterday and works well. It creates PDF's from any Windows program. It installs its own printer driver for creating PDF's.

Use it like a printer in Word, StarCalc or any other Windows application.
Reply With Quote
  #4  
Old 25-10-2008
Member
 
Join Date: May 2008
Posts: 2,290
Re: Java API to convert Microsoft Word to PDF

Here's another pointer:

ActivePDF, the company that publishes commercially licensed ActiveX components for generating and manipulating PDF files, also publishes PrimoPDF, which allows you to "print to PDF" in much the same way and is free. You have nowhere near as much control over the output (understandably, since they want you to buy their ActiveX components), but it may be good enough for your purposes.
Reply With Quote
  #5  
Old 25-10-2008
Member
 
Join Date: May 2008
Posts: 56
Re: Java API to convert Microsoft Word to PDF

Thanks for all the responses.

Unfortunately, this has to work on Linux so I can't use any printer driver solution. Besides that, this is a J2EE web application, so what I need it to do is, when the user clicks a button a Struts Action is called that loads any number of Word docs from the database and converts them to PDF. So what I really need is an API, not a driver or a 3rd-party application.

I'll keep looking ...
Reply With Quote
  #6  
Old 25-10-2008
Member
 
Join Date: Apr 2008
Posts: 1,999
Re: Java API to convert Microsoft Word to PDF

Did you find any convertor? I have been searching for whole day.. apache POI - well still in infancy stage.. did you have any luck?
Reply With Quote
  #7  
Old 26-01-2009
ozz ozz is offline
Member
 
Join Date: Jan 2009
Posts: 1
idea Re: Java API to convert Microsoft Word to PDF

There is a converter that I have in a project:

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

All possible convertions:
doc --> pdf, html, txt, rtf
xls --> pdf, html, csv
ppt --> pdf, swf
html --> pdf
Reply With Quote
  #8  
Old 25-08-2010
nodexpert
 
Posts: n/a
Re: Java API to convert Microsoft Word to PDF

You can use JODConverter for this purpose. It can be used to convert documents between different office formats. such as:
  1. Microsoft Office to OpenDocument, and vice versa
  2. Any format to PDF
  3. And supports many more conversion as well
  4. It can also convert MS office 2007 documents to PDF as well with almost all formats

This solution works for Linux as well as for windows.

Last edited by Saket : 25-08-2010 at 02:22 PM. Reason: External link not allowed
Reply With Quote
  #9  
Old 29-09-2010
Member
 
Join Date: Sep 2010
Posts: 1
Re: Java API to convert Microsoft Word to PDF

Quote:
Originally Posted by ozz View Post
There is a converter that I have in a project:

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

All possible convertions:
doc --> pdf, html, txt, rtf
xls --> pdf, html, csv
ppt --> pdf, swf
html --> pdf
Hi all,

which converter did you use OZZ ?

Best regards,
dobberph
Reply With Quote
  #10  
Old 23-04-2011
PDFSusan
 
Posts: n/a
Re: Java API to convert Microsoft Word to PDF

jWordConvert, recently released, is a Java library that can read and render Word documents natively to
  • convert to PDF,
  • to convert to images,
  • or to print the documents automatically.
It runs on all platforms, and can convert without user intervention and without the need for any other software.
Reply With Quote
  #11  
Old 02-05-2011
Member
 
Join Date: May 2011
Posts: 1
Java API to convert Microsoft Word to PDF

Hey can any one send me officetools.jar file to my e mail address, , its very needfull for me...

bhoiwala.kinjal@gmail.com

Thnaks .
Reply With Quote
  #12  
Old 02-05-2011
Member
 
Join Date: May 2009
Posts: 1,611
Re: Java API to convert Microsoft Word to PDF

Quote:
Originally Posted by bhoiwala.kinjal@gmai View Post
Hey can any one send me officetools.jar file to my e mail address, , its very needfull for me...

mailing is little problem for me, but better download it from here.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Java API to convert Microsoft Word to PDF"
Thread Thread Starter Forum Replies Last Post
Unable to convert Word docx To PDF in Microsoft office 2010 Khongordzol Windows Software 5 31-08-2011 10:17 AM
Docx file is incompatible between Microsoft Word 2010 and Word 2007 Angee Windows Software 3 14-05-2011 08:28 PM
Not able to convert Microsoft word with Acrobat Pro 9 Jarini Windows Software 6 23-04-2011 01:33 AM
How to convert the digit into word in Java? Harper 21 Software Development 5 14-01-2010 07:58 AM
How to convert MS office word 2007 file MS office 2003 word? Anif Windows Software 3 17-11-2009 08:22 PM


All times are GMT +5.5. The time now is 11:16 AM.