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.

Thu Aug 18, 2022 6:30 am

I´m currently using (Spire.PDF WPF) PdfPageBase.FindText(String)
it works but I got a pop up message with underlined codelines in VS2022 that this method is obsolete.Please use PdfTextFinder instead
CS0618

I cannot find PdfTextFinder inside the Spire.Pdf namespace. Is it a VS2022 Bug?

Regards
Winfried

wrothenberg
 
Posts: 7
Joined: Tue Aug 02, 2022 7:55 am

Thu Aug 18, 2022 11:24 am

Hello,

Thanks for your inquiry.
Now, I suggest you use our new method to find text in Pdf file due to the old method you used will be removed in the future, you can refer to the following code. If you have any issue, just feel free to contact us.
Code: Select all
//Define a rectangle
RectangleF rctg = new RectangleF(0, 0, 300, 300);
PdfTextFindOptions pdfTextFindOptions = new PdfTextFindOptions();
            //Set area of finding text
            pdfTextFindOptions.Area = rctg;

           //Set parameter of find text
            pdfTextFindOptions.Parameter = Spire.Pdf.Texts.TextFindParameter.WholeWord;

            PdfTextFinder pdfTextFinder = new PdfTextFinder(doc.Pages[0]);
            pdfTextFinder.Options = pdfTextFindOptions;

            //Find text
            List<PdfTextFragment> testlist = pdfTextFinder.Find("Test");


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 860
Joined: Tue Mar 08, 2022 2:02 am

Sat Sep 03, 2022 6:44 pm

Hi, this works fine, but can I find any further explanation?
This new class and method aren´t decribed somewhere....

f.e.:
https://www.e-iceblue.com/apireference/ ... _Texts.htm

there isn´t a class named PdfTextFragment

Regards
Winfried

wrothenberg
 
Posts: 7
Joined: Tue Aug 02, 2022 7:55 am

Mon Sep 05, 2022 9:40 am

Hello,

Thanks for your feedback.
The PdfTextFragment class is a recent addition and has not yet to synchronize the relevant information to the website’s help document. You can now view the details of this class in visual studio (as shown in the screenshot below).
If you have any issue, just feel free to contact us.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 860
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF