Skip to content

Commit

Permalink
[breaking] Update pdfjs-dist to 3.3.122
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Mar 9, 2023
1 parent 73e9605 commit 6304bf1
Show file tree
Hide file tree
Showing 6 changed files with 422 additions and 71 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ React-PDF supports all modern browsers. It is tested with the latest versions of

The following browsers are supported in React-PDF v6:

- Chrome ≥76
- Edge (Chromium-based)
- Chrome ≥85
- Edge ≥85
- Safari ≥14.1
- Firefox ≥90(?)
- Firefox ESR

You may extend the list of supported browsers by providing additional polyfills (e.g. for `Promise.allSettled`) and configuring your bundler to transpile `pdfjs-dist`.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"make-cancellable-promise": "^1.0.0",
"make-event-props": "^1.1.0",
"merge-refs": "^1.0.0",
"pdfjs-dist": "2.16.105",
"pdfjs-dist": "3.3.122",
"prop-types": "^15.6.2",
"tiny-invariant": "^1.0.0",
"tiny-warning": "^1.0.0"
Expand Down
16 changes: 14 additions & 2 deletions src/Page/TextLayer.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@

:root {
--react-pdf-text-layer: 1;
--highlight-bg-color: rgba(180, 0, 170, 1);
--highlight-selected-bg-color: rgba(0, 100, 0, 1);
}

@media screen and (forced-colors: active) {
:root {
--highlight-bg-color: Highlight;
--highlight-selected-bg-color: ButtonText;
}
}

.textLayer {
Expand All @@ -28,6 +37,9 @@
line-height: 1;
text-size-adjust: none;
forced-color-adjust: none;
transform-origin: 0 0;
z-index: 2;
--scale-factor: 1;
}

.textLayer span,
Expand All @@ -49,7 +61,7 @@
.textLayer .highlight {
margin: -1px;
padding: 1px;
background-color: rgba(180, 0, 170, 1);
background-color: var(--highlight-bg-color);
border-radius: 4px;
}

Expand All @@ -70,7 +82,7 @@
}

.textLayer .highlight.selected {
background-color: rgba(0, 100, 0, 1);
background-color: var(--highlight-selected-bg-color);
}

/* Avoids https://github.com/mozilla/pdf.js/issues/13840 in Chrome */
Expand Down
4 changes: 3 additions & 1 deletion src/Page/TextLayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ export function TextLayerInternal({

container.innerHTML = '';

const textContentSource = page.streamTextContent();

const parameters = {
container,
textContent,
textContentSource,
viewport,
};

Expand Down
Loading

0 comments on commit 6304bf1

Please sign in to comment.