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.

Mon Jun 01, 2020 6:34 am

I'm having a problem in some PDFs when searching for text using FindText and TextFindParameter.Regex. This varies from the output when using TextFindParameter.CrossLine (I'm not using this because of the current issue with some characters when using the non-Regex version (https://www.e-iceblue.com/forum/findtext-errors-t9342.html).

In the example code below, I search for the text "PRUDENTIAL AFFILIATE" in a regex form (to be highlighted in red) and plain-text form (to be highlighted in gold). When this is working correctly I would expect the two occurrences (only the upper case ones) to be highlighted in "orange" (being a combination of the red and gold highlighting). At present, the first is orange and the second is gold, indicating that it was not found by the Regex search.

This appears to be related to the internal structure of the PDF. If I recreate the document with the same text and perform the same text it behaves as expected. Unfortunately this isn't the only example I have of this happening though.


Screenshot 2020-06-01 at 07.23.38.png


Code: Select all
public void RegexSearchTest()
        {
            string strFileName = @"Prudential Short.pdf";
            string strTargetName = @"Short Highlighted.pdf";
            string strRegexSearch = @"PRUDENTIAL(\s{1,200})AFFILIATE";  //Plenty of whitespace to cross the line break and pre-text padding
            string strOtherSearch = @"PRUDENTIAL AFFILIATE";
            Spire.Pdf.PdfDocument pdf = new PdfDocument(strFileName);

            foreach (PdfTextFind text in pdf.Pages[0].FindText(strRegexSearch, TextFindParameter.Regex).Finds)
            {
                text.ApplyHighLight(Color.Red);
            }

            foreach (PdfTextFind text in pdf.Pages[0].FindText(strOtherSearch, TextFindParameter.CrossLine).Finds)
            {
                text.ApplyHighLight(Color.Gold);
            }

            pdf.SaveToFile(strTargetName);

            pdf.Close();
        }

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Mon Jun 01, 2020 10:36 am

Hello,

Thanks for your message.
I did notice that the searching by the Regex search only can find one string. This issue has been logged into our bug tracking system with the ticket SPIREPDF-3301. Our Dev team will do more investigations and fixing. Once there is any update, I will let you know. Sorry for the inconvenience caused.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Tue Jun 02, 2020 2:41 pm

Lis,

Thanks for your response. The regex FindText does return multiple matches usually. There appears to be something different about this PDF that prevents it doing do. If for example I recreate the page provided in Word and save it as a new PDF it will work correctly.

I hope that the additional information is helpful.

This issue is holding up the release of a product, so a speedy resolution would be appreciated :D

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Wed Jun 03, 2020 3:39 am

Hello,

Thank you for sharing the additional information. I have posted it to our Dev team for reference and given this issue the highest priority. Our Dev team will share any possible ETA at their earliest. If there is any news, I will let you know at the first time. Thanks for your understanding.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Fri Jun 05, 2020 6:48 am

Lisa,

Sorry to chase for an update on this, but the combination of this and the other FindText issues (https://www.e-iceblue.com/forum/findtext-errors-t9342.html and https://www.e-iceblue.com/forum/inconsistent-pdf-findtext-and-doc-findallstring-results-t9362.html) are holding up a test/release cycle and I have a client chasing me daily. Any update/ETA you have for me would be useful.

Many thanks in advance,

Darren

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Fri Jun 05, 2020 7:38 am

Hello,

Thank you for following up and sorry for the inconvenience caused. Below are the status.
1. The issue ticket SPIREPDF- 3268 of https://www.e-iceblue.com/forum/findtext-errors-t9342.html , our Dev team have made some adjustments, unfortunately, it didn’t pass the tests. They are further investigating and fixing it now.
2. The issue ticket SPIREPDF- 3290 of https://www.e-iceblue.com/forum/inconsistent-pdf-findtext-and-doc-findallstring-results-t9362.html, I got the news from our Dev team that this issue has been fixed. Once the hotfix version is available, we will let you know asap.
3. The issue ticket SPIREPDF-3301 of this post, I got that this issue has been resolved and it is in the testing phase, once the tests pass, we will prepare a hotfix version for you at the first time.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Wed Jun 10, 2020 6:15 am

Lisa,

Thanks for your last update - I wondered if the devs had any update or ETA?

Many thanks in advance,

Darren

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Wed Jun 10, 2020 10:45 am

Hello,

Thank you for following up.
As for SPIREPDF- 3268 and SPIREPDF-3290, they passed the tests. We made a temporary version spire.pdf_6.6.8.zip for you, please use the following string to test SPIREPDF- 3268. And for SPIREPDF- 3290, now the searching output likes the same effect as Adobe does.
Code: Select all
       string[] strShortList =
    {
       @"Regex \ Test",
       @"Regex Test^",
       @"Regex Test|",
       @"Regex Test\",
   };

As for the SPIREPDF-3301, It didn't pass the test, our Dev team is doing more fixing now. Once it is fixed, I will let you know asap.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Mon Jun 15, 2020 3:28 pm

Lisa,

I hope you are well - Any ETA on when 3301 will be back into test? I'm trying to manage my client's expectations so any update would be helpful.

Thanks in advance,

Darren

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Tue Jun 16, 2020 7:13 am

Hello,

As for the SPIREPDF-3301, our Dev team made some adjustments and resolved the related issues. Our Test team is doing tests now. Sorry I can’t give you any ETA at this moment. Once the tests pass, we will prepare a hotfix for you ASAP.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Wed Jun 17, 2020 6:16 am

Lisa,

Just a quick chase on this one...Any ETA, my client is getting increasingly desperate for our release.

Darren.

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Wed Jun 17, 2020 7:14 am

Hello,

Thank you for following up.
This issue is fixed. Considering your urgent situation, we prepared a temporary version (spire.pdf_6.6.11.zip) for you. Please download and test it firstly.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Wed Jun 17, 2020 7:56 am

:D

Thanks for your help with this. I will run my tests now.

Darren.

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Wed Jun 17, 2020 9:24 am

Hello,

Thanks for your quick response.
If you encounter any question when doing tests, just feel free to contact us. Hope everything goes well!

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Thu Jun 18, 2020 7:37 am

Lisa,

The fixes are looking good :D

There is a dependency within Spire.OfficeViewer.Form I'm getting a link failure "Could not load file or assembly 'Spire.Pdf, Version=6.5.9.0". Could you let me have the updated version or point me to the hotfix.

Thank you for your help in getting this issue resolved and getting the emergency release to me too - Very much appreciated.

Darren

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Return to Spire.PDF