@embedpdf/engines 2.4.1 → 2.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/dist/{browser-qfUHZxQ6.js → browser-BISJ9naB.js} +3 -3
- package/dist/{browser-qfUHZxQ6.js.map → browser-BISJ9naB.js.map} +1 -1
- package/dist/{direct-engine-5RWKENek.js → direct-engine-CvfzIn2D.js} +648 -228
- package/dist/direct-engine-CvfzIn2D.js.map +1 -0
- package/dist/direct-engine-DITdlET4.cjs +2 -0
- package/dist/direct-engine-DITdlET4.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +10 -10
- package/dist/lib/converters/index.js +3 -3
- package/dist/lib/pdfium/cache.d.ts +9 -1
- package/dist/lib/pdfium/engine.d.ts +97 -4
- package/dist/lib/pdfium/index.cjs +1 -1
- package/dist/lib/pdfium/index.js +11 -11
- package/dist/lib/pdfium/web/direct-engine.cjs +1 -1
- package/dist/lib/pdfium/web/direct-engine.js +4 -4
- package/dist/lib/pdfium/web/worker-engine.cjs +1 -1
- package/dist/lib/pdfium/web/worker-engine.js +3 -3
- package/dist/lib/webworker/engine.js +1 -1
- package/dist/pdf-engine-BmrecQLq.cjs +2 -0
- package/dist/pdf-engine-BmrecQLq.cjs.map +1 -0
- package/dist/{pdf-engine-CVXuu1xQ.js → pdf-engine-aJNoNMbt.js} +3 -2
- package/dist/pdf-engine-aJNoNMbt.js.map +1 -0
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.js +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.js +1 -1
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.js +1 -1
- package/package.json +6 -6
- package/dist/direct-engine-5RWKENek.js.map +0 -1
- package/dist/direct-engine-DnHo6z8a.cjs +0 -2
- package/dist/direct-engine-DnHo6z8a.cjs.map +0 -1
- package/dist/pdf-engine-B4lt8-5f.cjs +0 -2
- package/dist/pdf-engine-B4lt8-5f.cjs.map +0 -1
- package/dist/pdf-engine-CVXuu1xQ.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./lib/pdfium/index.cjs"),r=require("./lib/webworker/engine.cjs"),t=require("@embedpdf/models"),a=require("./direct-engine-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./lib/pdfium/index.cjs"),r=require("./lib/webworker/engine.cjs"),t=require("@embedpdf/models"),a=require("./direct-engine-DITdlET4.cjs"),o=require("./browser-13mzox-R.cjs"),s=require("./pdf-engine-BmrecQLq.cjs"),n=require("./lib/pdfium/web/worker-engine.cjs"),c="WebWorkerEngineRunner",i="Engine";exports.DEFAULT_PDFIUM_WASM_URL=e.DEFAULT_PDFIUM_WASM_URL,exports.FONT_CDN_URLS=e.FONT_CDN_URLS,exports.cdnFontConfig=e.cdnFontConfig,exports.createCdnFontConfig=e.createCdnFontConfig,exports.WebWorkerEngine=r.WebWorkerEngine,exports.WorkerTask=r.WorkerTask,Object.defineProperty(exports,"FontCharset",{enumerable:!0,get:()=>t.FontCharset}),exports.BitmapFormat=a.BitmapFormat,exports.FontFallbackManager=a.FontFallbackManager,exports.PdfiumErrorCode=a.PdfiumErrorCode,exports.PdfiumNative=a.PdfiumNative,exports.RenderFlag=a.RenderFlag,exports.computeFormDrawParams=a.computeFormDrawParams,exports.createNodeFontLoader=a.createNodeFontLoader,exports.createPdfiumDirectEngine=a.createPdfiumEngine,exports.isValidCustomKey=a.isValidCustomKey,exports.readArrayBuffer=a.readArrayBuffer,exports.readString=a.readString,exports.ImageConverterError=o.ImageConverterError,exports.browserImageDataToBlobConverter=o.browserImageDataToBlobConverter,exports.createHybridImageConverter=o.createHybridImageConverter,exports.createWorkerPoolImageConverter=o.createWorkerPoolImageConverter,exports.PdfEngine=s.PdfEngine,exports.createPdfiumWorkerEngine=n.createPdfiumEngine,exports.EngineRunner=class{constructor(e=new t.NoopLogger){this.logger=e,this.execute=async e=>{if(this.logger.debug(c,i,"runner start exeucte request"),!this.engine){const r={type:"reject",reason:{code:t.PdfErrorCode.NotReady,message:"engine has not started yet"}},a={id:e.id,type:"ExecuteResponse",data:{type:"error",value:r}};return void this.respond(a)}const r=this.engine,{name:a,args:o}=e.data;if(!r[a]){const r={type:"reject",reason:{code:t.PdfErrorCode.NotSupport,message:`engine method ${a} is not supported yet`}},o={id:e.id,type:"ExecuteResponse",data:{type:"error",value:r}};return void this.respond(o)}let s;switch(a){case"isSupport":s=r.isSupport(...o);break;case"destroy":s=r.destroy(...o);break;case"openDocumentUrl":s=r.openDocumentUrl(...o);break;case"openDocumentBuffer":s=r.openDocumentBuffer(...o);break;case"getDocPermissions":s=r.getDocPermissions(...o);break;case"getDocUserPermissions":s=r.getDocUserPermissions(...o);break;case"getMetadata":s=r.getMetadata(...o);break;case"setMetadata":s=r.setMetadata(...o);break;case"getBookmarks":s=r.getBookmarks(...o);break;case"setBookmarks":s=r.setBookmarks(...o);break;case"deleteBookmarks":s=r.deleteBookmarks(...o);break;case"getSignatures":s=r.getSignatures(...o);break;case"renderPage":s=r.renderPage(...o);break;case"renderPageRect":s=r.renderPageRect(...o);break;case"renderPageAnnotation":s=r.renderPageAnnotation(...o);break;case"renderThumbnail":s=r.renderThumbnail(...o);break;case"getAllAnnotations":s=r.getAllAnnotations(...o);break;case"getPageAnnotations":s=r.getPageAnnotations(...o);break;case"createPageAnnotation":s=r.createPageAnnotation(...o);break;case"updatePageAnnotation":s=r.updatePageAnnotation(...o);break;case"removePageAnnotation":s=r.removePageAnnotation(...o);break;case"getPageTextRects":s=r.getPageTextRects(...o);break;case"searchAllPages":s=r.searchAllPages(...o);break;case"closeDocument":s=r.closeDocument(...o);break;case"closeAllDocuments":s=r.closeAllDocuments(...o);break;case"saveAsCopy":s=r.saveAsCopy(...o);break;case"getAttachments":s=r.getAttachments(...o);break;case"addAttachment":s=r.addAttachment(...o);break;case"removeAttachment":s=r.removeAttachment(...o);break;case"readAttachmentContent":s=r.readAttachmentContent(...o);break;case"setFormFieldValue":s=r.setFormFieldValue(...o);break;case"flattenPage":s=r.flattenPage(...o);break;case"extractPages":s=r.extractPages(...o);break;case"extractText":s=r.extractText(...o);break;case"redactTextInRects":s=r.redactTextInRects(...o);break;case"applyRedaction":s=r.applyRedaction(...o);break;case"applyAllRedactions":s=r.applyAllRedactions(...o);break;case"flattenAnnotation":s=r.flattenAnnotation(...o);break;case"getTextSlices":s=r.getTextSlices(...o);break;case"getPageGlyphs":s=r.getPageGlyphs(...o);break;case"getPageGeometry":s=r.getPageGeometry(...o);break;case"merge":s=r.merge(...o);break;case"mergePages":s=r.mergePages(...o);break;case"preparePrintDocument":s=r.preparePrintDocument(...o);break;case"setDocumentEncryption":s=r.setDocumentEncryption(...o);break;case"removeEncryption":s=r.removeEncryption(...o);break;case"unlockOwnerPermissions":s=r.unlockOwnerPermissions(...o);break;case"isEncrypted":s=r.isEncrypted(...o);break;case"isOwnerUnlocked":s=r.isOwnerUnlocked(...o);break;default:const n={type:"reject",reason:{code:t.PdfErrorCode.NotSupport,message:`engine method ${a} is not supported`}},c={id:e.id,type:"ExecuteResponse",data:{type:"error",value:n}};return void this.respond(c)}s.onProgress(r=>{const t={id:e.id,type:"ExecuteProgress",data:r};this.respond(t)}),s.wait(r=>{const t={id:e.id,type:"ExecuteResponse",data:{type:"result",value:r}};this.respond(t)},r=>{const t={id:e.id,type:"ExecuteResponse",data:{type:"error",value:r}};this.respond(t)})}}listen(){self.onmessage=e=>this.handle(e)}handle(e){this.logger.debug(c,i,"webworker receive message event: ",e.data);try{const r=e.data;if("ExecuteRequest"===r.type)this.execute(r)}catch(r){this.logger.info(c,i,"webworker met error when processing message event:",r)}}ready(){this.listen(),this.respond({id:"0",type:"ReadyResponse"}),this.logger.debug(c,i,"runner is ready")}respond(e){this.logger.debug(c,i,"runner respond: ",e),self.postMessage(e)}};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import { DEFAULT_PDFIUM_WASM_URL, FONT_CDN_URLS, cdnFontConfig, createCdnFontCon
|
|
|
2
2
|
import { WebWorkerEngine, WorkerTask } from "./lib/webworker/engine.js";
|
|
3
3
|
import { NoopLogger, PdfErrorCode } from "@embedpdf/models";
|
|
4
4
|
import { FontCharset } from "@embedpdf/models";
|
|
5
|
-
import { B, F, P, a, R,
|
|
5
|
+
import { B, F, P, a, R, c, b, d, i, r, e } from "./direct-engine-CvfzIn2D.js";
|
|
6
|
+
import { I, b as b2, c as c2, a as a2 } from "./browser-BISJ9naB.js";
|
|
7
|
+
import { P as P2 } from "./pdf-engine-aJNoNMbt.js";
|
|
6
8
|
import { createPdfiumEngine } from "./lib/pdfium/web/worker-engine.js";
|
|
7
|
-
import { I, b as b2, a as a2, c as c2 } from "./browser-qfUHZxQ6.js";
|
|
8
|
-
import { P as P2 } from "./pdf-engine-CVXuu1xQ.js";
|
|
9
9
|
const LOG_SOURCE = "WebWorkerEngineRunner";
|
|
10
10
|
const LOG_CATEGORY = "Engine";
|
|
11
11
|
class EngineRunner {
|
|
@@ -329,15 +329,15 @@ export {
|
|
|
329
329
|
WorkerTask,
|
|
330
330
|
b2 as browserImageDataToBlobConverter,
|
|
331
331
|
cdnFontConfig,
|
|
332
|
-
|
|
332
|
+
c as computeFormDrawParams,
|
|
333
333
|
createCdnFontConfig,
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
334
|
+
c2 as createHybridImageConverter,
|
|
335
|
+
b as createNodeFontLoader,
|
|
336
|
+
d as createPdfiumDirectEngine,
|
|
337
337
|
createPdfiumEngine as createPdfiumWorkerEngine,
|
|
338
|
-
|
|
338
|
+
a2 as createWorkerPoolImageConverter,
|
|
339
339
|
i as isValidCustomKey,
|
|
340
|
-
|
|
341
|
-
|
|
340
|
+
r as readArrayBuffer,
|
|
341
|
+
e as readString
|
|
342
342
|
};
|
|
343
343
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I, b,
|
|
1
|
+
import { I, b, c, a } from "../../browser-BISJ9naB.js";
|
|
2
2
|
function toArrayBuffer(view) {
|
|
3
3
|
const { buffer, byteOffset, byteLength } = view;
|
|
4
4
|
if (buffer instanceof ArrayBuffer) {
|
|
@@ -83,9 +83,9 @@ export {
|
|
|
83
83
|
b as browserImageDataToBlobConverter,
|
|
84
84
|
createCustomImageDataToBlobConverter,
|
|
85
85
|
createCustomImageDataToBufferConverter,
|
|
86
|
-
|
|
86
|
+
c as createHybridImageConverter,
|
|
87
87
|
createNodeCanvasImageDataToBlobConverter,
|
|
88
88
|
createNodeImageDataToBufferConverter,
|
|
89
|
-
|
|
89
|
+
a as createWorkerPoolImageConverter
|
|
90
90
|
};
|
|
91
91
|
//# sourceMappingURL=index.js.map
|
|
@@ -5,6 +5,13 @@ export interface CacheConfig {
|
|
|
5
5
|
pageTtl?: number;
|
|
6
6
|
/** Maximum number of pages to keep in cache per document (default: 50) */
|
|
7
7
|
maxPagesPerDocument?: number;
|
|
8
|
+
/**
|
|
9
|
+
* When true, pages are loaded with normalized rotation:
|
|
10
|
+
* - All coordinates (annotations, text, rendering) are in 0° space
|
|
11
|
+
* - The original rotation is preserved for reference
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
normalizeRotation?: boolean;
|
|
8
15
|
}
|
|
9
16
|
export declare class PdfCache {
|
|
10
17
|
private readonly pdfium;
|
|
@@ -13,7 +20,7 @@ export declare class PdfCache {
|
|
|
13
20
|
private readonly config;
|
|
14
21
|
constructor(pdfium: WrappedPdfiumModule, memoryManager: MemoryManager, config?: CacheConfig);
|
|
15
22
|
/** Open (or re-use) a document */
|
|
16
|
-
setDocument(id: string, filePtr: number, docPtr: number): void;
|
|
23
|
+
setDocument(id: string, filePtr: number, docPtr: number, normalizeRotation?: boolean): void;
|
|
17
24
|
/** Retrieve the DocumentContext for a given PdfDocumentObject */
|
|
18
25
|
getContext(docId: string): DocumentContext | undefined;
|
|
19
26
|
/** Close & fully release a document and all its pages */
|
|
@@ -34,6 +41,7 @@ export declare class DocumentContext {
|
|
|
34
41
|
readonly docPtr: number;
|
|
35
42
|
private readonly memoryManager;
|
|
36
43
|
private readonly pageCache;
|
|
44
|
+
readonly normalizeRotation: boolean;
|
|
37
45
|
constructor(filePtr: number, docPtr: number, pdfium: WrappedPdfiumModule, memoryManager: MemoryManager, config: Required<CacheConfig>);
|
|
38
46
|
/** Main accessor for pages */
|
|
39
47
|
acquirePage(pageIdx: number): PageContext;
|
|
@@ -418,7 +418,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
418
418
|
*
|
|
419
419
|
* @private
|
|
420
420
|
*/
|
|
421
|
-
addShapeContent(page: PdfPageObject, pagePtr: number, annotationPtr: number, annotation: PdfCircleAnnoObject | PdfSquareAnnoObject): boolean;
|
|
421
|
+
addShapeContent(doc: PdfDocumentObject, page: PdfPageObject, pagePtr: number, annotationPtr: number, annotation: PdfCircleAnnoObject | PdfSquareAnnoObject): boolean;
|
|
422
422
|
/**
|
|
423
423
|
* Add highlight content to annotation
|
|
424
424
|
* @param page - page info
|
|
@@ -428,7 +428,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
428
428
|
*
|
|
429
429
|
* @private
|
|
430
430
|
*/
|
|
431
|
-
addTextMarkupContent(page: PdfPageObject, pagePtr: number, annotationPtr: number, annotation: PdfHighlightAnnoObject | PdfUnderlineAnnoObject | PdfStrikeOutAnnoObject | PdfSquigglyAnnoObject): boolean;
|
|
431
|
+
addTextMarkupContent(doc: PdfDocumentObject, page: PdfPageObject, pagePtr: number, annotationPtr: number, annotation: PdfHighlightAnnoObject | PdfUnderlineAnnoObject | PdfStrikeOutAnnoObject | PdfSquigglyAnnoObject): boolean;
|
|
432
432
|
/**
|
|
433
433
|
* Add content to redact annotation
|
|
434
434
|
* @param page - page info
|
|
@@ -442,6 +442,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
442
442
|
private addRedactContent;
|
|
443
443
|
/**
|
|
444
444
|
* Add contents to stamp annotation
|
|
445
|
+
* @param doc - pdf document object
|
|
445
446
|
* @param docPtr - pointer to pdf document object
|
|
446
447
|
* @param page - page info
|
|
447
448
|
* @param pagePtr - pointer to page object
|
|
@@ -452,9 +453,10 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
452
453
|
*
|
|
453
454
|
* @private
|
|
454
455
|
*/
|
|
455
|
-
addStampContent(docPtr: number, page: PdfPageObject, pagePtr: number, annotationPtr: number, annotation: PdfStampAnnoObject, imageData?: ImageData): boolean;
|
|
456
|
+
addStampContent(doc: PdfDocumentObject, docPtr: number, page: PdfPageObject, pagePtr: number, annotationPtr: number, annotation: PdfStampAnnoObject, imageData?: ImageData): boolean;
|
|
456
457
|
/**
|
|
457
458
|
* Add image object to annotation
|
|
459
|
+
* @param doc - pdf document object
|
|
458
460
|
* @param docPtr - pointer to pdf document object
|
|
459
461
|
* @param page - page info
|
|
460
462
|
* @param pagePtr - pointer to page object
|
|
@@ -465,7 +467,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
465
467
|
*
|
|
466
468
|
* @private
|
|
467
469
|
*/
|
|
468
|
-
addImageObject(docPtr: number, page: PdfPageObject, pagePtr: number, annotationPtr: number, rect: Rect, imageData: ImageData): boolean;
|
|
470
|
+
addImageObject(doc: PdfDocumentObject, docPtr: number, page: PdfPageObject, pagePtr: number, annotationPtr: number, rect: Rect, imageData: ImageData): boolean;
|
|
469
471
|
/**
|
|
470
472
|
* Save document to array buffer
|
|
471
473
|
* @param docPtr - pointer to pdf document
|
|
@@ -622,6 +624,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
622
624
|
/**
|
|
623
625
|
* Read page annotations
|
|
624
626
|
*
|
|
627
|
+
* @param doc - pdf document object
|
|
625
628
|
* @param ctx - document context
|
|
626
629
|
* @param page - page info
|
|
627
630
|
* @returns annotations on the pdf page
|
|
@@ -632,6 +635,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
632
635
|
/**
|
|
633
636
|
* Read page annotations without loading the page (raw approach)
|
|
634
637
|
*
|
|
638
|
+
* @param doc - pdf document object
|
|
635
639
|
* @param ctx - document context
|
|
636
640
|
* @param page - page info
|
|
637
641
|
* @returns annotations on the pdf page
|
|
@@ -652,6 +656,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
652
656
|
/**
|
|
653
657
|
* Read pdf annotation from pdf document
|
|
654
658
|
*
|
|
659
|
+
* @param doc - pdf document object
|
|
655
660
|
* @param docPtr - pointer to pdf document
|
|
656
661
|
* @param page - page info
|
|
657
662
|
* @param annotationPtr - pointer to pdf annotation
|
|
@@ -661,6 +666,12 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
661
666
|
* @private
|
|
662
667
|
*/
|
|
663
668
|
private readPageAnnotation;
|
|
669
|
+
/**
|
|
670
|
+
* On load, if a vertex-type annotation has rotation metadata in EPDFCustom,
|
|
671
|
+
* reverse-rotate the PDF's physically rotated vertices by -rotation to recover
|
|
672
|
+
* the unrotated vertices for runtime editing.
|
|
673
|
+
*/
|
|
674
|
+
private reverseRotateAnnotationOnLoad;
|
|
664
675
|
/**
|
|
665
676
|
* Return the colour stored directly in the annotation dictionary's `/C` entry.
|
|
666
677
|
*
|
|
@@ -715,6 +726,61 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
715
726
|
* @private
|
|
716
727
|
*/
|
|
717
728
|
private setAnnotationOpacity;
|
|
729
|
+
/**
|
|
730
|
+
* Get the rotation angle (in degrees) from the annotation's /Rotate entry.
|
|
731
|
+
* Returns 0 if no rotation is set or on error.
|
|
732
|
+
*
|
|
733
|
+
* @param annotationPtr - pointer to the annotation
|
|
734
|
+
* @returns rotation in degrees (0 if not set)
|
|
735
|
+
*/
|
|
736
|
+
private getAnnotationRotation;
|
|
737
|
+
/**
|
|
738
|
+
* Set the rotation angle (in degrees) on the annotation's /Rotate entry.
|
|
739
|
+
* A value of 0 removes the /Rotate key.
|
|
740
|
+
*
|
|
741
|
+
* @param annotationPtr - pointer to the annotation
|
|
742
|
+
* @param rotation - rotation in degrees (clockwise)
|
|
743
|
+
* @returns true on success
|
|
744
|
+
*/
|
|
745
|
+
private setAnnotationRotation;
|
|
746
|
+
/**
|
|
747
|
+
* Get the EmbedPDF extended rotation (in degrees) from the annotation's
|
|
748
|
+
* /EPDFRotate entry. Returns 0 if not set or on error.
|
|
749
|
+
*
|
|
750
|
+
* @param annotationPtr - pointer to the annotation
|
|
751
|
+
* @returns rotation in degrees (0 if not set)
|
|
752
|
+
*/
|
|
753
|
+
private getAnnotExtendedRotation;
|
|
754
|
+
/**
|
|
755
|
+
* Set the EmbedPDF extended rotation (in degrees) on the annotation's
|
|
756
|
+
* /EPDFRotate entry. A value of 0 removes the key.
|
|
757
|
+
*
|
|
758
|
+
* @param annotationPtr - pointer to the annotation
|
|
759
|
+
* @param rotation - rotation in degrees
|
|
760
|
+
* @returns true on success
|
|
761
|
+
*/
|
|
762
|
+
private setAnnotExtendedRotation;
|
|
763
|
+
/**
|
|
764
|
+
* Read the EmbedPDF unrotated rect from the annotation's /EPDFUnrotatedRect
|
|
765
|
+
* entry. Returns the raw page-space rect (same format as `readPageAnnoRect`)
|
|
766
|
+
* or null if not set.
|
|
767
|
+
*
|
|
768
|
+
* @param annotationPtr - pointer to the annotation
|
|
769
|
+
* @returns raw `{ left, top, right, bottom }` in page coords, or null
|
|
770
|
+
*/
|
|
771
|
+
private readAnnotUnrotatedRect;
|
|
772
|
+
/**
|
|
773
|
+
* Write the EmbedPDF unrotated rect (/EPDFUnrotatedRect) for an annotation.
|
|
774
|
+
* Accepts a device-space `Rect` and converts to page coordinates internally,
|
|
775
|
+
* following the same pattern as `setPageAnnoRect`.
|
|
776
|
+
*
|
|
777
|
+
* @param doc - pdf document object
|
|
778
|
+
* @param page - pdf page object
|
|
779
|
+
* @param annotPtr - pointer to the annotation
|
|
780
|
+
* @param rect - device-space rect to store as the unrotated rect
|
|
781
|
+
* @returns true on success
|
|
782
|
+
*/
|
|
783
|
+
private setAnnotUnrotatedRect;
|
|
718
784
|
/**
|
|
719
785
|
* Fetch the `/Q` text-alignment value from a **FreeText** annotation.
|
|
720
786
|
*
|
|
@@ -951,6 +1017,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
951
1017
|
private setLineEndings;
|
|
952
1018
|
/**
|
|
953
1019
|
* Get the start and end points of a LINE / POLYLINE annot.
|
|
1020
|
+
* @param doc - pdf document object
|
|
954
1021
|
* @param annotationPtr - pointer to an `FPDF_ANNOTATION`
|
|
955
1022
|
* @param page - logical page info object (`PdfPageObject`)
|
|
956
1023
|
* @returns `{ start, end }` or `undefined` when PDFium can't read them
|
|
@@ -959,6 +1026,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
959
1026
|
/**
|
|
960
1027
|
* Set the two end‑points of a **Line** annotation
|
|
961
1028
|
* by writing a new /L array `[ x1 y1 x2 y2 ]`.
|
|
1029
|
+
* @param doc - pdf document object
|
|
962
1030
|
* @param page - logical page info object (`PdfPageObject`)
|
|
963
1031
|
* @param annotPtr - pointer to the annotation whose line points are needed
|
|
964
1032
|
* @param start - start point
|
|
@@ -975,6 +1043,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
975
1043
|
* This preserves the true shape for rotated / skewed text, whereas callers
|
|
976
1044
|
* that only need axis-aligned boxes can collapse each quad themselves.
|
|
977
1045
|
*
|
|
1046
|
+
* @param doc - pdf document object
|
|
978
1047
|
* @param page - logical page info object (`PdfPageObject`)
|
|
979
1048
|
* @param annotationPtr - pointer to the annotation whose quads are needed
|
|
980
1049
|
* @returns Array of `Rect` objects (`[]` if the annotation has no quads)
|
|
@@ -985,6 +1054,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
985
1054
|
/**
|
|
986
1055
|
* Set the quadrilaterals for a **Highlight / Underline / StrikeOut / Squiggly** markup annotation.
|
|
987
1056
|
*
|
|
1057
|
+
* @param doc - pdf document object
|
|
988
1058
|
* @param page - logical page info object (`PdfPageObject`)
|
|
989
1059
|
* @param annotationPtr - pointer to the annotation whose quads are needed
|
|
990
1060
|
* @param rects - array of `Rect` objects (`[]` if the annotation has no quads)
|
|
@@ -1034,6 +1104,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1034
1104
|
private allocFSQuadsBufferFromRects;
|
|
1035
1105
|
/**
|
|
1036
1106
|
* Read ink list from annotation
|
|
1107
|
+
* @param doc - pdf document object
|
|
1037
1108
|
* @param page - logical page info object (`PdfPageObject`)
|
|
1038
1109
|
* @param pagePtr - pointer to the page
|
|
1039
1110
|
* @param annotationPtr - pointer to the annotation whose ink list is needed
|
|
@@ -1042,6 +1113,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1042
1113
|
private getInkList;
|
|
1043
1114
|
/**
|
|
1044
1115
|
* Add ink list to annotation
|
|
1116
|
+
* @param doc - pdf document object
|
|
1045
1117
|
* @param page - logical page info object (`PdfPageObject`)
|
|
1046
1118
|
* @param pagePtr - pointer to the page
|
|
1047
1119
|
* @param annotationPtr - pointer to the annotation whose ink list is needed
|
|
@@ -1337,6 +1409,18 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1337
1409
|
* @returns `true` on success
|
|
1338
1410
|
*/
|
|
1339
1411
|
private setInReplyToId;
|
|
1412
|
+
/**
|
|
1413
|
+
* Rotate a point around a center by the given angle in degrees.
|
|
1414
|
+
* Used to rotate vertices for PDF storage.
|
|
1415
|
+
*/
|
|
1416
|
+
private rotatePointForSave;
|
|
1417
|
+
/**
|
|
1418
|
+
* Prepare an annotation for saving to PDF.
|
|
1419
|
+
* For vertex types (ink, line, polygon, polyline) with rotation,
|
|
1420
|
+
* physically rotates the vertices by +rotation so that other PDF viewers
|
|
1421
|
+
* see the correct visual result. Our viewer reverse-rotates on load.
|
|
1422
|
+
*/
|
|
1423
|
+
private prepareAnnotationForSave;
|
|
1340
1424
|
/**
|
|
1341
1425
|
* Apply all base annotation properties from PdfAnnotationObjectBase.
|
|
1342
1426
|
* The setInReplyToId and setReplyType functions handle clearing when undefined.
|
|
@@ -1351,6 +1435,8 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1351
1435
|
* Read all base annotation properties from PdfAnnotationObjectBase.
|
|
1352
1436
|
* Returns an object that can be spread into the annotation return value.
|
|
1353
1437
|
*
|
|
1438
|
+
* @param doc - pdf document object
|
|
1439
|
+
* @param page - pdf page object
|
|
1354
1440
|
* @param annotationPtr - pointer to annotation object
|
|
1355
1441
|
* @returns object with base annotation properties
|
|
1356
1442
|
*/
|
|
@@ -1453,6 +1539,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1453
1539
|
private setAttachmentString;
|
|
1454
1540
|
/**
|
|
1455
1541
|
* Read vertices of pdf annotation
|
|
1542
|
+
* @param doc - pdf document object
|
|
1456
1543
|
* @param page - pdf page infor
|
|
1457
1544
|
* @param annotationPtr - pointer to pdf annotation
|
|
1458
1545
|
* @returns vertices of pdf annotation
|
|
@@ -1463,6 +1550,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1463
1550
|
/**
|
|
1464
1551
|
* Sync the vertices of a polygon or polyline annotation.
|
|
1465
1552
|
*
|
|
1553
|
+
* @param doc - pdf document object
|
|
1466
1554
|
* @param page - pdf page infor
|
|
1467
1555
|
* @param annotPtr - pointer to pdf annotation
|
|
1468
1556
|
* @param vertices - the vertices to be set
|
|
@@ -1548,6 +1636,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1548
1636
|
private readPdfAttachment;
|
|
1549
1637
|
/**
|
|
1550
1638
|
* Convert coordinate of point from device coordinate to page coordinate
|
|
1639
|
+
* @param doc - pdf document object
|
|
1551
1640
|
* @param page - pdf page infor
|
|
1552
1641
|
* @param position - position of point
|
|
1553
1642
|
* @returns converted position
|
|
@@ -1557,6 +1646,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1557
1646
|
private convertDevicePointToPagePoint;
|
|
1558
1647
|
/**
|
|
1559
1648
|
* Convert coordinate of point from page coordinate to device coordinate
|
|
1649
|
+
* @param doc - pdf document object
|
|
1560
1650
|
* @param page - pdf page infor
|
|
1561
1651
|
* @param position - position of point
|
|
1562
1652
|
* @returns converted position
|
|
@@ -1566,6 +1656,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1566
1656
|
private convertPagePointToDevicePoint;
|
|
1567
1657
|
/**
|
|
1568
1658
|
* Convert coordinate of rectangle from page coordinate to device coordinate
|
|
1659
|
+
* @param doc - pdf document object
|
|
1569
1660
|
* @param page - pdf page infor
|
|
1570
1661
|
* @param pagePtr - pointer to pdf page object
|
|
1571
1662
|
* @param pageRect - rectangle that needs to be converted
|
|
@@ -1604,6 +1695,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1604
1695
|
private setPageAnnoAppearanceStream;
|
|
1605
1696
|
/**
|
|
1606
1697
|
* Set the rect of specified annotation
|
|
1698
|
+
* @param doc - pdf document object
|
|
1607
1699
|
* @param page - page info that the annotation is belonged to
|
|
1608
1700
|
* @param annotationPtr - pointer to annotation object
|
|
1609
1701
|
* @param rect - target rectangle
|
|
@@ -1622,6 +1714,7 @@ export declare class PdfiumNative implements IPdfiumExecutor {
|
|
|
1622
1714
|
private readPageAnnoRect;
|
|
1623
1715
|
/**
|
|
1624
1716
|
* Get highlight rects for a specific character range (for search highlighting)
|
|
1717
|
+
* @param doc - pdf document object
|
|
1625
1718
|
* @param page - pdf page info
|
|
1626
1719
|
* @param pagePtr - pointer to pdf page
|
|
1627
1720
|
* @param textPagePtr - pointer to pdf text page
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../direct-engine-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../direct-engine-DITdlET4.cjs"),t=require("../../browser-13mzox-R.cjs"),r=require("../../pdf-engine-BmrecQLq.cjs"),n=require("@embedpdf/models"),o=require("@embedpdf/fonts-jp"),s=require("@embedpdf/fonts-kr"),a=require("@embedpdf/fonts-sc"),d=require("@embedpdf/fonts-tc"),i=require("@embedpdf/fonts-arabic"),f=require("@embedpdf/fonts-hebrew"),p=require("@embedpdf/fonts-latin"),m=require("./web/worker-engine.cjs");function c(e="latest"){return{jp:`https://cdn.jsdelivr.net/npm/@embedpdf/fonts-jp@${e}/fonts`,kr:`https://cdn.jsdelivr.net/npm/@embedpdf/fonts-kr@${e}/fonts`,sc:`https://cdn.jsdelivr.net/npm/@embedpdf/fonts-sc@${e}/fonts`,tc:`https://cdn.jsdelivr.net/npm/@embedpdf/fonts-tc@${e}/fonts`,arabic:`https://cdn.jsdelivr.net/npm/@embedpdf/fonts-arabic@${e}/fonts`,hebrew:`https://cdn.jsdelivr.net/npm/@embedpdf/fonts-hebrew@${e}/fonts`,latin:`https://cdn.jsdelivr.net/npm/@embedpdf/fonts-latin@${e}/fonts`}}function u(e,t){return e.map(e=>({url:`${t}/${e.file}`,weight:e.weight,italic:e.italic}))}function b(e){return{fonts:{[n.FontCharset.SHIFTJIS]:u(o.fonts,e.jp),[n.FontCharset.HANGEUL]:u(s.fonts,e.kr),[n.FontCharset.GB2312]:u(a.fonts,e.sc),[n.FontCharset.CHINESEBIG5]:u(d.fonts,e.tc),[n.FontCharset.ARABIC]:u(i.fonts,e.arabic),[n.FontCharset.HEBREW]:u(f.fonts,e.hebrew),[n.FontCharset.CYRILLIC]:u(p.fonts,e.latin),[n.FontCharset.GREEK]:u(p.fonts,e.latin),[n.FontCharset.VIETNAMESE]:u(p.fonts,e.latin)}}}const l=c("latest"),C=b(l);exports.BitmapFormat=e.BitmapFormat,exports.FontFallbackManager=e.FontFallbackManager,exports.PdfiumErrorCode=e.PdfiumErrorCode,exports.PdfiumNative=e.PdfiumNative,exports.RenderFlag=e.RenderFlag,exports.computeFormDrawParams=e.computeFormDrawParams,exports.createNodeFontLoader=e.createNodeFontLoader,exports.createPdfiumDirectEngine=e.createPdfiumEngine,exports.isValidCustomKey=e.isValidCustomKey,exports.readArrayBuffer=e.readArrayBuffer,exports.readString=e.readString,exports.ImageConverterError=t.ImageConverterError,exports.browserImageDataToBlobConverter=t.browserImageDataToBlobConverter,exports.createHybridImageConverter=t.createHybridImageConverter,exports.createWorkerPoolImageConverter=t.createWorkerPoolImageConverter,exports.PdfEngine=r.PdfEngine,Object.defineProperty(exports,"FontCharset",{enumerable:!0,get:()=>n.FontCharset}),exports.createPdfiumWorkerEngine=m.createPdfiumEngine,exports.DEFAULT_PDFIUM_WASM_URL="https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@2.6.0/dist/pdfium.wasm",exports.FONT_CDN_URLS=l,exports.cdnFontConfig=C,exports.createCdnFontConfig=function(e="latest"){return b(c(e))};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/lib/pdfium/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B, F, P, a, R,
|
|
2
|
-
import { I, b as b2,
|
|
3
|
-
import { P as P2 } from "../../pdf-engine-
|
|
1
|
+
import { B, F, P, a, R, c, b, d, i, r, e } from "../../direct-engine-CvfzIn2D.js";
|
|
2
|
+
import { I, b as b2, c as c2, a as a2 } from "../../browser-BISJ9naB.js";
|
|
3
|
+
import { P as P2 } from "../../pdf-engine-aJNoNMbt.js";
|
|
4
4
|
import { FontCharset } from "@embedpdf/models";
|
|
5
5
|
import { FontCharset as FontCharset2 } from "@embedpdf/models";
|
|
6
6
|
import { fonts as fonts$6 } from "@embedpdf/fonts-jp";
|
|
@@ -49,7 +49,7 @@ const cdnFontConfig = buildCdnFontConfig(FONT_CDN_URLS);
|
|
|
49
49
|
function createCdnFontConfig(version = "latest") {
|
|
50
50
|
return buildCdnFontConfig(buildCdnUrls(version));
|
|
51
51
|
}
|
|
52
|
-
const DEFAULT_PDFIUM_WASM_URL = "https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@2.
|
|
52
|
+
const DEFAULT_PDFIUM_WASM_URL = "https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@2.6.0/dist/pdfium.wasm";
|
|
53
53
|
export {
|
|
54
54
|
B as BitmapFormat,
|
|
55
55
|
DEFAULT_PDFIUM_WASM_URL,
|
|
@@ -63,15 +63,15 @@ export {
|
|
|
63
63
|
R as RenderFlag,
|
|
64
64
|
b2 as browserImageDataToBlobConverter,
|
|
65
65
|
cdnFontConfig,
|
|
66
|
-
|
|
66
|
+
c as computeFormDrawParams,
|
|
67
67
|
createCdnFontConfig,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
c2 as createHybridImageConverter,
|
|
69
|
+
b as createNodeFontLoader,
|
|
70
|
+
d as createPdfiumDirectEngine,
|
|
71
71
|
createPdfiumEngine as createPdfiumWorkerEngine,
|
|
72
|
-
|
|
72
|
+
a2 as createWorkerPoolImageConverter,
|
|
73
73
|
i as isValidCustomKey,
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
r as readArrayBuffer,
|
|
75
|
+
e as readString
|
|
76
76
|
};
|
|
77
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("@embedpdf/pdfium");const e=require("../../../direct-engine-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("@embedpdf/pdfium");const e=require("../../../direct-engine-DITdlET4.cjs");require("../../../pdf-engine-BmrecQLq.cjs"),require("../../../browser-13mzox-R.cjs"),exports.createPdfiumEngine=e.createPdfiumEngine;
|
|
2
2
|
//# sourceMappingURL=direct-engine.cjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@embedpdf/pdfium";
|
|
2
|
-
import {
|
|
3
|
-
import "../../../pdf-engine-
|
|
4
|
-
import "../../../browser-
|
|
2
|
+
import { d } from "../../../direct-engine-CvfzIn2D.js";
|
|
3
|
+
import "../../../pdf-engine-aJNoNMbt.js";
|
|
4
|
+
import "../../../browser-BISJ9naB.js";
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
d as createPdfiumEngine
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=direct-engine.js.map
|