title: iTextPDF - Second PDF file generated displays text from First generated PDF file
body: <p>I am using iTextPDF to generate PDFs getting data from some text inputs. </p>
  
  <p>When I run the application and create first PDF, it is generated as expected. </p>
  
  <p>Then I change some values and generate another, this is where problem arises.  The last entry displayed on first PDF is printed on top of the first entry of the second generated PDF. </p>
  
  <p>Not sure why this is happening? Is it being saved to a buffer or something, not really sure.</p>
  
  <p>Here is the code for generating PDF:</p>
  
  <pre><code>  public class ExportTicket implements Action{
  
       PdfPCell titleCell = new PdfPCell();
       PdfPCell contentCell = new PdfPCell();
  
       public String performAction(HttpServletRequest request) throws PewException {
  
          // CREATING DOCUMENT (ITEXTPDF)
          Document document = new Document();
  
          PdfWriter.getInstance(document, new FileOutputStream("Ticket_" + ticketNo + ".pdf"));
  
          // Fonts
          Font headingFont = new Font(Font.FontFamily.UNDEFINED, 10, Font.BOLD, BaseColor.BLACK);
  
          // Open Document to Write
          document.open();
  
          // Table Creation
          PdfPTable table = new PdfPTable(2);
          table.setTotalWidth(200);
          table.setWidths(new int[]{ 5, 10 });
          table.setHorizontalAlignment(Element.ALIGN_LEFT);
  
          // Add Ticket Number
          contentCell.addElement(new Chunk("Ticket Number: " + ticketNo, headingFont));
          contentCell.setColspan(2);
          table.addCell(contentCell);
  
          // Add table to Document &amp; Close Document
          document.add(table)
          document.close();
        }
    }
  </code></pre>
  
  <p>Please see attached images for output, First one displays first file generation and second one displays 2nd File generation, </p>
  
  <p><a href="https://i.stack.imgur.com/6Pu7y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Pu7y.png" alt="PDF File Generated First"></a>
              <strong>First Generated PDF File for Ticket Number: 20170034</strong>
  <a href="https://i.stack.imgur.com/k8cD9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k8cD9.png" alt="PDF File Generated Second"></a>
              <strong>Second Generated PDF File for Ticket Number: 20170035</strong></p>