title: Adding Stamp/Watermark/Content over PDF using iTextSharp
body: <p>I am using following code:</p>
  
  <pre><code>PdfReader PDFReader = new PdfReader("C:\\file.pdf");
  
  FileStream Stream = new FileStream("C:\\new.pdf", FileMode.Create, FileAccess.Write);
  
  PdfStamper PDFStamper = new PdfStamper(PDFReader, Stream);
  
  for (int iCount = 0; iCount &lt; PDFStamper.Reader.NumberOfPages; iCount++)
  {
      PdfContentByte PDFData = PDFStamper.GetOverContent(iCount + 1);
      BaseFont baseFont = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED);
      PDFData.BeginText();
      PDFData.SetColorFill(CMYKColor.LIGHT_GRAY);
      PDFData.SetFontAndSize(baseFont, 80);
      PDFData.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "SAMPLE DOCUMENT", 300, 400, 45);
      PDFData.EndText();
  }
  
  Stream.Close();
  PDFReader.Close();
  PDFStamper.Close();
  </code></pre>
  
  <p>But <code>PDFStamper.Close();</code> throws error. Also, I am not sure whether to call <code>PDFReader.Close();</code> before or after <code>PDFStamper.Close();</code></p>
  
  <p>And watermark is not added in PDF file.</p>