Skip to content
Advertisement

How to offer download of local PDF file in Java?

I have JBoss running as application server and somewhere on my HD there is a PDF file, that gets created when the user clicks on a specific action. Let’s say the file is here: C:/PDF/doonot/10.07.2012/doonot.pdf. How can I offer this file as download? I already did it for a CSV file, but I don’t know how to do it with PDF.

Any help is much appreciated.

Advertisement

Answer

as i wrote on Is there a common way to download all types of files in jsp?

you can use something like this:

JavaScript

UPDATE:

Dont forget that you can use the InputStream as this:

JavaScript

or you can use it even like this

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement