red6 / pdfcompare

A simple Java library to compare two PDF files
Apache License 2.0
220 stars 66 forks source link

Question about full pages exlusions #72

Closed jradom closed 4 years ago

jradom commented 4 years ago

Hello

Let's say I have 2 files which can have from 2 to X number of pages. I can 2 and 2 or 3 and 3 or 15 and 15, etc. I always want to compare only the first 2 pages and exclude all others to the end. I want to use only one conf file. Please, suggest what is the best way will be to do that? Also, can source and target files be in any separate directories? What are the changes in the last version vs 2 versions back?

Thanks a lot in advance

Jeff

finsterwalder commented 4 years ago

It does not hurt to add pages in an exclude file, that don't exist. So you could write a file that excludes the maximum amount of pages that you expect like this: exclusions: [ { page: 3 }, { page: 4 }, .... { page: 15 } ] There is no easier way currently.

Or you could do it programmatically: pdfCompare = new PdfComparator("expected.pdf", "actual.pdf") for( in i = 2; i++; i < 20) { pdfCompare.withIgnore(new PageArea(i)); } or similar.

jradom commented 4 years ago

It'l be nice to have something like Pages: 2-6, 8-10, 12, 14

On Tue, May 12, 2020 at 12:14 AM Malte Finsterwalder < notifications@github.com> wrote:

It does not hurt to add pages in an exclude file, that don't exist. So you could write a file that excludes the maximum amount of pages that you expect like this: exclusions: [ { page: 3 }, { page: 4 }, .... { page: 15 } ] There is no easier way currently.

Or you could do it programmatically: pdfCompare = new PdfComparator("expected.pdf", "actual.pdf") for( in i = 2; i++; i < 20) { pdfCompare.withIgnore(new PageArea(i)); } or similar.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/red6/pdfcompare/issues/72#issuecomment-627158724, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZGPIAX4Q2MAFLV423IB3RRDZMHANCNFSM4M6QJZTQ .

finsterwalder commented 4 years ago

With the current implementation and format, that is not so trivial to do. And it's not high on my list of things to do... Feel free to implement something and create a merge request. ;-)