title: ITextSharp returning same size pdf when I'm trying to compress pdf file with different levels
body: <p>I'm reading a pdf and injecting some content using itextsharp.  The resulting <code>byte[]</code> is passed to the method below along with the compression level.</p>
  
  <pre><code>public static byte[] method(byte[] pdf,int compressionlevel)
          {
              using (MemoryStream outputPdfStream1 = new MemoryStream())
              {
                  //PdfReader reader1 = new PdfReader(pdf);
                  //PdfStamper stamper1 = new PdfStamper(reader1, outputPdfStream1);
                  //int level = (int)compressionlevel;
                  //if (level &lt;= 9)
                  //    stamper1.Writer.CompressionLevel = (int)compressionlevel;
                  //else
                  //    stamper1.Writer.SetFullCompression();
                  //stamper1.SetFullCompression();
                  //stamper1.Close();
                  //byte[] newfile = outputPdfStream1.ToArray();
                  //return newfile;
  
                  PdfReader reader = new PdfReader(pdf);
                  PdfStamper stamper = new PdfStamper(reader, outputPdfStream1,PdfWriter.VERSION_1_5);
                  int level = (int)compressionlevel;
                  if (level &lt;= 9)
                  {
                     stamper.Writer.CompressionLevel = level;
                  }
                  else
                      stamper.Writer.SetFullCompression();
                  int total = reader.NumberOfPages + 1;
                  for (int i = 1; i &lt; total; i++)
                  {
                      reader.SetPageContent(i, reader.GetPageContent(i));
                  }
                  stamper.SetFullCompression();
                  stamper.Close();
                  byte[] newfile = outputPdfStream1.ToArray();
                  return newfile;
              }
          } 
  </code></pre>
  
  <p>If I comment <code>stamper.SetFullCompression();</code> then this method is returning same size of byte array irrespective of the compression level am passing(am passing from 0 to 9 in each case)..</p>
  
  <p>If I uncomment <code>stamper.SetFullCompression();</code> this method is returning fully compressed version of the input byte irrespective of the compression level!!!</p>
  
  <p>What is the purpose/difference of <code>stamper.SetFullCompression();</code> and <code>stamper.Writer.SetFullCompression();</code>?</p>
  
  <p>What is the correct way to use different compression levels so that I can see different sizes in each case?</p>