marcdacz / compare-pdf

Standalone node module that compares pdfs
MIT License
62 stars 21 forks source link

Two Different PDF's Marked as Identical #13

Closed rpigneri-vol closed 2 years ago

rpigneri-vol commented 2 years ago

Dear team,

Using the two attached files, we ran the following two test cases:

            it('Should be able to verify same single page PDFs - ours', async () => {
                let comparisonResults = await new comparePdf(config)
                    .actualPdfFile('cfb_normal.pdf')
                    .baselinePdfFile('cfb_normal.pdf')
                    .compare();
                expect(comparisonResults.status).to.equal('passed');
            });

            it('Should be able to verify different single page PDFs - ours', async () => {
                let comparisonResults = await new comparePdf(config)
                    .actualPdfFile('cfb_text_change.pdf')
                    .baselinePdfFile('cfb_normal.pdf')
                    .compare();
                expect(comparisonResults.status).to.equal('failed');
            });

The top one passed, but the bottom one failed. We were expecting the first one to indicate that both files are the same, which it did. We were expecting the second test to report that the two files are different (part of the title has been removed in the text on the page), but the test reports that they are identical.

Can you help us understand if we are doing something wrong? The tests were added to the comparePdfTests.js in a local copy of this repository. We downloaded the repo from GitHub, added those two tests, put the attached files in the data/actualPdfs or data/baselinePdfs as needed, and ran the test suite. All tests from the library itself pass.

The files are attached below:

Normal file: cfb_normal.pdf

Changed file (removed text from the title on the page itself): cfb_text_change.pdf

marcdacz commented 2 years ago

hi mate, what engine are you using? is it graphicsmagick or native? there could be an issue with the fonts where they are not translated correctly by either engine.

marcdacz commented 2 years ago

tested this locally and found that for this particular set of pdfs you have sent you'll need to set disableFontFace: false under settings.

cfb_text_change_diff