Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Sat Nov 24, 2018 6:33 am

Hi
I want to delete entire text from PDF, keeping image and layout intact
Is it possible with Spire.PDF
thanks
Reg
Bose C S

bbs123
 
Posts: 1
Joined: Sat Nov 24, 2018 6:32 am

Mon Nov 26, 2018 4:00 am

Hi,

Thanks for your inquiry.
I'm sorry to tell you that there is no method to delete the text in Spire.PDF. But there is a workaround, you can draw a white rectangle over the text. Please refer to below code.
Code: Select all
            PdfDocument pdf = new PdfDocument();
            pdf.LoadFromFile(input);
            PdfPageBase page = pdf.Pages[0];
            PdfBrush brush = new PdfSolidBrush(Color.White);
            PdfTextFind[] results = page.FindAllText().Finds;
            foreach (PdfTextFind result in results)
            {
                RectangleF rec = result.Bounds;
                page.Canvas.DrawRectangle(brush,rec);
            }
            pdf.SaveToFile(output);

Kindly note that the location of the text is not very accurate at present, and I logged this issue in our bug tracking system. Once there is any update, I will let you know.
Sincerely,
Mike
E-iceblue support team
User avatar

Mike.Zhang
 
Posts: 93
Joined: Thu Sep 27, 2018 7:11 am

Fri Dec 07, 2018 10:56 am

Hi,

Glad to inform you that the issue has been fixed, welcome to download the hotfix from the following link.
Spire.PDF Pack(Hot Fix) Version:4.12.2.
Sincerely,
Mike
E-iceblue support team
User avatar

Mike.Zhang
 
Posts: 93
Joined: Thu Sep 27, 2018 7:11 am

Thu Dec 13, 2018 9:22 am

Hi Bose,

Greetings from e-iceblue!
Have you tried the hotfix? Your feedback would be greatly appreciated!
Sincerely,
Mike
E-iceblue support team
User avatar

Mike.Zhang
 
Posts: 93
Joined: Thu Sep 27, 2018 7:11 am

Return to Spire.PDF