Skip to content

Commit

Permalink
Updated PDFs to render in higher resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Balearica committed Sep 10, 2024
1 parent a23a329 commit 0dd8801
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/containers/imageContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ export class ImageCache {

// For reasons that are unclear, a small number of pages have been rendered into massive files
// so a hard-cap on resolution must be imposed.
const pageDPI = ImageCache.pdfDims300.map((x) => 300 * 2000 / x.width, 2000);
const pageDPI = ImageCache.pdfDims300.map((x) => 300 * Math.min(x.width, 3500) / x.width);

// In addition to capping the resolution, also switch the width/height
ImageCache.pdfDims300.forEach((x, i) => {
Expand Down
2 changes: 1 addition & 1 deletion js/extractPDFText.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const extractInternalPDFTextRaw = async () => {
};

const stextArr = /** @type {Array<string>} */ ([]);
const pageDPI = ImageCache.pdfDims300.map((x) => 300 * 2000 / x.width, 2000);
const pageDPI = ImageCache.pdfDims300.map((x) => 300 * Math.min(x.width, 3500) / x.width);
const resArr = pageDPI.map(async (x, i) => {
// While using `pageTextJSON` would save some parsing, unfortunately that format only includes line-level granularity.
// The XML format is the only built-in mupdf format that includes character-level granularity.
Expand Down

0 comments on commit 0dd8801

Please sign in to comment.