pdfcompare icon indicating copy to clipboard operation
pdfcompare copied to clipboard

Comparison output readability (Ability to generate two diff documents)

Open AbhiAuto opened this issue 5 years ago • 26 comments

We have tried to compare two PDF files, and output came in the below format. It seems like we cannot read the difference from the output. Is there any other way we can make it more simpler and easy to understand?

image

AbhiAuto avatar Sep 13 '19 14:09 AbhiAuto

What do you want/expect? Yes, it's hard to read. But here is what pdfcompare does: It compares pdf pages pixel by pixel. It shows pixel, that are missing in red and pixels that are there in addition in green. When text is "moved", it quickly results in a lot of green and red, like in your example. There is no easy way to detect a move and show that in any meaningful way, I think.

You could probably add a feature, that only shows the green or red. What I usually do, when I have a big difference, like the one above is: I look at the two pdfs side by side. ;-)

finsterwalder avatar Sep 13 '19 14:09 finsterwalder

@finsterwalder Thanks for your suggestions :)

I was just checking if we have a solution for getting two outputs one in green and other in red or to get a single output.

However as you mentioned, I will try to add the feature or try to find a different solution. If those didn't work I will go for the final suggestion which you have mentioned. I have to look at the two PDF files side by side :)

One more question : Can we generate the output only with the difference into a Excel sheet or a word file ?

AbhiAuto avatar Sep 14 '19 11:09 AbhiAuto

I have not found any solution for PDF comparison result in single color. When will You add a feature, that only shows the any one color.

HETU029 avatar Sep 17 '19 05:09 HETU029

BTW: It's Open Source. You can add the feature yourself and do a Pull Request. ;-) I don't know when or if I add this feature.

HETU029 [email protected] schrieb am Di., 17. Sep. 2019, 07:51:

I have not found any solution for PDF comparison result in single color. When will You add a feature, that only shows the any one color.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/red6/pdfcompare/issues/59?email_source=notifications&email_token=AABSN3X6IGLKAVPCWYUHVTDQKBV6DA5CNFSM4IWQQSO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD63L5GY#issuecomment-532070043, or mute the thread https://github.com/notifications/unsubscribe-auth/AABSN3UQ36LZKLTQQT4WQWTQKBV6DANCNFSM4IWQQSOQ .

finsterwalder avatar Sep 17 '19 08:09 finsterwalder

I added the ability to customize the color of diff outputs. So you could run two comparisons with different coloring. Making one color something like gray or white, might give you the effect you are looking for. (There is not "do not change the color" option, though.)

finsterwalder avatar Jun 04 '20 13:06 finsterwalder

Is it possible to get the result file side by side instead of overlapping, something like what this site shows- https://www.diffchecker.com/diff

shahmit avatar Jun 23 '20 17:06 shahmit

PdfCompare has a very simplistic GUI, that can show two files side by side. Right now you can choose to view the expected or the actual PDF next to the compare result and switch between those.

Feel free to code something that generates two PDFs with different color markers. something like: new PdfComparator(file1, file2).withEnvironment(new SimpleEnvironment().setActualColor(Color.BLACK)) new PdfComparator(file1, file2).withEnvironment(new SimpleEnvironment().setExpectedColor(Color.BLACK))

And show those files.

I will most likely not work on something like this in the near future.

And I think diffchecker.com works completely different, since it seams to extract text from the PDF and does not do a pixel comparison.

finsterwalder avatar Jun 23 '20 19:06 finsterwalder

Thanks for the response, the result file with the differences currently gives a ‘Unified’ view which is not that readable. Is it possible to get the result output showing the 2 files in the ‘Split’ view- which shows the 2 documents side by side? This feature- I think would be a game changer 😊

