title: PDF written with itext 1.4 is increasing in size
body: <p>In our code, we have a functionality that a dynamically generated PDF from an external system can be viewed in the browser using iframe and also can be saved locally for which we are using itext. What we have noticed is, once the pdf is shown in browser, if we save the pdf using browser default toolbar, the size of the pdf is less as compared to when we save the pdf from code using itext. Meaning, a manual save of pdf from browser is lot lesser in size compared to save using itext. The content of the pdf is mostly text, so it is not about large image sizes.</p>
  
  <p>We have already tried the compression methods of writer and stamper classes but that's only reducing the size in kbs. Whereas, the size difference between manual save and itext save is in few MBs. 
  PFB the snapshot of the code that we are using. Sorry that I could not post the full code because of organization constraint and I am bit hurried to get some help here. Please let me know if the snippet is not sufficient so that I can try to provide an extracted running version.</p>
  
  <pre><code>    Document document = new Document();
          PdfReader pdfReader = new PdfReader(inputPdfStream);
  
          //Get total no. of pages in the pdf file.
          int totalPages = pdfReader.getNumberOfPages();
  
          // Create writer for the outputStream
         PdfWriter writer = 
         PdfWriter.getInstance(document, outputStream);
         PdfStamper stamper=new PdfStamper(pdfReader, outputStream);
         //Open document
         document.open();
            //Contain the pdf data.
          PdfContentByte pdfContentByte = writer.getDirectContent(); 
          PdfImportedPage page;
          document.newPage();
          page=stamper.getImportedPage(pdfReader, startPage);
          pdfContentByte.addTemplate(page, 0, 0);
          writer.setFullCompression();
          stamper.setFullCompression();
          stamper.setFreeTextFlattening(true);
          pdfReader.getCatalog().remove(com.lowagie.text.pdf.PdfName.METADATA);
  </code></pre>
  
  <p>Looking for some help on how to reduce the file size while saving from itext and have a size same as when done from browser.</p>