@chialab/pdfjs-lib 1.0.0-alpha.29 → 1.0.0-alpha.30

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.
Files changed (40) hide show
  1. package/dist/browser/{chunk-W35PJZ6L.js → chunk-R7G44NYV.js} +521 -3
  2. package/dist/browser/index.js +2329 -969
  3. package/dist/browser/openjpeg-Q27OVS4T.js +9 -0
  4. package/dist/browser/worker.js +594 -609
  5. package/dist/index.d.ts +1 -1
  6. package/dist/lib/TextLayer.d.ts +4 -0
  7. package/dist/node/{NodeUtils-ZPPZPJWD.js → NodeUtils-PVXQMWFJ.js} +2 -2
  8. package/dist/node/{chunk-GWGW2EKY.js → chunk-4Y7OZIIX.js} +520 -2
  9. package/dist/node/{chunk-D4U3W2CD.js → chunk-O74KGUUC.js} +451 -1
  10. package/dist/node/{chunk-FHASHZBJ.js → chunk-T2JWSGAF.js} +2 -2
  11. package/dist/node/index.js +1896 -972
  12. package/dist/node/openjpeg-QFJSFVSJ.js +9 -0
  13. package/dist/node/worker.js +595 -610
  14. package/dist/pdf.js/external/openjpeg/openjpeg.d.ts +1 -1
  15. package/dist/pdf.js/src/core/fonts.d.ts +7 -1
  16. package/dist/pdf.js/src/display/annotation_layer.d.ts +28 -6
  17. package/dist/pdf.js/src/display/annotation_storage.d.ts +2 -0
  18. package/dist/pdf.js/src/display/api.d.ts +13 -7
  19. package/dist/pdf.js/src/display/canvas.d.ts +1 -1
  20. package/dist/pdf.js/src/display/canvas_dependency_tracker.d.ts +36 -20
  21. package/dist/pdf.js/src/display/display_utils.d.ts +22 -0
  22. package/dist/pdf.js/src/display/editor/annotation_editor_layer.d.ts +4 -2
  23. package/dist/pdf.js/src/display/editor/comment.d.ts +20 -5
  24. package/dist/pdf.js/src/display/editor/drawers/freedraw.d.ts +1 -0
  25. package/dist/pdf.js/src/display/editor/drawers/highlight.d.ts +2 -1
  26. package/dist/pdf.js/src/display/editor/editor.d.ts +67 -15
  27. package/dist/pdf.js/src/display/editor/freetext.d.ts +1 -1
  28. package/dist/pdf.js/src/display/editor/highlight.d.ts +3 -1
  29. package/dist/pdf.js/src/display/editor/ink.d.ts +2 -1
  30. package/dist/pdf.js/src/display/editor/signature.d.ts +0 -5
  31. package/dist/pdf.js/src/display/editor/toolbar.d.ts +3 -1
  32. package/dist/pdf.js/src/display/editor/tools.d.ts +21 -3
  33. package/dist/pdf.js/src/display/font_loader.d.ts +27 -1
  34. package/dist/pdf.js/src/display/pattern_helper.d.ts +2 -2
  35. package/dist/pdf.js/src/pdf.d.ts +5 -1
  36. package/dist/pdf.js/src/shared/obj-bin-transform.d.ts +64 -0
  37. package/dist/pdf.js/web/comment_manager.d.ts +20 -0
  38. package/package.json +1 -1
  39. package/dist/browser/openjpeg-QLA762TL.js +0 -9
  40. package/dist/node/openjpeg-TRZ4ANDN.js +0 -9