From: Malte Finsterwalder [email protected] Sent: Tuesday, June 23, 2020 3:44 PM To: red6/pdfcompare [email protected] Cc: Shah, Mitali P. [email protected]; Comment [email protected] Subject: [External] Re: [red6/pdfcompare] Comparison output readability (Ability to generate two diff documents) (#59)

This message is from an EXTERNAL SENDER - be CAUTIOUS, particularly with links and attachments.


PdfCompare has a very simplistic GUI, that can show two files side by side. Right now you can choose to view the expected or the actual PDF next to the compare result and switch between those.

Feel free to code something that generates two PDFs with different color markers. something like: new PdfComparator(file1, file2).withEnvironment(new SimpleEnvironment().setActualColor(Color.BLACK)) new PdfComparator(file1, file2).withEnvironment(new SimpleEnvironment().setExpectedColor(Color.BLACK))

And show those files.

I will most likely not work on something like this in the near future.

And I think diffchecker.com works completely different, since it seams to extract text from the PDF and does not do a pixel comparison.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_red6_pdfcompare_issues_59-23issuecomment-2D648379243&d=DwMCaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=_GCTZUgRyTozuqoy1GdnGAgNNtHLfgy5w6QQZdWIbkA&m=tg4C3LMgMoRQTYWig3TxK3O97OPLwEoa8WiXauLjb_w&s=Cv80E0oel1-tPUK1n2aJjfyxyMnBiad1ZRv1FCEYKFU&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AKHB6CSDNM2RYGZVBDIGBMLRYEAZBANCNFSM4IWQQSOQ&d=DwMCaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=_GCTZUgRyTozuqoy1GdnGAgNNtHLfgy5w6QQZdWIbkA&m=tg4C3LMgMoRQTYWig3TxK3O97OPLwEoa8WiXauLjb_w&s=E6PMZh9jhWC8jay-rVt30zeEpp8sI87hcP9mSBGjpBo&e=.


This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.


www.accenture.com

shahmit avatar Jun 24 '20 18:06 shahmit

I'm not sure I understand what you mean. With "side by side", I assume you mean the PdfCompare UI? And which "2 documents" do you mean exactly?

finsterwalder avatar Jun 26 '20 14:06 finsterwalder

check pdfcompare into my github. I added an interesting feature. For two pdf I generate one pdf where in each page you'll have on left page of pdf1 and on right a page of pdf2 with difference. check branch horizontal_compare (@finsterwalder may be an interesting feature to merge into your project).

v3g3t4x avatar Jul 19 '20 21:07 v3g3t4x

check pdfcompare into my github. I added an interesting feature. For two pdf I generate one pdf where in each page you'll have on left page of pdf1 and on right a page of pdf2 with difference. check branch horizontal_compare (@finsterwalder may be an interesting feature to merge into your project).

is this implemented? side by side compariosn ?

nilimapradipm avatar Mar 12 '21 05:03 nilimapradipm

is this implemented? side by side compariosn ?

I think it is. See class DisplayMain.

gastendonk avatar Mar 12 '21 06:03 gastendonk

is this implemented? side by side compariosn ?

I think it is. See class DisplayMain.

Thanks for update. However i was thinking it is something which can be run programtically by passing two pdf & saving pdf for side by side comparison result

nilimapradipm avatar Mar 12 '21 09:03 nilimapradipm

Sorry for delay, yes in my version on my github is implemented the side by side compare.

v3g3t4x avatar Mar 12 '21 10:03 v3g3t4x

Sorry for delay, yes in my version on my github is implemented the side by side compare.

Please can u share the class where i can call this

nilimapradipm avatar Mar 12 '21 10:03 nilimapradipm

Here an example on how use it...use setEnableHorizontalCompareOutput

		PdfComparator compare = new PdfComparator("input/input1.pdf", "input/input2.pdf");
		boolean flagLeftRight = true;
		compare.headerLeft = "LEFT";
		compare.headerRight = "RIGHT";

		compare.withEnvironment(new SimpleEnvironment().setActualColor(Color.red).setParallelProcessing(true)
				.setMaxImageSize(100000).setDocumentCacheSize(0).setOverallTimeout(15)
				.setExpectedColor(Color.CYAN).setAddEqualPagesToResult(true).setDPI(DPI)
				.setEnableHorizontalCompareOutput(flagLeftRight).setAllowedDiffInPercent(pixel));

		CompareResult result = compare.compare();

v3g3t4x avatar Mar 12 '21 10:03 v3g3t4x

Here an example on how use it...use setEnableHorizontalCompareOutput

		PdfComparator compare = new PdfComparator("input/input1.pdf", "input/input2.pdf");
		boolean flagLeftRight = true;
		compare.headerLeft = "LEFT";
		compare.headerRight = "RIGHT";

		compare.withEnvironment(new SimpleEnvironment().setActualColor(Color.red).setParallelProcessing(true)
				.setMaxImageSize(100000).setDocumentCacheSize(0).setOverallTimeout(15)
				.setExpectedColor(Color.CYAN).setAddEqualPagesToResult(true).setDPI(DPI)
				.setEnableHorizontalCompareOutput(flagLeftRight).setAllowedDiffInPercent(pixel));

		CompareResult result = compare.compare();

thanks but m getting error for below. headerLeft is not getting listed. I am on horizontal_compare branch compare.headerLeft = "LEFT"; compare.headerRight = "RIGHT";

nilimapradipm avatar Mar 12 '21 11:03 nilimapradipm

Yes sorry, my error. You can now find the fix into horizontal_compare branch. Tell me if other error occurs.

v3g3t4x avatar Mar 12 '21 11:03 v3g3t4x

Pushed new code. Thanks Pull

v3g3t4x avatar Mar 12 '21 12:03 v3g3t4x

@v3g3t4x If I have a multipage PDF it compares the page and overwrites the output file, Is there a way to output multiple files for each page it compares

LordOfStrings avatar Sep 06 '21 06:09 LordOfStrings

Hi, It create one PDF with multipage. Check well please and tell me if the issue is real. But if I don't remember wrong it create one PDF with N pages.

v3g3t4x avatar Sep 06 '21 06:09 v3g3t4x

@v3g3t4x it creates a single png file called comp.png rather than a pdf file and that png file is replaced over and over again fo reach comparison it does, do I need to change the format of the png file to PDF? I am using the horizontal_compare branch.

LordOfStrings avatar Sep 06 '21 07:09 LordOfStrings

That png it's only a tmp file, it produce a PDF too with all pages

v3g3t4x avatar Sep 06 '21 07:09 v3g3t4x

@v3g3t4x can you list me to the piece of code where it does the same, the only output I am getting is in the comp.png ( do I have to look in any specific folder), I searched every-folder but I don't see a pdf output anywhere.

LordOfStrings avatar Sep 06 '21 07:09 LordOfStrings

It's kinda hard to follow what exactly you are doing. PdfCompare does not write a result Pdf, unless you tell it to do so. For that you need to call CompareResult.writeTo(). This will store a multi page Pdf with one page per page from the original documents, marking all the differences. There is no feature to write a single compare file for each page.

finsterwalder avatar Sep 13 '21 07:09 finsterwalder

Exactly, thanks @finsterwalder

v3g3t4x avatar Sep 13 '21 08:09 v3g3t4x