moshensky / pdf-visual-diff

Visual Regression Testing for PDFs in JavaScript
MIT License
42 stars 18 forks source link

Option to set rendering DPI #58

Closed ChrisAndersonFV closed 1 month ago

ChrisAndersonFV commented 9 months ago

It would be very helpful to be able to control the resolution of the PNGs that are rendered. As-is, it's not bad, but I may need to have much higher resolution to better capture fine details. It appears the DPI is being set to 144 in pdf2png.ts lines 88/89? I think I would want a DPI of at least 300, but would like to be able to experiment with various DPIs via an option.

I'm happy to make a PR to contribute, let me know what you think. Loving this library, it's great!

moshensky commented 9 months ago

👋 I don't mind expanding configuration a bit. A PR would be much appreciated. At first thought only suggestion that comes to my mind is to think how to shape the api. I can see a potential need to abstract over the tool that actually creates the images, therefore it might be beneficial to provide tool specific config options. But I'm fine with a simpler solution for the time being that will extend current config and pass down the layers DPI setting.

moshensky commented 1 month ago

👋 @ChrisAndersonFV,

I have published a new version 0.10.0 with exposed option to set custom DPI. You can find more info at the new docs site: https://moshensky.github.io/pdf-visual-diff/functions/comparePdfToSnapshot.html