As an example, look at ODA Online File Converter, which is a Oracle® Java® application that converts a .dwg file to a .pdf file and displays a preview on a web page. The source files of the converter are available for downloading at the same location.