From 75aead947735d40ee9ab2d133cdc6d0f6f791988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=96=D0=B8=D1=82?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D0=B2?= Date: Wed, 28 Oct 2015 13:04:46 +0300 Subject: [PATCH] fixing untyped arguments --- pdf/pdf.d.ts | 206 +++++++++++++++++++++++++-------------------------- 1 file changed, 103 insertions(+), 103 deletions(-) diff --git a/pdf/pdf.d.ts b/pdf/pdf.d.ts index 802c0e601..523cfc5e8 100644 --- a/pdf/pdf.d.ts +++ b/pdf/pdf.d.ts @@ -72,66 +72,66 @@ interface PDFProgressData { interface PDFDocumentProxy { /** - * Total number of pages the PDF contains. - **/ + * Total number of pages the PDF contains. + **/ numPages: number; /** - * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] - **/ + * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] + **/ fingerprint: string; /** - * True if embedded document fonts are in use. Will be set during rendering of the pages. - **/ + * True if embedded document fonts are in use. Will be set during rendering of the pages. + **/ embeddedFontsUsed(): boolean; /** - * @param number The page number to get. The first page is 1. - * @return A promise that is resolved with a PDFPageProxy. - **/ + * @param number The page number to get. The first page is 1. + * @return A promise that is resolved with a PDFPageProxy. + **/ getPage(number: number): PDFPromise; /** - * TODO: return type of Promise - * A promise that is resolved with a lookup table for mapping named destinations to reference numbers. - **/ + * TODO: return type of Promise + * A promise that is resolved with a lookup table for mapping named destinations to reference numbers. + **/ getDestinations(): PDFPromise; /** - * A promise that is resolved with an array of all the JavaScript strings in the name tree. - **/ + * A promise that is resolved with an array of all the JavaScript strings in the name tree. + **/ getJavaScript(): PDFPromise; /** - * A promise that is resolved with an array that is a tree outline (if it has one) of the PDF. @see PDFTreeNode - **/ + * A promise that is resolved with an array that is a tree outline (if it has one) of the PDF. @see PDFTreeNode + **/ getOutline(): PDFPromise; /** - * A promise that is resolved with the info and metadata of the PDF. - **/ + * A promise that is resolved with the info and metadata of the PDF. + **/ getMetadata(): PDFPromise<{ info: PDFInfo; metadata: PDFMetadata }>; /** - * Is the PDF encrypted? - **/ + * Is the PDF encrypted? + **/ isEncrypted(): PDFPromise; /** - * A promise that is resolved with Uint8Array that has the raw PDF data. - **/ + * A promise that is resolved with Uint8Array that has the raw PDF data. + **/ getData(): PDFPromise; /** - * TODO: return type of Promise - * A promise that is resolved when the document's data is loaded. - **/ + * TODO: return type of Promise + * A promise that is resolved when the document's data is loaded. + **/ dataLoaded(): PDFPromise; /** - * - **/ + * + **/ destroy(): void; } @@ -173,11 +173,11 @@ interface PDFAnnotationData { interface PDFAnnotations { getData(): PDFAnnotationData; hasHtml(): boolean; // always false - getHtmlElement(commonOjbs): HTMLElement; // throw new NotImplementedException() + getHtmlElement(commonOjbs: any): HTMLElement; // throw new NotImplementedException() getEmptyContainer(tagName: string, rect: number[]): HTMLElement; // deprecated isViewable(): boolean; - loadResources(keys): PDFPromise; - getOperatorList(evaluator): PDFPromise; + loadResources(keys: any): PDFPromise; + getOperatorList(evaluator: any): PDFPromise; // ... todo } @@ -206,142 +206,142 @@ interface PDFViewerParams { } /** -* RenderTask is basically a promise but adds a cancel function to termiate it. -**/ + * RenderTask is basically a promise but adds a cancel function to termiate it. + **/ interface PDFRenderTask extends PDFPromise { /** - * Cancel the rendering task. If the task is currently rendering it will not be cancelled until graphics pauses with a timeout. The promise that this object extends will resolve when cancelled. - **/ + * Cancel the rendering task. If the task is currently rendering it will not be cancelled until graphics pauses with a timeout. The promise that this object extends will resolve when cancelled. + **/ cancel(): void; } interface PDFPageProxy { /** - * Page number of the page. First page is 1. - **/ + * Page number of the page. First page is 1. + **/ pageNumber(): number; /** - * The number of degrees the page is rotated clockwise. - **/ + * The number of degrees the page is rotated clockwise. + **/ rotate(): number; /** - * The reference that points to this page. - **/ + * The reference that points to this page. + **/ ref(): PDFRef; /** - * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. - **/ + * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. + **/ view(): number[]; /** - * @param scale The desired scale of the viewport. - * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. - * @return - **/ + * @param scale The desired scale of the viewport. + * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. + * @return + **/ getViewport(scale: number, rotate?: number): PDFPageViewport; /** - * A promise that is resolved with an array of the annotation objects. - **/ + * A promise that is resolved with an array of the annotation objects. + **/ getAnnotations(): PDFPromise; /** - * Begins the process of rendering a page to the desired context. - * @param params Rendering options. - * @return An extended promise that is resolved when the page finishes rendering. - **/ + * Begins the process of rendering a page to the desired context. + * @param params Rendering options. + * @return An extended promise that is resolved when the page finishes rendering. + **/ render(params: PDFRenderParams): PDFRenderTask; /** - * A promise that is resolved with the string that is the text content frm the page. - **/ - getTextContent(): PDFPromise; + * A promise that is resolved with the string that is the text content frm the page. + **/ + getTextContent(): PDFPromise; /** - * marked as future feature - **/ + * marked as future feature + **/ //getOperationList(): PDFPromise<>; /** - * Destroyes resources allocated by the page. - **/ + * Destroyes resources allocated by the page. + **/ destroy(): void; } interface TextContentItem { - str: string; - transform: number[]; // [0..5] 4=x, 5=y - width: number; - height: number; - dir: string; // Left-to-right (ltr), etc - fontName: string; // A lookup into the styles map of the owning TextContent + str: string; + transform: number[]; // [0..5] 4=x, 5=y + width: number; + height: number; + dir: string; // Left-to-right (ltr), etc + fontName: string; // A lookup into the styles map of the owning TextContent } interface TextContent { - items: TextContentItem[]; - styles: any; + items: TextContentItem[]; + styles: any; } /** -* A PDF document and page is built of many objects. E.g. there are objects for fonts, images, rendering code and such. These objects might get processed inside of a worker. The `PDFObjects` implements some basic functions to manage these objects. -**/ + * A PDF document and page is built of many objects. E.g. there are objects for fonts, images, rendering code and such. These objects might get processed inside of a worker. The `PDFObjects` implements some basic functions to manage these objects. + **/ interface PDFObjects { - get(objId, callback?): any; - resolve(objId, data); - isResolved(objId): boolean; - hasData(objId): boolean; - getData(objId): any; + get(objId: number, callback?: any): any; + resolve(objId: number, data: any): any; + isResolved(objId: number): boolean; + hasData(objId: number): boolean; + getData(objId: number): any; clear(): void; } interface PDFJSStatic { /** - * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. - **/ + * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. + **/ maxImageSize: number; /** - * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. - **/ + * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. + **/ disableFontFace: boolean; /** - * This is the main entry point for loading a PDF and interacting with it. - * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) - * is used, which means it must follow the same origin rules that any XHR does - * e.g. No corss domain requests without CORS. - * @param source - * @param pdfDataRangeTransport Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface. - * @param passwordCallback Used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and the reason. - * @param progressCallback Progress callback. - * @return A promise that is resolved with PDFDocumentProxy object. - **/ + * This is the main entry point for loading a PDF and interacting with it. + * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) + * is used, which means it must follow the same origin rules that any XHR does + * e.g. No corss domain requests without CORS. + * @param source + * @param pdfDataRangeTransport Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface. + * @param passwordCallback Used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and the reason. + * @param progressCallback Progress callback. + * @return A promise that is resolved with PDFDocumentProxy object. + **/ getDocument( - source: string, - pdfDataRangeTransport?, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; + source: string, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void) + : PDFPromise; getDocument( - source: Uint8Array, - pdfDataRangeTransport?, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; + source: Uint8Array, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void) + : PDFPromise; getDocument( - source: PDFSource, - pdfDataRangeTransport?, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; + source: PDFSource, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void) + : PDFPromise; PDFViewer(params: PDFViewerParams): void; }