Merge pull request #16774 from Snuffleupagus/rm-deprecated-options
[api-major] Remove various deprecated functionality and options
This commit is contained in:
commit
0edc490e1b
@ -770,26 +770,6 @@ class PDFDocumentProxy {
|
|||||||
this._pdfInfo = pdfInfo;
|
this._pdfInfo = pdfInfo;
|
||||||
this._transport = transport;
|
this._transport = transport;
|
||||||
|
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
|
||||||
Object.defineProperty(this, "getJavaScript", {
|
|
||||||
value: () => {
|
|
||||||
deprecated(
|
|
||||||
"`PDFDocumentProxy.getJavaScript`, " +
|
|
||||||
"please use `PDFDocumentProxy.getJSActions` instead."
|
|
||||||
);
|
|
||||||
return this.getJSActions().then(js => {
|
|
||||||
if (!js) {
|
|
||||||
return js;
|
|
||||||
}
|
|
||||||
const jsArr = [];
|
|
||||||
for (const name in js) {
|
|
||||||
jsArr.push(...js[name]);
|
|
||||||
}
|
|
||||||
return jsArr;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||||
// For testing purposes.
|
// For testing purposes.
|
||||||
Object.defineProperty(this, "getXFADatasets", {
|
Object.defineProperty(this, "getXFADatasets", {
|
||||||
|
@ -22,7 +22,7 @@ import {
|
|||||||
PromiseCapability,
|
PromiseCapability,
|
||||||
Util,
|
Util,
|
||||||
} from "../shared/util.js";
|
} from "../shared/util.js";
|
||||||
import { deprecated, setLayerDimensions } from "./display_utils.js";
|
import { setLayerDimensions } from "./display_utils.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text layer render parameters.
|
* Text layer render parameters.
|
||||||
@ -456,34 +456,6 @@ class TextLayerRenderTask {
|
|||||||
* @returns {TextLayerRenderTask}
|
* @returns {TextLayerRenderTask}
|
||||||
*/
|
*/
|
||||||
function renderTextLayer(params) {
|
function renderTextLayer(params) {
|
||||||
if (
|
|
||||||
(typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
|
|
||||||
!params.textContentSource &&
|
|
||||||
(params.textContent || params.textContentStream)
|
|
||||||
) {
|
|
||||||
deprecated(
|
|
||||||
"The TextLayerRender `textContent`/`textContentStream` parameters " +
|
|
||||||
"will be removed in the future, please use `textContentSource` instead."
|
|
||||||
);
|
|
||||||
params.textContentSource = params.textContent || params.textContentStream;
|
|
||||||
}
|
|
||||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC && !TESTING")) {
|
|
||||||
const { container, viewport } = params;
|
|
||||||
const style = getComputedStyle(container);
|
|
||||||
const visibility = style.getPropertyValue("visibility");
|
|
||||||
const scaleFactor = parseFloat(style.getPropertyValue("--scale-factor"));
|
|
||||||
|
|
||||||
if (
|
|
||||||
visibility === "visible" &&
|
|
||||||
(!scaleFactor || Math.abs(scaleFactor - viewport.scale) > 1e-5)
|
|
||||||
) {
|
|
||||||
console.error(
|
|
||||||
"The `--scale-factor` CSS-variable must be set, " +
|
|
||||||
"to the same value as `viewport.scale`, " +
|
|
||||||
"either on the `container`-element itself or higher up in the DOM."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const task = new TextLayerRenderTask(params);
|
const task = new TextLayerRenderTask(params);
|
||||||
task._render();
|
task._render();
|
||||||
return task;
|
return task;
|
||||||
|
16
web/app.js
16
web/app.js
@ -1040,22 +1040,6 @@ const PDFViewerApplication = {
|
|||||||
* @returns {Promise} - Promise that is resolved when the document is opened.
|
* @returns {Promise} - Promise that is resolved when the document is opened.
|
||||||
*/
|
*/
|
||||||
async open(args) {
|
async open(args) {
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
|
||||||
let deprecatedArgs = false;
|
|
||||||
if (typeof args === "string") {
|
|
||||||
args = { url: args }; // URL
|
|
||||||
deprecatedArgs = true;
|
|
||||||
} else if (args?.byteLength) {
|
|
||||||
args = { data: args }; // ArrayBuffer
|
|
||||||
deprecatedArgs = true;
|
|
||||||
}
|
|
||||||
if (deprecatedArgs) {
|
|
||||||
console.error(
|
|
||||||
"The `PDFViewerApplication.open` signature was updated, please use an object instead."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.pdfLoadingTask) {
|
if (this.pdfLoadingTask) {
|
||||||
// We need to destroy already opened document.
|
// We need to destroy already opened document.
|
||||||
await this.close();
|
await this.close();
|
||||||
|
@ -448,18 +448,6 @@ class PDFFindController {
|
|||||||
if (!state) {
|
if (!state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
|
||||||
(typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
|
|
||||||
state.phraseSearch === false
|
|
||||||
) {
|
|
||||||
console.error(
|
|
||||||
"The `phraseSearch`-parameter was removed, please provide " +
|
|
||||||
"an Array of strings in the `query`-parameter instead."
|
|
||||||
);
|
|
||||||
if (typeof state.query === "string") {
|
|
||||||
state.query = state.query.match(/\S+/g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const pdfDocument = this._pdfDocument;
|
const pdfDocument = this._pdfDocument;
|
||||||
const { type } = state;
|
const { type } = state;
|
||||||
|
|
||||||
|
@ -167,13 +167,6 @@ class PDFPageView {
|
|||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
this._isStandalone = !this.renderingQueue?.hasViewer();
|
this._isStandalone = !this.renderingQueue?.hasViewer();
|
||||||
this._container = container;
|
this._container = container;
|
||||||
|
|
||||||
if (options.useOnlyCssZoom) {
|
|
||||||
console.error(
|
|
||||||
"useOnlyCssZoom was removed, please use `maxCanvasPixels = 0` instead."
|
|
||||||
);
|
|
||||||
this.maxCanvasPixels = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._annotationCanvasMap = null;
|
this._annotationCanvasMap = null;
|
||||||
|
@ -280,13 +280,6 @@ class PDFViewer {
|
|||||||
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
|
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
this.removePageBorders = options.removePageBorders || false;
|
this.removePageBorders = options.removePageBorders || false;
|
||||||
|
|
||||||
if (options.useOnlyCssZoom) {
|
|
||||||
console.error(
|
|
||||||
"useOnlyCssZoom was removed, please use `maxCanvasPixels = 0` instead."
|
|
||||||
);
|
|
||||||
options.maxCanvasPixels = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.isOffscreenCanvasSupported =
|
this.isOffscreenCanvasSupported =
|
||||||
options.isOffscreenCanvasSupported ?? true;
|
options.isOffscreenCanvasSupported ?? true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user