cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Looking for java code to convert word files to pdf

Former Member
0 Likes
1,895

Hello,

I am looking for a way to convert word files to pdf using Java. I am familiar with the jakarta POI project but unfortunally it doesn't contain this option. Does anyone have a sample code to do that?

Roy

View Entire Topic
Former Member
0 Likes

This solution may not be appropriate but if you have either Adobe or one of several PDF generating libraries installed then they work as a printer driver. You can start word and via its automation interface have it print the document using the PDF printer driver. This will give you a PDF file.

Former Member
0 Likes

Hey Chris,

Can you please elaborate this?

Roy

detlev_beutner
Active Contributor
0 Likes

Hi Roy, hi Chris,

this is somewhat the mechanism I thought of using StarOffice (using StarOffice and not Word, for having the Java API at hand, even if - already said - the API for accessing such internals is all but intuitive).

So the aim would be to (programatically) "press" the "print" button / PDF Generator button (or, that's the StarOffice-thought, to simulate all this).

Also "printing" as PostScript into a certain subdir would do it if Adobe Acrobat is fully installed (and watching this directory); then Acrobat will convert the PS into PDF on the fly.

Hope it helps

Detlev