Opening a PDF file in a Java Application
PDF is a very common used file format for documents so quite often you need to develop applications that work with them. In Java it's fairly easy to open a PDF document using the runtime executer. Below you find a code snippet that does the job.
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file);
This peace of code let's Windows deside what application to use to open the PDF file which is quite cool since most of the time you don't know what application users use to open PDF files. :-)
Comments
Post a Comment