This repo will allow you to compare your pdfs on percy.
- First we parse the pdf into html using pdf.js by mozzila.
- We capture snapshots of the parsed webpage and send it to percy for comparison.
- There are two ways to capture snapshot.
- Single page per snapshot - this is the recommended method as this will allow you to capture a lot of details.
- Multiple pages per snapshot - if you have a usecase where you would want to capture multiple pages in togther in a single snapshot.
- Create an account on percy and setup a new project. Copy the
PERCY_TOKEN
as will need it in the following steps. - Load your pdf using the pdf.js Library by following the steps mentioned here.
- Next, we need to clone this repo.
- cd to the root folder of the repo, npm install.
- export the
PERCY_TOKEN
. - update the URL (where your repo is hosted locally) in the
example.batched.js
andexample.single.js
.
- Run
npm run pery-batched
ornpm run percy-single
.
- Comparing long pdfs with a lot of visual data.
- Comapring Figma designs.
- You tell me.
- Simplify the above mentioned process.
- Explore pdf - website comparison.
- Is there a limit on pdf length that can be compared?
- Nope, there is not limit on the length of the pdf.
- How is this different from image comparisons?
- This library parses pdf to html and percy will compare dom elements and hence the results will be more accurate.
- You can use percy features like scope and percy-css that will allow you to focus or ignore parts of your pdf.
- you tell me.