logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Post a reply
From:
Message:

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
Paul Rayman Posted: Sunday, March 10, 2019 4:01:44 PM(UTC)
 
you can enumerate page.PageObjects collection, locate and remove the TextObject.
Next you should re-generate page content by calling page.GenerateContent() method.

Code:
using (var doc = PdfDocument.Load(@"d:\test.pdf"))
{
    var page = doc.Pages[0];
    for(int i=page.PageObjects.Count-1; i>=0; i--)
    {
        if (!(page.PageObjects[i] is PdfTextObject))
            continue;
        var obj = page.PageObjects[i] as PdfTextObject;
        if (obj.TextUnicode == "some text")
        {
            page.PageObjects.RemoveAt(i);
            break;
        }
    }
    page.GenerateContent();
    doc.Save(@"d:\test_modified.pdf", SaveFlags.NoIncremental);
}
oberon232 Posted: Friday, March 8, 2019 1:05:40 PM(UTC)
 
I have a page that I've marked with text.
I know the position on the page and what the text says.
Now I want to remove that text, not just hide it but remove it from the page.
Is there a way to do this?