mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
[api-minor] Deprecate the PDFDocumentProxy.getJavaScript
method
This method is very old, however with the exception of the auto-print hack (when scripting is disabled) in the viewer it's never actually been used. Most likely the idea with `PDFDocumentProxy.getJavaScript` was that it'd be useful if scripting support was added, however it turned out that it was a bit too simplistic and instead a number of new methods were added for the scripting use-cases.
This commit is contained in:
parent
5b8f680480
commit
64e8557fb5
5 changed files with 42 additions and 58 deletions
|
@ -1358,21 +1358,16 @@ describe("api", function () {
|
|||
await loadingTask.destroy();
|
||||
});
|
||||
|
||||
it("gets javascript", async function () {
|
||||
const javascript = await pdfDocument.getJavaScript();
|
||||
expect(javascript).toEqual(null);
|
||||
});
|
||||
|
||||
it("gets javascript with printing instructions (JS action)", async function () {
|
||||
// PDF document with "JavaScript" action in the OpenAction dictionary.
|
||||
const loadingTask = getDocument(buildGetDocumentParams("issue6106.pdf"));
|
||||
const pdfDoc = await loadingTask.promise;
|
||||
const javascript = await pdfDoc.getJavaScript();
|
||||
const { OpenAction } = await pdfDoc.getJSActions();
|
||||
|
||||
expect(javascript).toEqual([
|
||||
expect(OpenAction).toEqual([
|
||||
"this.print({bUI:true,bSilent:false,bShrinkToFit:true});",
|
||||
]);
|
||||
expect(javascript[0]).toMatch(AutoPrintRegExp);
|
||||
expect(OpenAction[0]).toMatch(AutoPrintRegExp);
|
||||
|
||||
await loadingTask.destroy();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue