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.

Wed Jul 01, 2020 7:56 am

Hello,
I have a pdf file with :

#SIGN#001 or #SIGN#002 or ...

I want to find the text with findtext function, but how?

findtext("#SIGN#d{3})

???

Anthony

brandeau
 
Posts: 6
Joined: Tue Jan 31, 2017 3:09 pm

Wed Jul 01, 2020 8:36 am

Hello,

Thanks for your inquiry.
Please refer to the following code. If there is any question, just feel free to write back.
Code: Select all
            PdfDocument pdf = new PdfDocument();
            pdf.LoadFromFile(@"input.pdf");
            PdfTextFind[] result = null;
            foreach (PdfPageBase page in pdf.Pages)
            {
                //Find text
                result = page.FindText("#SIGN#\\d{3}", TextFindParameter.Regex).Finds;
                foreach (PdfTextFind find in result)
                {
                    //Highlight searched text
                    find.ApplyHighLight();
                }
            }


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Jul 01, 2020 8:54 am

but findtext function accept only:

findtext(string)
findtext(string, issearchwholeword as boolean)
findtext(string,issearchwholeword as boolean, ignorecase as boolean)

??

brandeau
 
Posts: 6
Joined: Tue Jan 31, 2017 3:09 pm

Wed Jul 01, 2020 9:19 am

Hello,

Thanks for your prompt response.
Which version of Spire.PDF are you using? Please download the latest Spire.PDF Pack(Hot Fix) Version:6.5.15 and try again.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Jul 01, 2020 10:11 am

i use

spire.pdf 6.5.15 from nuget

and

spire.pdfviewer 5.1.4 from nuget too

in the same program

brandeau
 
Posts: 6
Joined: Tue Jan 31, 2017 3:09 pm

Wed Jul 01, 2020 2:40 pm

is it possible to have two component nuget

spire.pdf 6.5.15 from nuget
spire.pdfviewer 5.1.4 from nuget too (which use spire.pdf 6.1.9.2046)

??

brandeau
 
Posts: 6
Joined: Tue Jan 31, 2017 3:09 pm

Thu Jul 02, 2020 1:33 am

Hello,

Thanks for your feedback.
According to your description, I installed Spire.PDF 6.5.15 and Spire.PDFViewer 5.1.4 from Nuget in a same project, and got the following error, did you encounter the same issue?
Syntax error.png

Kindly note that the both Spire.PDF and Spire.PDFViewer contain Spire.PDF.dll, and the version of Spire.PDF.dll included in Spire.PDFViewer 5.1.4 is slightly older, it does not yet support the method "FindText("#SIGN#\\d{3}", TextFindParameter.Regex)". For your situation, please install the Spire.Office package (the latest version is Spire.Office 5.5.1) to use them together in the same project.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Tue Jul 14, 2020 10:19 am

Hello,

Greetings from E-iceblue!
Has your issue been resolved? Any feedback will be greatly appreciated!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.PDF