Results 1 to 12 of 12

Thread: Java API to convert Microsoft Word to PDF

  1. #1
    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?

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    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.

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    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.

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    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.

  5. #5
    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 ...

  6. #6
    Join Date
    Apr 2008
    Posts
    2,005

    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?

  7. #7
    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

  8. #8
    nodexpert Guest

    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

  9. #9
    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

  10. #10
    PDFSusan Guest

    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.

  11. #11

    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 .

  12. #12
    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.

Similar Threads

  1. Unable to convert Word docx To PDF in Microsoft office 2010
    By Khongordzol in forum Windows Software
    Replies: 5
    Last Post: 31-08-2011, 10:17 AM
  2. Replies: 3
    Last Post: 14-05-2011, 08:28 PM
  3. Not able to convert Microsoft word with Acrobat Pro 9
    By Jarini in forum Windows Software
    Replies: 6
    Last Post: 23-04-2011, 01:33 AM
  4. How to convert the digit into word in Java?
    By Harper 21 in forum Software Development
    Replies: 5
    Last Post: 14-01-2010, 08:58 AM
  5. Replies: 3
    Last Post: 17-11-2009, 09:22 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,671,867.46403 seconds with 17 queries