title: How to knockout a pdf file using iText7 C#
body: <p><a href="https://1drv.ms/b/s!AqxJcIfHZ18UiHlqmpXn1YA8HLR8?e=Fcd7n4" rel="nofollow noreferrer">src_pdf</a>
  I wan to knockout a pdf file using iText7 C# with:</p>
  <pre><code>var sourceFPath = @&quot;to_knockout.pdf&quot;;
  var targetFPath = @&quot;out.pdf&quot;;
  using (PdfDocument origPdf = new PdfDocument(new PdfReader(sourceFPath)))
  {
      var currPage = origPdf.GetPage(1);
      using (PdfDocument destPdf = new PdfDocument(new PdfWriter(targetFPath)))
      {
          var page = destPdf.AddNewPage(new PageSize(100 * 72f / 25.4f, 125 * 72f / 25.4f));
          PdfCanvas canvas = new PdfCanvas(page);
          PdfFormXObject xObject2 = currPage.CopyAsFormXObject(destPdf);
          PdfTransparencyGroup transGroup = new PdfTransparencyGroup();
          transGroup.SetKnockout(true);
          transGroup.SetIsolated(false);
          xObject2.SetGroup(transGroup);
          canvas.AddXObjectAt(xObject2, 0,0);
      }
  }
  </code></pre>
  <p>This doesn't work.</p>
  <p><a href="https://1drv.ms/b/s!AqxJcIfHZ18UiHpZX_lv5raV6otE?e=YVYSeC" rel="nofollow noreferrer">wanted_pdf</a></p>