@@ -24,7 +24,8 @@ export class InkEditor extends DrawingEditor {
24
24
  /** @inheritdoc */
25
25
  get toolbarButtons(): (string | null)[][];
26
26
  get colorType(): number;
27
- get colorValue(): any;
27
+ get color(): any;
28
+ get opacity(): any;
28
29
  /** @inheritdoc */
29
30
  createDrawingOptions({ color, thickness, opacity }: {
30
31
  color: any;
@@ -66,15 +66,10 @@ export class SignatureEditor extends DrawingEditor {
66
66
  _drawingOptions: any;
67
67
  /** @inheritdoc */
68
68
  serialize(isForCopying?: boolean): {
69
- annotationType: number;
70
69
  isSignature: boolean;
71
70
  areContours: boolean;
72
71
  color: number[];
73
72
  thickness: any;
74
- pageIndex: number;
75
- rect: any;
76
- rotation: number;
77
- structTreeParentId: any;
78
73
  } | null;
79
74
  #private;
80
75
  }
@@ -8,10 +8,12 @@ export class EditorToolbar {
8
8
  show(): void;
9
9
  addDeleteButton(): void;
10
10
  addAltText(altText: any): Promise<void>;
11
- addComment(comment: any): void;
11
+ addComment(comment: any, beforeElement?: null): void;
12
12
  addColorPicker(colorPicker: any): void;
13
13
  addEditSignatureButton(signatureManager: any): Promise<void>;
14
+ removeButton(name: any): void;
14
15
  addButton(name: any, tool: any): Promise<void>;
16
+ addButtonBefore(name: any, tool: any, beforeSelector: any): Promise<void>;
15
17
  updateEditSignatureButton(description: any): void;
16
18
  remove(): void;
17
19
  #private;
@@ -42,7 +42,15 @@ export class AnnotationEditorUIManager {
42
42
  setMainHighlightColorPicker(colorPicker: any): void;
43
43
  editAltText(editor: any, firstTime?: boolean): void;
44
44
  hasCommentManager(): boolean;
45
- editComment(editor: any, position: any): void;
45
+ editComment(editor: any, posX: any, posY: any, options: any): void;
46
+ selectComment(pageIndex: any, uid: any): void;
47
+ updateComment(editor: any): void;
48
+ updatePopupColor(editor: any): void;
49
+ removeComment(editor: any): void;
50
+ toggleComment(editor: any, isSelected: any, visibility?: undefined): void;
51
+ makeCommentColor(color: any, opacity: any): any;
52
+ getCommentDialogElement(): any;
53
+ waitForEditorsRendered(pageNumber: any): Promise<void>;
46
54
  getSignature(editor: any): void;
47
55
  get signatureManager(): null;
48
56
  switchToMode(mode: any, callback: any): void;
@@ -67,6 +75,15 @@ export class AnnotationEditorUIManager {
67
75
  }): void;
68
76
  highlightSelection(methodOfCreation?: string, comment?: boolean): void;
69
77
  commentSelection(methodOfCreation?: string): void;
78
+ /**
79
+ * Some annotations may have been modified in the annotation layer
80
+ * (e.g. comments added or modified).
81
+ * So this function retrieves the data from the storage and removes
82
+ * them from the storage in order to be able to save them later.
83
+ * @param {string} annotationId
84
+ * @returns {Object|null} The data associated to the annotation or null.
85
+ */
86
+ getAndRemoveDataFromAnnotationStorage(annotationId: string): Object | null;
70
87
  /**
71
88
  * Add an editor in the annotation storage.
72
89
  * @param {AnnotationEditor} editor
@@ -173,9 +190,9 @@ export class AnnotationEditorUIManager {
173
190
  /**
174
191
  * Get all the editors belonging to a given page.
175
192
  * @param {number} pageIndex
176
- * @returns {Array<AnnotationEditor>}
193
+ * @yields {AnnotationEditor}
177
194
  */
178
- getEditors(pageIndex: number): Array<AnnotationEditor>;
195
+ getEditors(pageIndex: number): Generator<any, void, unknown>;
179
196
  /**
180
197
  * Get an editor with the given id.
181
198
  * @param {string} id
@@ -309,6 +326,7 @@ export class AnnotationEditorUIManager {
309
326
  * @returns {number}
310
327
  */
311
328
  getMode(): number;
329
+ isEditingMode(): boolean;
312
330
  get imageManager(): any;
313
331
  getSelectionBoxes(textLayer: any): {
314
332
  x: number;
@@ -1,10 +1,36 @@
1
1
  export class FontFaceObject {
2
- constructor(translatedData: any, inspectFont?: null);
2
+ constructor(translatedData: any, inspectFont: null | undefined, extra: any, charProcOperatorList: any);
3
3
  compiledGlyphs: any;
4
4
  _inspectFont: any;
5
+ charProcOperatorList: any;
5
6
  createNativeFontFace(): FontFace | null;
6
7
  createFontFaceRule(): string | null;
7
8
  getPathGenerator(objs: any, character: any): any;
9
+ get black(): any;
10
+ get bold(): any;
11
+ get disableFontFace(): any;
12
+ get fontExtraProperties(): any;
13
+ get isInvalidPDFjsFont(): any;
14
+ get isType3Font(): any;
15
+ get italic(): any;
16
+ get missingFile(): any;
17
+ get remeasure(): any;
18
+ get vertical(): any;
19
+ get ascent(): any;
20
+ get defaultWidth(): any;
21
+ get descent(): any;
22
+ get bbox(): any;
23
+ get fontMatrix(): any;
24
+ get fallbackName(): any;
25
+ get loadedName(): any;
26
+ get mimetype(): any;
27
+ get name(): any;
28
+ get data(): any;
29
+ clearData(): void;
30
+ get cssFontInfo(): any;
31
+ get systemFontInfo(): any;
32
+ get defaultVMetrics(): any;
33
+ #private;
8
34
  }
9
35
  export class FontLoader {
10
36
  constructor({ ownerDocument, styleElement, }: {
@@ -18,7 +18,7 @@ export class TilingPattern {
18
18
  ctx: any;
19
19
  canvasGraphicsFactory: any;
20
20
  baseTransform: any;
21
- createPatternCanvas(owner: any): {
21
+ createPatternCanvas(owner: any, opIdx: any): {
22
22
  canvas: any;
23
23
  scaleX: any;
24
24
  scaleY: any;
@@ -32,7 +32,7 @@ export class TilingPattern {
32
32
  clipBbox(graphics: any, x0: any, y0: any, x1: any, y1: any): void;
33
33
  setFillAndStrokeStyleToContext(graphics: any, paintType: any, color: any): void;
34
34
  isModifyingCurrentTransform(): boolean;
35
- getPattern(ctx: any, owner: any, inverse: any, pathType: any): any;
35
+ getPattern(ctx: any, owner: any, inverse: any, pathType: any, opIdx: any): any;
36
36
  }
37
37
  declare class RadialAxialShadingPattern extends BaseShadingPattern {
38
38
  constructor(IR: any);
@@ -12,13 +12,16 @@ import { AnnotationEditorUIManager } from "./display/editor/tools.js";
12
12
  import { AnnotationLayer } from "./display/annotation_layer.js";
13
13
  import { AnnotationMode } from "./shared/util.js";
14
14
  import { AnnotationType } from "./shared/util.js";
15
+ import { applyOpacity } from "./display/display_utils.js";
15
16
  import { build } from "./display/api.js";
16
17
  import { ColorPicker } from "./display/editor/color_picker.js";
17
18
  import { createValidAbsoluteUrl } from "./shared/util.js";
19
+ import { CSSConstants } from "./display/display_utils.js";
18
20
  import { DOMSVGFactory } from "./display/svg_factory.js";
19
21
  import { DrawLayer } from "./display/draw_layer.js";
20
22
  import { FeatureTest } from "./shared/util.js";
21
23
  import { fetchData } from "./display/display_utils.js";
24
+ import { findContrastColor } from "./display/display_utils.js";
22
25
  import { getDocument } from "./display/api.js";
23
26
  import { getFilenameFromUrl } from "./display/display_utils.js";
24
27
  import { getPdfFilenameFromUrl } from "./display/display_utils.js";
@@ -43,6 +46,7 @@ import { PDFWorker } from "./display/api.js";
43
46
  import { PermissionFlag } from "./shared/util.js";
44
47
  import { PixelsPerInch } from "./display/display_utils.js";
45
48
  import { RenderingCancelledException } from "./display/display_utils.js";
49
+ import { renderRichText } from "./display/display_utils.js";
46
50
  import { ResponseException } from "./shared/util.js";
47
51
  import { setLayerDimensions } from "./display/display_utils.js";
48
52
  import { shadow } from "./shared/util.js";
@@ -56,4 +60,4 @@ import { Util } from "./shared/util.js";
56
60
  import { VerbosityLevel } from "./shared/util.js";
57
61
  import { version } from "./display/api.js";
58
62
  import { XfaLayer } from "./display/xfa_layer.js";
59
- export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, build, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getUuid, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
63
+ export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, applyOpacity, build, ColorPicker, createValidAbsoluteUrl, CSSConstants, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, findContrastColor, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getUuid, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderRichText, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
@@ -0,0 +1,64 @@
1
+ export class CssFontInfo {
2
+ static strings: string[];
3
+ static write(info: any): ArrayBuffer;
4
+ constructor(buffer: any);
5
+ get fontFamily(): string;
6
+ get fontWeight(): string;
7
+ get italicAngle(): string;
8
+ #private;
9
+ }
10
+ export class FontInfo {
11
+ static bools: string[];
12
+ static numbers: string[];
13
+ static strings: string[];
14
+ static "__#private@#OFFSET_NUMBERS": number;
15
+ static "__#private@#OFFSET_BBOX": number;
16
+ static "__#private@#OFFSET_FONT_MATRIX": number;
17
+ static "__#private@#OFFSET_DEFAULT_VMETRICS": number;
18
+ static "__#private@#OFFSET_STRINGS": number;
19
+ static write(font: any): ArrayBuffer;
20
+ constructor({ data, extra }: {
21
+ data: any;
22
+ extra: any;
23
+ });
24
+ get black(): boolean | undefined;
25
+ get bold(): boolean | undefined;
26
+ get disableFontFace(): boolean | undefined;
27
+ get fontExtraProperties(): boolean | undefined;
28
+ get isInvalidPDFjsFont(): boolean | undefined;
29
+ get isType3Font(): boolean | undefined;
30
+ get italic(): boolean | undefined;
31
+ get missingFile(): boolean | undefined;
32
+ get remeasure(): boolean | undefined;
33
+ get vertical(): boolean | undefined;
34
+ get ascent(): number;
35
+ get defaultWidth(): number;
36
+ get descent(): number;
37
+ get bbox(): number[] | undefined;
38
+ get fontMatrix(): number[] | undefined;
39
+ get defaultVMetrics(): number[] | undefined;
40
+ get fallbackName(): string;
41
+ get loadedName(): string;
42
+ get mimetype(): string;
43
+ get name(): string;
44
+ get data(): Uint8Array<any> | undefined;
45
+ clearData(): void;
46
+ get cssFontInfo(): CssFontInfo | null;
47
+ get systemFontInfo(): SystemFontInfo | null;
48
+ #private;
49
+ }
50
+ export class SystemFontInfo {
51
+ static strings: string[];
52
+ static write(info: any): ArrayBuffer;
53
+ constructor(buffer: any);
54
+ get guessFallback(): boolean;
55
+ get css(): string;
56
+ get loadedName(): string;
57
+ get baseFontName(): string;
58
+ get src(): string;
59
+ get style(): {
60
+ style: string;
61
+ weight: string;
62
+ };
63
+ #private;
64
+ }
@@ -0,0 +1,20 @@
1
+ export class CommentManager {
2
+ static "__#private@#hasForcedColors": null;
3
+ static _makeCommentColor(color: any, opacity: any): any;
4
+ constructor(commentDialog: any, sidebar: any, eventBus: any, linkService: any, overlayManager: any, ltr: any, hasForcedColors: any);
5
+ dialogElement: any;
6
+ setSidebarUiManager(uiManager: any): void;
7
+ showSidebar(annotations: any): void;
8
+ hideSidebar(): void;
9
+ removeComments(ids: any): void;
10
+ selectComment(id: any): void;
11
+ addComment(annotation: any): void;
12
+ updateComment(annotation: any): void;
13
+ toggleCommentPopup(editor: any, isSelected: any, visibility: any, isEditable: any): void;
14
+ destroyPopup(): void;
15
+ updatePopupColor(editor: any): void;
16
+ showDialog(uiManager: any, editor: any, posX: any, posY: any, options: any): Promise<void>;
17
+ makeCommentColor(color: any, opacity: any): any;
18
+ destroy(): void;
19
+ #private;
20
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chialab/pdfjs-lib",
3
3
  "description": "A custom Mozilla's PDF.js build with better Node support and extras.",
4
- "version": "1.0.0-alpha.29",
4
+ "version": "1.0.0-alpha.30",
5
5
  "type": "module",
6
6
  "author": "Chialab <dev@chialab.it>",
7
7
  "license": "MIT",