1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Warn about missing/incorrect --scale-factor CSS-variable in renderTextLayer (issue 16139)

Unfortunately I don't believe that we can simply add a default `--scale-factor` CSS-variable to the `container`-element, since that might not be entirely appropriate/correct in all cases.[1]
However, we can at least print a console-error to hopefully make this situation more apparent to users. (This is purposely not using the `warn` helper-function, since those messages can be disabled.)

---
[1] One example is in our reference-tests, where we don't need to add it to the `container`-element itself.
This commit is contained in:
Jonas Jenwald 2023-03-16 11:45:26 +01:00
parent 5e4b3d13eb
commit 0e54a3c37a
2 changed files with 14 additions and 1 deletions

View file

@ -35,7 +35,7 @@ describe("textLayer", function () {
const textLayerRenderTask = renderTextLayer({
textContentSource: page.streamTextContent(),
container: document.createElement("div"),
viewport: page.getViewport(),
viewport: page.getViewport({ scale: 1 }),
textContentItemsStr,
});
expect(textLayerRenderTask instanceof TextLayerRenderTask).toEqual(true);