Closed steevi2307 closed 4 years ago
application.conf needs to be on the Java classpath. Here this probably means, that it needs to be in src/main/resources. When you create a jar, you can either include the application.conf file, which makes it easy to access, but hard to change. Or you need to make sure, when you start the jar, that your application.conf file is in a location, that is part of the classpath.
Alternatively you could also set the config programmatically. Have a look at IntegrationTest.whenMorePixelsAreDifferentThanAllowedDiffInPercentResultIsNotEqual() for an example.
And another way: You can also use a system environment variable to do the configuration.
Ok, it seems to work for the first page with that code (No differences are found)
final CompareResult result = new PdfComparator(x, y).withEnvironment(new SimpleEnvironment().setAllowedDiffInPercent(5)).compare(); if (result.isNotEqual()) { System.out.println("Differences are found"); result.writeTo(z); System.exit(1); }
But, if I take the entire document, it told me correctly that both documents are not equal but the resultfile show all differences ... is there a way to only show differences that are less than 5% of pixel difference ?
Thanks
Currently there is not. You always get all the differences.
Do you think it will be possible in a near future as an improvement ?
There is a setting: addEqualPagesToResult When you set that to false, pages that are equal (or where the difference is below the allowed percentage) are not added to the result. Is that what you want?
Actually, it's working very well but the best for me would be to have all pages with :
Do you think it's possible ?
Thanks ;)
Possible is everything. It's Software after all. ;-) But not everything makes sense...
Including the pages from the expected or actual PDF file unchanged, even though they have differences, does not make sense to me. That would be confusing and would go against the basic concept of PdfCompare, IMHO. The only thing that would make sense to me is: Mark those pages somehow differently. Similar to ignored areas, that get a yellow background. So you can still see that there are differences, but you also immediately see, that they have been ignored.
But doing that is not trivial. You only know at the end, whether the number of differing pixels is above or below the threshold of allowedDiffInPercent. But the margins are drawn during the rendering. :-/
OK, I will see what's the best later ;) Thanks for your advices
I updated the README to more clearly describe the possibilities to specify a config file
Hi,
It's been a long time that i not use java but I succeeded to use the pdfcompare tool inside eclipse IDE an make a jar file that can be used from my .NET application.
But I don't understand how to use the application.conf file to allowed difference in percent ... I tried to put this file in most of all directory but it doesn't seems to work.
Can you tell me what's wrong ? Pdfs are attached
New (P1).pdf Old (P1).pdf
Thanks :)