1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Display background when printing or saving a text widget (issue #14928)

This commit is contained in:
Calixte Denizet 2022-05-17 23:10:02 +02:00
parent 60e9065bf6
commit 60498c67e4
8 changed files with 150 additions and 90 deletions

View file

@ -15,7 +15,7 @@
import { bytesToString, escapeString, warn } from "../shared/util.js";
import { Dict, Name, Ref } from "./primitives.js";
import { escapePDFName, parseXFAPath } from "./core_utils.js";
import { escapePDFName, numberToString, parseXFAPath } from "./core_utils.js";
import { SimpleDOMNode, SimpleXMLParser } from "./xml_parser.js";
import { BaseStream } from "./base_stream.js";
import { calculateMD5 } from "./crypto.js";
@ -53,23 +53,6 @@ function writeArray(array, buffer, transform) {
buffer.push("]");
}
function numberToString(value) {
if (Number.isInteger(value)) {
return value.toString();
}
const roundedValue = Math.round(value * 100);
if (roundedValue % 100 === 0) {
return (roundedValue / 100).toString();
}
if (roundedValue % 10 === 0) {
return value.toFixed(1);
}
return value.toFixed(2);
}
function writeValue(value, buffer, transform) {
if (value instanceof Name) {
buffer.push(`/${escapePDFName(value.name)}`);