unpdf 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -31
- package/dist/index.node.cjs +8 -9
- package/dist/index.node.d.cts +4 -4
- package/dist/index.node.d.mts +4 -4
- package/dist/index.node.d.ts +4 -4
- package/dist/index.node.mjs +2 -3
- package/dist/index.web.cjs +8 -9
- package/dist/index.web.d.cts +4 -4
- package/dist/index.web.d.mts +4 -4
- package/dist/index.web.d.ts +4 -4
- package/dist/index.web.mjs +2 -3
- package/dist/index.worker.cjs +14 -11
- package/dist/index.worker.d.cts +4 -4
- package/dist/index.worker.d.mts +4 -4
- package/dist/index.worker.d.ts +4 -4
- package/dist/index.worker.mjs +12 -8
- package/dist/pdfjs.d.mts +1 -0
- package/dist/pdfjs.d.ts +1 -0
- package/dist/pdfjs.mjs +1 -0
- package/dist/shared/{unpdf.6363738c.d.ts → unpdf.3991886a.d.cts} +9 -7
- package/dist/shared/{unpdf.6363738c.d.cts → unpdf.3991886a.d.mts} +9 -7
- package/dist/shared/{unpdf.6363738c.d.mts → unpdf.3991886a.d.ts} +9 -7
- package/dist/shared/unpdf.6c0ca5b5.cjs +107 -0
- package/dist/shared/unpdf.ce219a40.mjs +99 -0
- package/dist/types/external/webL10n/l10n.d.ts +0 -0
- package/dist/types/src/display/annotation_layer.d.ts +203 -0
- package/dist/types/src/display/annotation_storage.d.ts +89 -0
- package/dist/types/src/display/api.d.ts +1466 -0
- package/dist/types/src/display/base_factory.d.ts +54 -0
- package/dist/types/src/display/canvas.d.ts +208 -0
- package/dist/types/src/display/display_utils.d.ts +277 -0
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +196 -0
- package/dist/types/src/display/editor/editor.d.ts +325 -0
- package/dist/types/src/display/editor/freetext.d.ts +72 -0
- package/dist/types/src/display/editor/ink.d.ts +95 -0
- package/dist/types/src/display/editor/stamp.d.ts +28 -0
- package/dist/types/src/display/editor/tools.d.ts +349 -0
- package/dist/types/src/display/font_loader.d.ts +43 -0
- package/dist/types/src/display/metadata.d.ts +11 -0
- package/dist/types/src/display/optional_content_config.d.ts +13 -0
- package/dist/types/src/display/pattern_helper.d.ts +73 -0
- package/dist/types/src/display/text_layer.d.ts +151 -0
- package/dist/types/src/display/transport_stream.d.ts +68 -0
- package/dist/types/src/display/worker_options.d.ts +27 -0
- package/dist/types/src/display/xfa_layer.d.ts +46 -0
- package/dist/types/src/display/xfa_text.d.ts +19 -0
- package/dist/types/src/pdf.d.ts +50 -0
- package/dist/types/src/shared/image_utils.d.ts +17 -0
- package/dist/types/src/shared/message_handler.d.ts +43 -0
- package/dist/types/src/shared/murmurhash3.d.ts +7 -0
- package/dist/types/src/shared/scripting_utils.d.ts +16 -0
- package/dist/types/src/shared/util.d.ts +398 -0
- package/dist/types/web/annotation_editor_layer_builder.d.ts +50 -0
- package/dist/types/web/annotation_layer_builder.d.ts +83 -0
- package/dist/types/web/app_options.d.ts +14 -0
- package/dist/types/web/download_manager.d.ts +14 -0
- package/dist/types/web/event_utils.d.ts +75 -0
- package/dist/types/web/generic_scripting.d.ts +8 -0
- package/dist/types/web/genericl10n.d.ts +13 -0
- package/dist/types/web/interfaces.d.ts +163 -0
- package/dist/types/web/l10n_utils.d.ts +7 -0
- package/dist/types/web/pdf_find_controller.d.ts +108 -0
- package/dist/types/web/pdf_find_utils.d.ts +16 -0
- package/dist/types/web/pdf_history.d.ts +168 -0
- package/dist/types/web/pdf_link_service.d.ts +243 -0
- package/dist/types/web/pdf_page_view.d.ts +209 -0
- package/dist/types/web/pdf_rendering_queue.d.ts +53 -0
- package/dist/types/web/pdf_scripting_manager.component.d.ts +5 -0
- package/dist/types/web/pdf_scripting_manager.d.ts +61 -0
- package/dist/types/web/pdf_single_page_viewer.d.ts +7 -0
- package/dist/types/web/pdf_thumbnail_view.d.ts +131 -0
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +104 -0
- package/dist/types/web/pdf_viewer.component.d.ts +24 -0
- package/dist/types/web/pdf_viewer.d.ts +455 -0
- package/dist/types/web/struct_tree_layer_builder.d.ts +7 -0
- package/dist/types/web/text_accessibility.d.ts +42 -0
- package/dist/types/web/text_highlighter.d.ts +63 -0
- package/dist/types/web/text_layer_builder.d.ts +64 -0
- package/dist/types/web/ui_utils.d.ts +288 -0
- package/dist/types/web/xfa_layer_builder.d.ts +41 -0
- package/package.json +67 -41
- package/dist/shared/unpdf.3dcacb97.mjs +0 -49
- package/dist/shared/unpdf.42987ff1.cjs +0 -52
- package/dist/shared/unpdf.ab6a2535.mjs +0 -46
- package/dist/shared/unpdf.eba9a3dc.cjs +0 -53
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** @implements {IPDFStream} */
|
|
2
|
+
export class PDFDataTransportStream implements IPDFStream {
|
|
3
|
+
constructor({ length, initialData, progressiveDone, contentDispositionFilename, disableRange, disableStream, }: {
|
|
4
|
+
length: any;
|
|
5
|
+
initialData: any;
|
|
6
|
+
progressiveDone?: boolean | undefined;
|
|
7
|
+
contentDispositionFilename?: null | undefined;
|
|
8
|
+
disableRange?: boolean | undefined;
|
|
9
|
+
disableStream?: boolean | undefined;
|
|
10
|
+
}, pdfDataRangeTransport: any);
|
|
11
|
+
_queuedChunks: ArrayBuffer[];
|
|
12
|
+
_progressiveDone: boolean;
|
|
13
|
+
_contentDispositionFilename: any;
|
|
14
|
+
_pdfDataRangeTransport: any;
|
|
15
|
+
_isStreamingSupported: boolean;
|
|
16
|
+
_isRangeSupported: boolean;
|
|
17
|
+
_contentLength: any;
|
|
18
|
+
_fullRequestReader: any;
|
|
19
|
+
_rangeReaders: any[];
|
|
20
|
+
_onReceiveData({ begin, chunk }: {
|
|
21
|
+
begin: any;
|
|
22
|
+
chunk: any;
|
|
23
|
+
}): void;
|
|
24
|
+
get _progressiveDataLength(): any;
|
|
25
|
+
_onProgress(evt: any): void;
|
|
26
|
+
_onProgressiveDone(): void;
|
|
27
|
+
_removeRangeReader(reader: any): void;
|
|
28
|
+
getFullReader(): PDFDataTransportStreamReader;
|
|
29
|
+
getRangeReader(begin: any, end: any): PDFDataTransportStreamRangeReader | null;
|
|
30
|
+
cancelAllRequests(reason: any): void;
|
|
31
|
+
}
|
|
32
|
+
/** @implements {IPDFStreamReader} */
|
|
33
|
+
declare class PDFDataTransportStreamReader implements IPDFStreamReader {
|
|
34
|
+
constructor(stream: any, queuedChunks: any, progressiveDone?: boolean, contentDispositionFilename?: null);
|
|
35
|
+
_stream: any;
|
|
36
|
+
_done: boolean;
|
|
37
|
+
_filename: any;
|
|
38
|
+
_queuedChunks: any;
|
|
39
|
+
_loaded: number;
|
|
40
|
+
_requests: any[];
|
|
41
|
+
_headersReady: Promise<void>;
|
|
42
|
+
onProgress: any;
|
|
43
|
+
_enqueue(chunk: any): void;
|
|
44
|
+
get headersReady(): Promise<void>;
|
|
45
|
+
get filename(): any;
|
|
46
|
+
get isRangeSupported(): any;
|
|
47
|
+
get isStreamingSupported(): any;
|
|
48
|
+
get contentLength(): any;
|
|
49
|
+
read(): Promise<any>;
|
|
50
|
+
cancel(reason: any): void;
|
|
51
|
+
progressiveDone(): void;
|
|
52
|
+
}
|
|
53
|
+
/** @implements {IPDFStreamRangeReader} */
|
|
54
|
+
declare class PDFDataTransportStreamRangeReader implements IPDFStreamRangeReader {
|
|
55
|
+
constructor(stream: any, begin: any, end: any);
|
|
56
|
+
_stream: any;
|
|
57
|
+
_begin: any;
|
|
58
|
+
_end: any;
|
|
59
|
+
_queuedChunk: any;
|
|
60
|
+
_requests: any[];
|
|
61
|
+
_done: boolean;
|
|
62
|
+
onProgress: any;
|
|
63
|
+
_enqueue(chunk: any): void;
|
|
64
|
+
get isStreamingSupported(): boolean;
|
|
65
|
+
read(): Promise<any>;
|
|
66
|
+
cancel(reason: any): void;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type GlobalWorkerOptionsType = {
|
|
2
|
+
/**
|
|
3
|
+
* - Defines global port for worker
|
|
4
|
+
* process. Overrides the `workerSrc` option.
|
|
5
|
+
*/
|
|
6
|
+
workerPort: Worker | null;
|
|
7
|
+
/**
|
|
8
|
+
* - A string containing the path and filename
|
|
9
|
+
* of the worker file.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: The `workerSrc` option should always be set, in order to prevent any
|
|
12
|
+
* issues when using the PDF.js library.
|
|
13
|
+
*/
|
|
14
|
+
workerSrc: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {Object} GlobalWorkerOptionsType
|
|
18
|
+
* @property {Worker | null} workerPort - Defines global port for worker
|
|
19
|
+
* process. Overrides the `workerSrc` option.
|
|
20
|
+
* @property {string} workerSrc - A string containing the path and filename
|
|
21
|
+
* of the worker file.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: The `workerSrc` option should always be set, in order to prevent any
|
|
24
|
+
* issues when using the PDF.js library.
|
|
25
|
+
*/
|
|
26
|
+
/** @type {GlobalWorkerOptionsType} */
|
|
27
|
+
export const GlobalWorkerOptions: GlobalWorkerOptionsType;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type PageViewport = import("./display_utils").PageViewport;
|
|
2
|
+
export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
|
|
3
|
+
export type XfaLayerParameters = {
|
|
4
|
+
viewport: PageViewport;
|
|
5
|
+
div: HTMLDivElement;
|
|
6
|
+
xfaHtml: Object;
|
|
7
|
+
annotationStorage?: any;
|
|
8
|
+
linkService: IPDFLinkService;
|
|
9
|
+
/**
|
|
10
|
+
* - (default value is 'display').
|
|
11
|
+
*/
|
|
12
|
+
intent?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {Object} XfaLayerParameters
|
|
16
|
+
* @property {PageViewport} viewport
|
|
17
|
+
* @property {HTMLDivElement} div
|
|
18
|
+
* @property {Object} xfaHtml
|
|
19
|
+
* @property {AnnotationStorage} [annotationStorage]
|
|
20
|
+
* @property {IPDFLinkService} linkService
|
|
21
|
+
* @property {string} [intent] - (default value is 'display').
|
|
22
|
+
*/
|
|
23
|
+
export class XfaLayer {
|
|
24
|
+
static setupStorage(html: any, id: any, element: any, storage: any, intent: any): void;
|
|
25
|
+
static setAttributes({ html, element, storage, intent, linkService }: {
|
|
26
|
+
html: any;
|
|
27
|
+
element: any;
|
|
28
|
+
storage?: null | undefined;
|
|
29
|
+
intent: any;
|
|
30
|
+
linkService: any;
|
|
31
|
+
}): void;
|
|
32
|
+
/**
|
|
33
|
+
* Render the XFA layer.
|
|
34
|
+
*
|
|
35
|
+
* @param {XfaLayerParameters} parameters
|
|
36
|
+
*/
|
|
37
|
+
static render(parameters: XfaLayerParameters): {
|
|
38
|
+
textDivs: Text[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Update the XFA layer.
|
|
42
|
+
*
|
|
43
|
+
* @param {XfaLayerParameters} parameters
|
|
44
|
+
*/
|
|
45
|
+
static update(parameters: XfaLayerParameters): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class XfaText {
|
|
2
|
+
/**
|
|
3
|
+
* Walk an XFA tree and create an array of text nodes that is compatible
|
|
4
|
+
* with a regular PDFs TextContent. Currently, only TextItem.str is supported,
|
|
5
|
+
* all other fields and styles haven't been implemented.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} xfa - An XFA fake DOM object.
|
|
8
|
+
*
|
|
9
|
+
* @returns {TextContent}
|
|
10
|
+
*/
|
|
11
|
+
static textContent(xfa: Object): TextContent;
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} name - DOM node name. (lower case)
|
|
14
|
+
*
|
|
15
|
+
* @returns {boolean} true if the DOM node should have a corresponding text
|
|
16
|
+
* node.
|
|
17
|
+
*/
|
|
18
|
+
static shouldBuildText(name: string): boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type OnProgressParameters = import("./display/api").OnProgressParameters;
|
|
2
|
+
export type PDFDocumentLoadingTask = import("./display/api").PDFDocumentLoadingTask;
|
|
3
|
+
export type PDFDocumentProxy = import("./display/api").PDFDocumentProxy;
|
|
4
|
+
export type PDFPageProxy = import("./display/api").PDFPageProxy;
|
|
5
|
+
export type RenderTask = import("./display/api").RenderTask;
|
|
6
|
+
export type PageViewport = import("./display/display_utils").PageViewport;
|
|
7
|
+
export type TextLayerRenderTask = import("./display/text_layer").TextLayerRenderTask;
|
|
8
|
+
import { AbortException } from "./shared/util.js";
|
|
9
|
+
import { AnnotationEditorLayer } from "./display/editor/annotation_editor_layer.js";
|
|
10
|
+
import { AnnotationEditorParamsType } from "./shared/util.js";
|
|
11
|
+
import { AnnotationEditorType } from "./shared/util.js";
|
|
12
|
+
import { AnnotationEditorUIManager } from "./display/editor/tools.js";
|
|
13
|
+
import { AnnotationLayer } from "./display/annotation_layer.js";
|
|
14
|
+
import { AnnotationMode } from "./shared/util.js";
|
|
15
|
+
import { build } from "./display/api.js";
|
|
16
|
+
import { CMapCompressionType } from "./shared/util.js";
|
|
17
|
+
import { createValidAbsoluteUrl } from "./shared/util.js";
|
|
18
|
+
import { FeatureTest } from "./shared/util.js";
|
|
19
|
+
import { getDocument } from "./display/api.js";
|
|
20
|
+
import { getFilenameFromUrl } from "./display/display_utils.js";
|
|
21
|
+
import { getPdfFilenameFromUrl } from "./display/display_utils.js";
|
|
22
|
+
import { getXfaPageViewport } from "./display/display_utils.js";
|
|
23
|
+
import { GlobalWorkerOptions } from "./display/worker_options.js";
|
|
24
|
+
import { ImageKind } from "./shared/util.js";
|
|
25
|
+
import { InvalidPDFException } from "./shared/util.js";
|
|
26
|
+
import { isDataScheme } from "./display/display_utils.js";
|
|
27
|
+
import { isPdfFile } from "./display/display_utils.js";
|
|
28
|
+
import { loadScript } from "./display/display_utils.js";
|
|
29
|
+
import { MissingPDFException } from "./shared/util.js";
|
|
30
|
+
import { normalizeUnicode } from "./shared/util.js";
|
|
31
|
+
import { OPS } from "./shared/util.js";
|
|
32
|
+
import { PasswordResponses } from "./shared/util.js";
|
|
33
|
+
import { PDFDataRangeTransport } from "./display/api.js";
|
|
34
|
+
import { PDFDateString } from "./display/display_utils.js";
|
|
35
|
+
import { PDFWorker } from "./display/api.js";
|
|
36
|
+
import { PermissionFlag } from "./shared/util.js";
|
|
37
|
+
import { PixelsPerInch } from "./display/display_utils.js";
|
|
38
|
+
import { PromiseCapability } from "./shared/util.js";
|
|
39
|
+
import { RenderingCancelledException } from "./display/display_utils.js";
|
|
40
|
+
import { renderTextLayer } from "./display/text_layer.js";
|
|
41
|
+
import { setLayerDimensions } from "./display/display_utils.js";
|
|
42
|
+
import { shadow } from "./shared/util.js";
|
|
43
|
+
import { SVGGraphics } from "./display/api.js";
|
|
44
|
+
import { UnexpectedResponseException } from "./shared/util.js";
|
|
45
|
+
import { updateTextLayer } from "./display/text_layer.js";
|
|
46
|
+
import { Util } from "./shared/util.js";
|
|
47
|
+
import { VerbosityLevel } from "./shared/util.js";
|
|
48
|
+
import { version } from "./display/api.js";
|
|
49
|
+
import { XfaLayer } from "./display/xfa_layer.js";
|
|
50
|
+
export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, build, CMapCompressionType, createValidAbsoluteUrl, FeatureTest, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, loadScript, MissingPDFException, normalizeUnicode, OPS, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, PromiseCapability, RenderingCancelledException, renderTextLayer, setLayerDimensions, shadow, SVGGraphics, UnexpectedResponseException, updateTextLayer, Util, VerbosityLevel, version, XfaLayer };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function convertBlackAndWhiteToRGBA({ src, srcPos, dest, width, height, nonBlackColor, inverseDecode, }: {
|
|
2
|
+
src: any;
|
|
3
|
+
srcPos?: number | undefined;
|
|
4
|
+
dest: any;
|
|
5
|
+
width: any;
|
|
6
|
+
height: any;
|
|
7
|
+
nonBlackColor?: number | undefined;
|
|
8
|
+
inverseDecode?: boolean | undefined;
|
|
9
|
+
}): {
|
|
10
|
+
srcPos: number;
|
|
11
|
+
destPos: number;
|
|
12
|
+
};
|
|
13
|
+
export function convertToRGBA(params: any): {
|
|
14
|
+
srcPos: number;
|
|
15
|
+
destPos: number;
|
|
16
|
+
} | null;
|
|
17
|
+
export function grayToRGBA(src: any, dest: any): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export class MessageHandler {
|
|
2
|
+
constructor(sourceName: any, targetName: any, comObj: any);
|
|
3
|
+
sourceName: any;
|
|
4
|
+
targetName: any;
|
|
5
|
+
comObj: any;
|
|
6
|
+
callbackId: number;
|
|
7
|
+
streamId: number;
|
|
8
|
+
streamSinks: any;
|
|
9
|
+
streamControllers: any;
|
|
10
|
+
callbackCapabilities: any;
|
|
11
|
+
actionHandler: any;
|
|
12
|
+
_onComObjOnMessage: (event: any) => void;
|
|
13
|
+
on(actionName: any, handler: any): void;
|
|
14
|
+
/**
|
|
15
|
+
* Sends a message to the comObj to invoke the action with the supplied data.
|
|
16
|
+
* @param {string} actionName - Action to call.
|
|
17
|
+
* @param {JSON} data - JSON data to send.
|
|
18
|
+
* @param {Array} [transfers] - List of transfers/ArrayBuffers.
|
|
19
|
+
*/
|
|
20
|
+
send(actionName: string, data: JSON, transfers?: any[] | undefined): void;
|
|
21
|
+
/**
|
|
22
|
+
* Sends a message to the comObj to invoke the action with the supplied data.
|
|
23
|
+
* Expects that the other side will callback with the response.
|
|
24
|
+
* @param {string} actionName - Action to call.
|
|
25
|
+
* @param {JSON} data - JSON data to send.
|
|
26
|
+
* @param {Array} [transfers] - List of transfers/ArrayBuffers.
|
|
27
|
+
* @returns {Promise} Promise to be resolved with response data.
|
|
28
|
+
*/
|
|
29
|
+
sendWithPromise(actionName: string, data: JSON, transfers?: any[] | undefined): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Sends a message to the comObj to invoke the action with the supplied data.
|
|
32
|
+
* Expect that the other side will callback to signal 'start_complete'.
|
|
33
|
+
* @param {string} actionName - Action to call.
|
|
34
|
+
* @param {JSON} data - JSON data to send.
|
|
35
|
+
* @param {Object} queueingStrategy - Strategy to signal backpressure based on
|
|
36
|
+
* internal queue.
|
|
37
|
+
* @param {Array} [transfers] - List of transfers/ArrayBuffers.
|
|
38
|
+
* @returns {ReadableStream} ReadableStream to read data in chunks.
|
|
39
|
+
*/
|
|
40
|
+
sendWithStream(actionName: string, data: JSON, queueingStrategy: Object, transfers?: any[] | undefined): ReadableStream;
|
|
41
|
+
destroy(): void;
|
|
42
|
+
#private;
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class ColorConverters {
|
|
2
|
+
static CMYK_G([c, y, m, k]: [any, any, any, any]): (string | number)[];
|
|
3
|
+
static G_CMYK([g]: [any]): (string | number)[];
|
|
4
|
+
static G_RGB([g]: [any]): any[];
|
|
5
|
+
static G_rgb([g]: [any]): any[];
|
|
6
|
+
static G_HTML([g]: [any]): string;
|
|
7
|
+
static RGB_G([r, g, b]: [any, any, any]): (string | number)[];
|
|
8
|
+
static RGB_rgb(color: any): any;
|
|
9
|
+
static RGB_HTML(color: any): string;
|
|
10
|
+
static T_HTML(): string;
|
|
11
|
+
static T_rgb(): null[];
|
|
12
|
+
static CMYK_RGB([c, y, m, k]: [any, any, any, any]): (string | number)[];
|
|
13
|
+
static CMYK_rgb([c, y, m, k]: [any, any, any, any]): number[];
|
|
14
|
+
static CMYK_HTML(components: any): string;
|
|
15
|
+
static RGB_CMYK([r, g, b]: [any, any, any]): (string | number)[];
|
|
16
|
+
}
|