How to compare underline text between PDF files in .NET

I am using temporary license for Groupdocs.Comparison .net for comparing two pdf files,but it is unable to highlight ‘underline text’ difference. Same case checked with docx files and here its working fine but not for pdf files comparison. In code ‘DetectStyleChanges’ has been set to true already. Please help me over here.

1 Like

@psgaikwad,

Can you please share the problematic source/target files and the sample code you wrote for comparison process? We’ll then investigate this scenario.
Also specify the API version you are evaluating (e.g. 19.10, 20.3.1).

Thanks for your quick response. I have attached simple pdf files. result.PNG (3.7 KB)
test1.pdf (380.7 KB)
test2.pdf (468.9 KB)
Here in result we are expecting underline text(i.e here, text in red circle) should also highlight.
API version is 20.3.1.0

1 Like

Here is the code for this,
using (Comparer comparer = new Comparer(sourceDocumentPath))
{
comparer.Add(targetDocumentPath);
CompareOptions opt = new CompareOptions()
{
DetalisationLevel = DetalisationLevel.High,
DetectStyleChanges = true,

                InsertedItemStyle = new StyleSettings()
                {
                    HighlightColor = System.Drawing.Color.Yellow                        
                },
                DeletedItemStyle = new StyleSettings()
                {
                    HighlightColor = System.Drawing.Color.Yellow
                },
                ChangedItemStyle = new StyleSettings()
                {
                    HighlightColor = System.Drawing.Color.Yellow
                }
            };
            
            comparer.Compare(outputPath, opt);

}

1 Like

@psgaikwad,

We reproduced this issue at our end. Hence, it has been logged in our internal issue tracking system for further investigation with ID COMPARISONNET-2294. As there’s any update, you’ll be notified.

Thanks for your update. Just would like to know few more things

  1. Can we compare image/logo also?
  2. Is it possible here to show/highlight compared result into two separate pdf files, instead of only one?

@psgaikwad,

Yes, you can do image comparison. How such a comparison works? Please take a look at the following resources:

Do you mean output summary to be displayed in separate PDF?

I have two pdf with text and logo but unable to find out difference between logo. I also went through ‘Related thread’ link provided by your above comment,but here unable to trace out the code,means ‘ComparisonSettings’ class and it’s properties. This class is not part of your dll. Hence still unable to compare logo(in two pdf) difference here.

1 Like

@psgaikwad,

Image comparison and PDF with images comparison both are different things. The resources we shared were about images comparison (e.g. PNG to PNG comparison).
Can you please share the source and target files with us? We’ll further investigate this scenario.

Ok, got it about your shared link now. But this is not case for us.
I have shared pdf file(only part of pdf) which have logo as well. Like this we have to compare logo within both pdf files as well. But this is not our top priority as of now.
XYZ.PNG (7.5 KB)

1 Like

Our primary requirement is highlighting underline text and emty space between two lines while comparing two pdf files.
We expecting marked red circle in result pdf(i.e result.png here) should also heighlight. I already shared issue about underline text and hope very soon I ll get positive feedback on that also. It would be great if you provide these both requirement on priority basis as we have some urgency.
result.PNG (3.3 KB)
test1.pdf (381.0 KB)
test2.pdf (380.7 KB)

1 Like

@psgaikwad,

We didn’t get such PDF files (with logo). Can you please resend? We’d encourage you to create a new post regarding this issue.

We are investigating underline text issue with ID COMPARISONNET-2294. As far as space between two lines is concerned, we created another investigation ticket for this COMPARISONNET-2295. As there’s any update, we’ll notify you.

Could not share actual pdf here but attached its content (XYZ.PNG)(logo within pdf). Both source and target pdf file could have same type of content.
XYZ.PNG (7.5 KB)

1 Like

@psgaikwad,

Both source and target PDF files with same image/logo will show no impact in the output regarding logo or image. However, if one document has lets say image A and second PDF has image B (different images), output will reflect the change but it will not compare them (images) pixel by pixel. Please download these source/target and output files comparison.zip (421.8 KB), you will get an idea how PDF comparison with images works.

Thanks for your response, will look into it as well.

1 Like

@psgaikwad,

You are welcome.

I have been waiting for valuable response on COMPARISONNET-2294 and COMPARISONNET-2295. Please notify me soon, once you have any update for the same.

1 Like

@psgaikwad,

About COMPARISONNET-2295, in your specific case we are unable to count line breaks because looks like there are 2 different text fragments. All that we could do in this case is to show second text fragment shifted (this will be shown as a style change in result document). And we’ll try to implement this in upcoming release of the API (if no unexpected issue occurs).
However, issue COMPARISONNET-2294 is still in progress. As there’s any update, we’ll notify you.

Thanks once again for your quick update. Hope very soon will get positive response regarding both issues as you mentioned.

1 Like

@psgaikwad,

COMPARISONNET-2295 is fixed in API version 20.5.