Check out the JODConverter library (which uses OpenOffice in server mode to perform document format conversions). Or, if you want to code this yourself, you can use Apache POI to read Doc/Docx files and iText to create PDF files.
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
a bit of art, as a gift, the permaculture playing cards