The moose likes Servlets and the fly likes Creating PDFs in a web app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Creating PDFs in a web app" Watch "Creating PDFs in a web app" New topic

Creating PDFs in a web app

Rod Nichols

Joined: Apr 19, 2001
Posts: 23
Hello, we have a web app here that creates letters for printing. The wording of the letters is the same except for the addresses and names of the recepients. Now my user wants me to generate mailing labels to go with the letters. These letters are created using the org.faceless.pdf package. Several letters are created at one time and all are put into one PDF for printing. The mailing labels that I need to create will be printed on mailing labels that peel and stick. I can save the addresses to an ArrayList as I am creating the letters but I am wondering if it is possible to create two seperate pdf files, one for the letters and one for the labels ? I am not sure I can do that as you can send the response only once.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Yes, you are correct, you can only send one file as the response. That means you would need one request for the letters and a second request for the labels.

You're going to want it done that way anyway, aren't you? The user is going to have to fiddle with the printer, i.e. take out the plain paper and put in the labels, between receiving the two documents.
Rod Nichols

Joined: Apr 19, 2001
Posts: 23
Paul, thanks for responding, yes you are right they will have to change out the paper. If I could create two files, they could print the letter file, then change out the paper and print the labels file. So since two files to the response won't work, I will either have them create and print the letters or create and print the labels. The other option would be to put the labels in the same file as the letters and then have the file tell the printer that the paper needs to be changed when it gets to the labels. But I don't think that is possible. Anyway thanks again.
I agree. Here's the link:
subject: Creating PDFs in a web app
It's not a secret anymore!