Is there a way to remove an annotation by loading an already created pdf?
Is it possible to remove annotation in pdf?
Re: Is it possible to remove annotation in pdf?
Support · May 12, 2020Hello,
You can remove all the annotations in a PDF by setting the PageAnnotations merge option to false. Here is a code sample:
MergeOptions options = new MergeOptions();
options.PageAnnotations = false;
MergeDocument document = new MergeDocument(@"Input PDF file path", options);
document.Draw(@"Output PDF file path");
Thanks,
ceTe Software Support Team
Re: Is it possible to remove annotation in pdf?
Forum member · May 12, 2020I want to remove only certain annotation.
If it is possible, please let me know what to do.
Re: Is it possible to remove annotation in pdf?
Forum member · May 12, 2020It is not working.
public void AddRectangle()
{
MergeDocument doc = new MergeDocument("D:\\TestData\\test.pdf");
Rectangle rectangle = new Rectangle(100, 100, 50, 50);
rectangle.BorderStyle = LineStyle.Solid;
rectangle.CornerRadius = 5;
rectangle.FillColor = RgbColor.Yellow;
rectangle.ID = "Exhibit 1 Rectangle";
TextArea textArea = new TextArea("Exhibits 1", 100, 100, 50, 50);
textArea.ID = "Exhibit 1 Rectangle";
doc.Pages[0].Elements.Add(rectangle);
doc.Pages[0].Elements.Add(textArea);
doc.Draw("D:\\TestData\\test2.pdf");
}
public void RemoveRectangle()
{
MergeOptions options = new MergeOptions();
options.PageAnnotations = false;
MergeDocument document = new MergeDocument("D:\\TestData\\test2.pdf", options);
document.Draw("D:\\TestData\\test3.pdf");
}
The rectangle and letters remain.
See what I want below code.
public void RemoveRectangle()
{
MergeDocument document = new MergeDocument("D:\\TestData\\test2.pdf");
foreach (Page item in document.Pages)
{
foreach (PageElement element in item.Elements)
{
if (element.ID == "Some ID")
{
Remove this item.
}
}
}
document.Draw("D:\\TestData\\test3.pdf");
}
Re: Is it possible to remove annotation in pdf?
Support · May 13, 2020Hello,
Currently we only support removing all annotations, and not a specific one. We're added this as a feature request and may add it as a feature in a future build, but please note that we do not have any exact time line on this.
Thanks,
ceTe Software Support Team