Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Topics

Recent Status Updates

View All Updates

Photo
- - - - -

Convert DOC or XLS to PDF

pdf

  • Please log in to reply
1 reply to this topic

#1 qwertino

qwertino

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 11 February 2009 - 05:35 AM

Currently my team came across a new and nice solution to convert MS files to PDF using Java. It uses a package called OfficeTools.
I think it can also help others. Code is very clean:

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", false);

f.convert(fos,"pdf");

You can obtain officetools.jar from this guy's website: dancrintea.ro/doc-to-pdf/

If you are using other solutions, it would be nice to share.
  • 0

#2 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 11 February 2009 - 08:23 AM

I normally use openoffice for that. Of course, I'm not sure what commandline arguments might be needed if I wanted to do batch processing.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/






Also tagged with one or more of these keywords: pdf

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download