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

Enable/disable image smoothing based on image interpolate value. (bug 1722191)

While some of the output looks worse to my eye, this behavior more
closely matches what I see when I open the PDFs in Adobe acrobat.

Fixes: #4706, #9713, #8245, #1344
This commit is contained in:
Brendan Dahl 2021-09-08 17:31:10 -07:00
parent 8a79f13e5a
commit f38fb42b42
13 changed files with 74 additions and 9 deletions

View file

@ -13,7 +13,12 @@
* limitations under the License.
*/
import { AnnotationMode, RenderingCancelledException, shadow } from "pdfjs-lib";
import {
AnnotationMode,
PDF_PIXELS_PER_INCH,
RenderingCancelledException,
shadow,
} from "pdfjs-lib";
import { getXfaHtmlForPrinting } from "./print_utils.js";
import { PDFPrintServiceFactory } from "./app.js";
@ -29,7 +34,7 @@ function composePage(
const canvas = document.createElement("canvas");
// The size of the canvas in pixels for printing.
const PRINT_UNITS = printResolution / 72.0;
const PRINT_UNITS = printResolution / PDF_PIXELS_PER_INCH;
canvas.width = Math.floor(size.width * PRINT_UNITS);
canvas.height = Math.floor(size.height * PRINT_UNITS);

View file

@ -13,8 +13,8 @@
* limitations under the License.
*/
import { AnnotationMode, PDF_PIXELS_PER_INCH } from "pdfjs-lib";
import { PDFPrintServiceFactory, PDFViewerApplication } from "./app.js";
import { AnnotationMode } from "pdfjs-lib";
import { compatibilityParams } from "./app_options.js";
import { getXfaHtmlForPrinting } from "./print_utils.js";
@ -34,7 +34,7 @@ function renderPage(
const scratchCanvas = activeService.scratchCanvas;
// The size of the canvas in pixels for printing.
const PRINT_UNITS = printResolution / 72.0;
const PRINT_UNITS = printResolution / PDF_PIXELS_PER_INCH;
scratchCanvas.width = Math.floor(size.width * PRINT_UNITS);
scratchCanvas.height = Math.floor(size.height * PRINT_UNITS);

View file

@ -13,7 +13,9 @@
* limitations under the License.
*/
const CSS_UNITS = 96.0 / 72.0;
import { CSS_PIXELS_PER_INCH, PDF_PIXELS_PER_INCH } from "pdfjs-lib";
const CSS_UNITS = CSS_PIXELS_PER_INCH / PDF_PIXELS_PER_INCH;
const DEFAULT_SCALE_VALUE = "auto";
const DEFAULT_SCALE = 1.0;
const MIN_SCALE = 0.1;