To create such application, you need to have the adidasstansmithuomo.net file. If you download this example, you will get the example with jar file. Let's see the simple example of writing data into PDF using servlet. In this example, we have mentioned the content type application/pdf that must be specified to display data in the PDF . How to write data in PDF file format In this article we create an app that writes our data in PDF file format. We are writing some data in PDF using a servlet program and it will be displayed in the PDF file . Don't save the PDF to a file on the server, just send it back to the browser as the servlet's response. Basically, instead of that FileOutputStream, use the OutputStream that you get from calling getOutputStream() on your ServletResponse object.