Repository navigation
Feat/pdf dpi option - #91
Merged
kingrishabdugar merged 3 commits intoOct 8, 2026
Merged
Conversation
pdfToImages() always rendered at 150 DPI. It now takes a dpi argument (150 by default, so callers are unchanged) and scales the page by dpi / 72, the number of PDF units per inch. Refs kingrishabdugar#6
Adds a Quality select to PDF to JPG and PDF to PNG: low (72 DPI) for small web images, standard (150 DPI, still the default) and high (300 DPI) for print. It reuses the Redact PDF strings and adds one for 72 DPI; other languages fall back to English. Refs kingrishabdugar#6
Extends the PDF to PNG browser test: a 400 pt wide page must come out 400, 834 and 1667 px wide at 72, 150 and 300 DPI, and the select must default to 150. Refs kingrishabdugar#6
Owner
|
Thank you so much, @AmariAugustin! This is a really clean PR: the change is small, the default stays at 150 DPI so nothing changes for existing users, and the test that checks the real image width at each DPI is exactly the kind of check I like to see. Merged 🎉 A few tiny notes for next time (nothing blocking, I'll handle them in a follow-up):
And yes, please do send the Windows test-path fix ( Which issue would you like to pick up next? Have a look at the open issues and tell me which one interests you, and I'll assign it to you. Thanks again for the great contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
PDF to JPG and PDF to PNG now have a Quality select: 72 DPI (small files for the web), 150 DPI (default, unchanged) and 300 DPI (print).
pdfToImages(file, format, dpi = 150)renders atdpi / 72optionsHtml(), reusingws.quality/ws.dpiStandard/ws.dpiHigh; one new stringws.dpiLowLOCALpassesNumber(o.dpi) || 150Closes #6
Type of change
How did you test it?
On
/pdf-to-jpg/and/pdf-to-png/with a one-page PDF: the select defaults to 150 DPI, and 72 / 150 / 300 give images 400 / 834 / 1667 px wide for a 400 pt page. The PDF → PNG browser test intests/app.e2e.tsnow checks these three sizes.Note: on Windows,
tests/app.e2e.tsandtests/mcp.test.tsfail before reaching any tool because fixture paths are built withURL.pathname(givesC:\C:\...). I ran the e2e test withfileURLToPathlocally (not committed). Happy to open a separate PR for that if you'd like.Checklist
npm run checkpassesnpm run test:e2epassessrc/i18n.ts(English) — translators will pick it up