title: How to add a watermark to a PDF file?
body: <p>I'm using C# and iTextSharp to add a watermark to my PDF files:</p>
  
  <pre><code>Document document = new Document();
  PdfReader pdfReader = new PdfReader(strFileLocation);
  PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(strFileLocationOut, FileMode.Create, FileAccess.Write, FileShare.None));
  iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(WatermarkLocation);
  img.SetAbsolutePosition(100, 300);
  PdfContentByte waterMark;
  //    
  for (int pageIndex = 1; pageIndex &lt;= pdfReader.NumberOfPages; pageIndex++)
  {
      waterMark = pdfStamper.GetOverContent(pageIndex);
      waterMark.AddImage(img);
  }
  //
  pdfStamper.FormFlattening = true;
  pdfStamper.Close();
  </code></pre>
  
  <p>It works fine, but my problem is that in some PDF files no watermark is added although the file size increased, any idea?</p>