@embedpdf/engines 1.0.11 → 1.0.13
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/engine-B0ZTENqz.js +5441 -0
- package/dist/engine-B0ZTENqz.js.map +1 -0
- package/dist/engine-BB5n-Wej.cjs +2 -0
- package/dist/engine-BB5n-Wej.cjs.map +1 -0
- package/dist/index.cjs +1 -5846
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1613
- package/dist/index.js +339 -5824
- package/dist/index.js.map +1 -1
- package/dist/lib/converters/index.cjs +2 -0
- package/dist/lib/converters/index.cjs.map +1 -0
- package/dist/{converters.d.ts → lib/converters/index.d.ts} +7 -10
- package/dist/lib/converters/index.js +80 -0
- package/dist/{converters.cjs.map → lib/converters/index.js.map} +1 -1
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/mock/index.d.ts +25 -0
- package/dist/lib/pdfium/cache.d.ts +62 -0
- package/dist/{pdfium.d.ts → lib/pdfium/engine.d.ts} +124 -178
- package/dist/lib/pdfium/helper.d.ts +21 -0
- package/dist/lib/pdfium/index.cjs +2 -0
- package/dist/lib/pdfium/index.cjs.map +1 -0
- package/dist/lib/pdfium/index.d.ts +3 -0
- package/dist/lib/pdfium/index.js +13 -0
- package/dist/lib/pdfium/index.js.map +1 -0
- package/dist/lib/pdfium/runner.d.ts +16 -0
- package/dist/lib/pdfium/web/direct-engine.cjs +2 -0
- package/dist/lib/pdfium/web/direct-engine.cjs.map +1 -0
- package/dist/lib/pdfium/web/direct-engine.d.ts +3 -0
- package/dist/lib/pdfium/web/direct-engine.js +12 -0
- package/dist/lib/pdfium/web/direct-engine.js.map +1 -0
- package/dist/lib/pdfium/web/worker-engine.cjs +2 -0
- package/dist/lib/pdfium/web/worker-engine.cjs.map +1 -0
- package/dist/lib/pdfium/web/worker-engine.d.ts +7 -0
- package/dist/lib/pdfium/web/worker-engine.js +15 -0
- package/dist/lib/pdfium/web/worker-engine.js.map +1 -0
- package/dist/lib/pdfium/worker.d.ts +1 -0
- package/dist/lib/pdfium-engine.d.ts +1 -0
- package/dist/lib/webworker/engine.cjs +2 -0
- package/dist/lib/webworker/engine.cjs.map +1 -0
- package/dist/{worker.d.ts → lib/webworker/engine.d.ts} +4 -34
- package/dist/lib/webworker/engine.js +887 -0
- package/dist/lib/webworker/engine.js.map +1 -0
- package/dist/lib/webworker/index.d.ts +2 -0
- package/dist/lib/webworker/runner.d.ts +128 -0
- package/dist/lib/webworker-engine.d.ts +1 -0
- package/dist/preact/adapter.d.ts +1 -0
- package/dist/preact/index.cjs +2 -0
- package/dist/preact/index.cjs.map +1 -0
- package/dist/preact/index.d.ts +1 -0
- package/dist/preact/index.js +37 -0
- package/dist/preact/index.js.map +1 -0
- package/dist/react/adapter.d.ts +1 -0
- package/dist/react/index.cjs +2 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +37 -0
- package/dist/react/index.js.map +1 -0
- package/dist/runner-B-s0R7NN.js +269 -0
- package/dist/runner-B-s0R7NN.js.map +1 -0
- package/dist/runner-BBBtCHic.cjs +2 -0
- package/dist/runner-BBBtCHic.cjs.map +1 -0
- package/dist/shared-preact/hooks/index.d.ts +1 -0
- package/dist/{preact.d.ts → shared-preact/hooks/use-pdfium-engine.d.ts} +3 -5
- package/dist/shared-preact/index.d.ts +1 -0
- package/dist/shared-react/hooks/index.d.ts +1 -0
- package/dist/{react.d.ts → shared-react/hooks/use-pdfium-engine.d.ts} +3 -5
- package/dist/shared-react/index.d.ts +1 -0
- package/dist/vue/hooks/index.d.ts +1 -0
- package/dist/vue/hooks/use-pdfium-engine.d.ts +18 -0
- package/dist/vue/index.cjs +2 -0
- package/dist/vue/index.cjs.map +1 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +39 -0
- package/dist/vue/index.js.map +1 -0
- package/package.json +41 -41
- package/dist/converters.cjs +0 -139
- package/dist/converters.js +0 -133
- package/dist/converters.js.map +0 -1
- package/dist/pdfium-direct-engine.cjs +0 -4400
- package/dist/pdfium-direct-engine.cjs.map +0 -1
- package/dist/pdfium-direct-engine.d.ts +0 -1091
- package/dist/pdfium-direct-engine.js +0 -4398
- package/dist/pdfium-direct-engine.js.map +0 -1
- package/dist/pdfium-worker-engine.cjs +0 -851
- package/dist/pdfium-worker-engine.cjs.map +0 -1
- package/dist/pdfium-worker-engine.d.ts +0 -314
- package/dist/pdfium-worker-engine.js +0 -849
- package/dist/pdfium-worker-engine.js.map +0 -1
- package/dist/pdfium.cjs +0 -4667
- package/dist/pdfium.cjs.map +0 -1
- package/dist/pdfium.js +0 -4661
- package/dist/pdfium.js.map +0 -1
- package/dist/preact.cjs +0 -41
- package/dist/preact.cjs.map +0 -1
- package/dist/preact.js +0 -39
- package/dist/preact.js.map +0 -1
- package/dist/react.cjs +0 -41
- package/dist/react.cjs.map +0 -1
- package/dist/react.js +0 -39
- package/dist/react.js.map +0 -1
- package/dist/worker.cjs +0 -839
- package/dist/worker.cjs.map +0 -1
- package/dist/worker.js +0 -836
- package/dist/worker.js.map +0 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { WrappedPdfiumModule
|
|
3
|
-
|
|
1
|
+
import { PdfAnnotationObject, PdfTextRectObject, PdfWidgetAnnoObject, Logger, SearchTarget, MatchFlag, PdfBookmarkObject, PdfDocumentObject, PdfEngine, PdfPageObject, Rotation, Rect, PdfAttachmentObject, PdfSignatureObject, PdfRenderOptions, PdfInkAnnoObject, Position, PdfCircleAnnoObject, PdfSquareAnnoObject, PdfSquigglyAnnoObject, PdfStrikeOutAnnoObject, PdfUnderlineAnnoObject, PdfFile, AppearanceMode, PdfHighlightAnnoObject, PdfStampAnnoObjectContents, FormFieldValue, PdfPageFlattenFlag, PdfPageFlattenResult, PdfTask, PdfFileLoader, SearchAllPagesResult, PdfUrlOptions, PdfFileUrl, Task, PdfErrorReason, PdfGlyphObject, PdfPageGeometry, PdfImage, ImageConversionTypes, PdfAnnotationObjectBase, PageTextSlice, WebAlphaColor } from '@embedpdf/models';
|
|
2
|
+
import { WrappedPdfiumModule } from '@embedpdf/pdfium';
|
|
4
3
|
/**
|
|
5
4
|
* Format of bitmap
|
|
6
5
|
*/
|
|
7
|
-
declare enum BitmapFormat {
|
|
6
|
+
export declare enum BitmapFormat {
|
|
8
7
|
Bitmap_Gray = 1,
|
|
9
8
|
Bitmap_BGR = 2,
|
|
10
9
|
Bitmap_BGRx = 3,
|
|
@@ -13,7 +12,7 @@ declare enum BitmapFormat {
|
|
|
13
12
|
/**
|
|
14
13
|
* Pdf rendering flag
|
|
15
14
|
*/
|
|
16
|
-
declare enum RenderFlag {
|
|
15
|
+
export declare enum RenderFlag {
|
|
17
16
|
ANNOT = 1,// Set if annotations are to be rendered.
|
|
18
17
|
LCD_TEXT = 2,// Set if using text rendering optimized for LCD display.
|
|
19
18
|
NO_NATIVETEXT = 4,// Don't use the native text output available on some platforms
|
|
@@ -28,7 +27,7 @@ declare enum RenderFlag {
|
|
|
28
27
|
/**
|
|
29
28
|
* Context used for searching
|
|
30
29
|
*/
|
|
31
|
-
interface SearchContext {
|
|
30
|
+
export interface SearchContext {
|
|
32
31
|
/**
|
|
33
32
|
* search target
|
|
34
33
|
*/
|
|
@@ -45,7 +44,7 @@ interface SearchContext {
|
|
|
45
44
|
/**
|
|
46
45
|
* Error code of pdfium library
|
|
47
46
|
*/
|
|
48
|
-
declare enum PdfiumErrorCode {
|
|
47
|
+
export declare enum PdfiumErrorCode {
|
|
49
48
|
Success = 0,
|
|
50
49
|
Unknown = 1,
|
|
51
50
|
File = 2,
|
|
@@ -61,12 +60,12 @@ declare enum PdfiumErrorCode {
|
|
|
61
60
|
* In browser: uses OffscreenCanvas
|
|
62
61
|
* In Node.js: can use Sharp or other image processing libraries
|
|
63
62
|
*/
|
|
64
|
-
type ImageDataConverter<T = Blob> = (imageData: PdfImage, imageType?: ImageConversionTypes) => Promise<T>;
|
|
65
|
-
declare const browserImageDataToBlobConverter: ImageDataConverter<Blob>;
|
|
63
|
+
export type ImageDataConverter<T = Blob> = (imageData: PdfImage, imageType?: ImageConversionTypes) => Promise<T>;
|
|
64
|
+
export declare const browserImageDataToBlobConverter: ImageDataConverter<Blob>;
|
|
66
65
|
/**
|
|
67
66
|
* Pdf engine that based on pdfium wasm
|
|
68
67
|
*/
|
|
69
|
-
declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
68
|
+
export declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
70
69
|
private pdfiumModule;
|
|
71
70
|
private logger;
|
|
72
71
|
private imageDataConverter;
|
|
@@ -334,6 +333,39 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
334
333
|
* @private
|
|
335
334
|
*/
|
|
336
335
|
addInkStroke(page: PdfPageObject, pagePtr: number, annotationPtr: number, annotation: PdfInkAnnoObject): boolean;
|
|
336
|
+
/**
|
|
337
|
+
* Add line content to annotation
|
|
338
|
+
* @param page - page info
|
|
339
|
+
* @param pagePtr - pointer to page object
|
|
340
|
+
* @param annotationPtr - pointer to line annotation
|
|
341
|
+
* @param annotation - line annotation
|
|
342
|
+
* @returns whether line content is added to annotation
|
|
343
|
+
*
|
|
344
|
+
* @private
|
|
345
|
+
*/
|
|
346
|
+
private addLineContent;
|
|
347
|
+
/**
|
|
348
|
+
* Add polygon or polyline content to annotation
|
|
349
|
+
* @param page - page info
|
|
350
|
+
* @param pagePtr - pointer to page object
|
|
351
|
+
* @param annotationPtr - pointer to polygon or polyline annotation
|
|
352
|
+
* @param annotation - polygon or polyline annotation
|
|
353
|
+
* @returns whether polygon or polyline content is added to annotation
|
|
354
|
+
*
|
|
355
|
+
* @private
|
|
356
|
+
*/
|
|
357
|
+
private addPolyContent;
|
|
358
|
+
/**
|
|
359
|
+
* Add shape content to annotation
|
|
360
|
+
* @param page - page info
|
|
361
|
+
* @param pagePtr - pointer to page object
|
|
362
|
+
* @param annotationPtr - pointer to shape annotation
|
|
363
|
+
* @param annotation - shape annotation
|
|
364
|
+
* @returns whether shape content is added to annotation
|
|
365
|
+
*
|
|
366
|
+
* @private
|
|
367
|
+
*/
|
|
368
|
+
addShapeContent(page: PdfPageObject, pagePtr: number, annotationPtr: number, annotation: PdfCircleAnnoObject | PdfSquareAnnoObject): boolean;
|
|
337
369
|
/**
|
|
338
370
|
* Add highlight content to annotation
|
|
339
371
|
* @param page - page info
|
|
@@ -578,6 +610,51 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
578
610
|
* • `pattern` – numeric array of dash/space lengths (empty when `ok` is false)
|
|
579
611
|
*/
|
|
580
612
|
private getBorderDashPattern;
|
|
613
|
+
/**
|
|
614
|
+
* Write the /BS /D dash pattern array for an annotation border.
|
|
615
|
+
*
|
|
616
|
+
* @param annotationPtr Pointer to FPDF_ANNOTATION
|
|
617
|
+
* @param pattern Array of dash/space lengths in *points* (e.g. [3, 2])
|
|
618
|
+
* Empty array clears the pattern (solid line).
|
|
619
|
+
* @returns true on success
|
|
620
|
+
*
|
|
621
|
+
* @private
|
|
622
|
+
*/
|
|
623
|
+
private setBorderDashPattern;
|
|
624
|
+
/**
|
|
625
|
+
* Return the `/LE` array (start/end line-ending styles) for a LINE / POLYLINE annot.
|
|
626
|
+
*
|
|
627
|
+
* @param annotationPtr - pointer to an `FPDF_ANNOTATION`
|
|
628
|
+
* @returns `{ start, end }` or `undefined` when PDFium can't read them
|
|
629
|
+
*
|
|
630
|
+
* @private
|
|
631
|
+
*/
|
|
632
|
+
private getLineEndings;
|
|
633
|
+
/**
|
|
634
|
+
* Write the `/LE` array (start/end line-ending styles) for a LINE / POLYLINE annot.
|
|
635
|
+
* @param annotationPtr - pointer to an `FPDF_ANNOTATION`
|
|
636
|
+
* @param start - start line ending style
|
|
637
|
+
* @param end - end line ending style
|
|
638
|
+
* @returns `true` on success
|
|
639
|
+
*/
|
|
640
|
+
private setLineEndings;
|
|
641
|
+
/**
|
|
642
|
+
* Get the start and end points of a LINE / POLYLINE annot.
|
|
643
|
+
* @param annotationPtr - pointer to an `FPDF_ANNOTATION`
|
|
644
|
+
* @param page - logical page info object (`PdfPageObject`)
|
|
645
|
+
* @returns `{ start, end }` or `undefined` when PDFium can't read them
|
|
646
|
+
*/
|
|
647
|
+
private getLinePoints;
|
|
648
|
+
/**
|
|
649
|
+
* Set the two end‑points of a **Line** annotation
|
|
650
|
+
* by writing a new /L array `[ x1 y1 x2 y2 ]`.
|
|
651
|
+
* @param page - logical page info object (`PdfPageObject`)
|
|
652
|
+
* @param annotPtr - pointer to the annotation whose line points are needed
|
|
653
|
+
* @param start - start point
|
|
654
|
+
* @param end - end point
|
|
655
|
+
* @returns true on success
|
|
656
|
+
*/
|
|
657
|
+
private setLinePoints;
|
|
581
658
|
/**
|
|
582
659
|
* Read `/QuadPoints` from any annotation and convert each quadrilateral to
|
|
583
660
|
* device-space coordinates.
|
|
@@ -857,6 +934,7 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
857
934
|
* • `flags` – object with individual booleans
|
|
858
935
|
*/
|
|
859
936
|
private getAnnotationFlags;
|
|
937
|
+
private setAnnotationFlags;
|
|
860
938
|
/**
|
|
861
939
|
* Read circle annotation
|
|
862
940
|
* @param page - pdf page infor
|
|
@@ -909,6 +987,31 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
909
987
|
* @private
|
|
910
988
|
*/
|
|
911
989
|
private getAnnotString;
|
|
990
|
+
/**
|
|
991
|
+
* Fetches the /IT (Intent) name from an annotation as a UTF-8 JS string.
|
|
992
|
+
*
|
|
993
|
+
* Mirrors getAnnotString(): calls EPDFAnnot_GetIntent twice (length probe + copy).
|
|
994
|
+
* Returns `undefined` if no intent present.
|
|
995
|
+
*/
|
|
996
|
+
private getAnnotIntent;
|
|
997
|
+
/**
|
|
998
|
+
* Write the `/IT` (Intent) name into an annotation dictionary.
|
|
999
|
+
*
|
|
1000
|
+
* Mirrors EPDFAnnot_SetIntent in PDFium (expects a UTF‑8 FPDF_BYTESTRING).
|
|
1001
|
+
*
|
|
1002
|
+
* @param annotationPtr Pointer returned by FPDFPage_GetAnnot
|
|
1003
|
+
* @param intent Name without leading slash, e.g. `"PolygonCloud"`
|
|
1004
|
+
* A leading “/” will be stripped for convenience.
|
|
1005
|
+
* @returns true on success, false otherwise
|
|
1006
|
+
*/
|
|
1007
|
+
private setAnnotIntent;
|
|
1008
|
+
/**
|
|
1009
|
+
* Returns the rich‑content string stored in the annotation’s `/RC` entry.
|
|
1010
|
+
*
|
|
1011
|
+
* Works like `getAnnotIntent()`: first probe for length, then copy.
|
|
1012
|
+
* `undefined` when the annotation has no rich content.
|
|
1013
|
+
*/
|
|
1014
|
+
private getAnnotRichContent;
|
|
912
1015
|
/**
|
|
913
1016
|
* Set a string value (`/T`, `/M`, `/State`, …) to an annotation.
|
|
914
1017
|
*
|
|
@@ -927,6 +1030,17 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
927
1030
|
* @private
|
|
928
1031
|
*/
|
|
929
1032
|
private readPdfAnnoVertices;
|
|
1033
|
+
/**
|
|
1034
|
+
* Sync the vertices of a polygon or polyline annotation.
|
|
1035
|
+
*
|
|
1036
|
+
* @param page - pdf page infor
|
|
1037
|
+
* @param annotPtr - pointer to pdf annotation
|
|
1038
|
+
* @param vertices - the vertices to be set
|
|
1039
|
+
* @returns true on success
|
|
1040
|
+
*
|
|
1041
|
+
* @private
|
|
1042
|
+
*/
|
|
1043
|
+
private setPdfAnnoVertices;
|
|
930
1044
|
/**
|
|
931
1045
|
* Read the target of pdf bookmark
|
|
932
1046
|
* @param docPtr - pointer to pdf document object
|
|
@@ -1141,171 +1255,3 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
1141
1255
|
*/
|
|
1142
1256
|
private searchAllInPage;
|
|
1143
1257
|
}
|
|
1144
|
-
|
|
1145
|
-
/**
|
|
1146
|
-
* Read string from WASM heap
|
|
1147
|
-
* @param wasmModule - pdfium wasm module instance
|
|
1148
|
-
* @param readChars - function to read chars
|
|
1149
|
-
* @param parseChars - function to parse chars
|
|
1150
|
-
* @param defaultLength - default length of chars that needs to read
|
|
1151
|
-
* @returns string from the heap
|
|
1152
|
-
*
|
|
1153
|
-
* @public
|
|
1154
|
-
*/
|
|
1155
|
-
declare function readString(wasmModule: PdfiumRuntimeMethods & PdfiumModule, readChars: (buffer: number, bufferLength: number) => number, parseChars: (buffer: number) => string, defaultLength?: number): string;
|
|
1156
|
-
/**
|
|
1157
|
-
* Read arraybyffer from WASM heap
|
|
1158
|
-
* @param wasmModule - pdfium wasm module instance
|
|
1159
|
-
* @param readChars - function to read chars
|
|
1160
|
-
* @returns arraybuffer from the heap
|
|
1161
|
-
*
|
|
1162
|
-
* @public
|
|
1163
|
-
*/
|
|
1164
|
-
declare function readArrayBuffer(wasmModule: PdfiumRuntimeMethods & PdfiumModule, readChars: (buffer: number, bufferLength: number) => number): ArrayBuffer;
|
|
1165
|
-
|
|
1166
|
-
/**
|
|
1167
|
-
* Request body that represent method calls of PdfEngine, it contains the
|
|
1168
|
-
* method name and arguments
|
|
1169
|
-
*/
|
|
1170
|
-
type PdfEngineMethodRequestBody = {
|
|
1171
|
-
[P in PdfEngineMethodName]: {
|
|
1172
|
-
name: P;
|
|
1173
|
-
args: PdfEngineMethodArgs<P>;
|
|
1174
|
-
};
|
|
1175
|
-
}[PdfEngineMethodName];
|
|
1176
|
-
/**
|
|
1177
|
-
* Response body that represent return value of PdfEngine
|
|
1178
|
-
*/
|
|
1179
|
-
type PdfEngineMethodResponseBody = {
|
|
1180
|
-
[P in PdfEngineMethodName]: TaskReturn<PdfEngineMethodReturnType<P>>;
|
|
1181
|
-
}[PdfEngineMethodName];
|
|
1182
|
-
/**
|
|
1183
|
-
* Request that abort the specified task
|
|
1184
|
-
*/
|
|
1185
|
-
interface AbortRequest {
|
|
1186
|
-
/**
|
|
1187
|
-
* message id
|
|
1188
|
-
*/
|
|
1189
|
-
id: string;
|
|
1190
|
-
/**
|
|
1191
|
-
* request type
|
|
1192
|
-
*/
|
|
1193
|
-
type: 'AbortRequest';
|
|
1194
|
-
}
|
|
1195
|
-
/**
|
|
1196
|
-
* Request that execute pdf engine method
|
|
1197
|
-
*/
|
|
1198
|
-
interface ExecuteRequest {
|
|
1199
|
-
/**
|
|
1200
|
-
* message id
|
|
1201
|
-
*/
|
|
1202
|
-
id: string;
|
|
1203
|
-
/**
|
|
1204
|
-
* request type
|
|
1205
|
-
*/
|
|
1206
|
-
type: 'ExecuteRequest';
|
|
1207
|
-
/**
|
|
1208
|
-
* request body
|
|
1209
|
-
*/
|
|
1210
|
-
data: PdfEngineMethodRequestBody;
|
|
1211
|
-
}
|
|
1212
|
-
/**
|
|
1213
|
-
* Response that execute pdf engine method
|
|
1214
|
-
*/
|
|
1215
|
-
interface ExecuteResponse {
|
|
1216
|
-
/**
|
|
1217
|
-
* message id
|
|
1218
|
-
*/
|
|
1219
|
-
id: string;
|
|
1220
|
-
/**
|
|
1221
|
-
* response type
|
|
1222
|
-
*/
|
|
1223
|
-
type: 'ExecuteResponse';
|
|
1224
|
-
/**
|
|
1225
|
-
* response body
|
|
1226
|
-
*/
|
|
1227
|
-
data: PdfEngineMethodResponseBody;
|
|
1228
|
-
}
|
|
1229
|
-
/**
|
|
1230
|
-
* Response that indicate engine is ready
|
|
1231
|
-
*/
|
|
1232
|
-
interface ReadyResponse {
|
|
1233
|
-
/**
|
|
1234
|
-
* message id
|
|
1235
|
-
*/
|
|
1236
|
-
id: string;
|
|
1237
|
-
/**
|
|
1238
|
-
* response type
|
|
1239
|
-
*/
|
|
1240
|
-
type: 'ReadyResponse';
|
|
1241
|
-
}
|
|
1242
|
-
/**
|
|
1243
|
-
* Request type
|
|
1244
|
-
*/
|
|
1245
|
-
type Request = ExecuteRequest | AbortRequest;
|
|
1246
|
-
/**
|
|
1247
|
-
* Response type
|
|
1248
|
-
*/
|
|
1249
|
-
type Response = ExecuteResponse | ReadyResponse;
|
|
1250
|
-
/**
|
|
1251
|
-
* Pdf engine runner, it will execute pdf engine based on the request it received and
|
|
1252
|
-
* send back the response with post message
|
|
1253
|
-
*/
|
|
1254
|
-
declare class EngineRunner {
|
|
1255
|
-
logger: Logger;
|
|
1256
|
-
engine: PdfEngine | undefined;
|
|
1257
|
-
/**
|
|
1258
|
-
* Create instance of EngineRunnder
|
|
1259
|
-
* @param logger - logger instance
|
|
1260
|
-
*/
|
|
1261
|
-
constructor(logger?: Logger);
|
|
1262
|
-
/**
|
|
1263
|
-
* Listening on post message
|
|
1264
|
-
*/
|
|
1265
|
-
listen(): void;
|
|
1266
|
-
/**
|
|
1267
|
-
* Handle post message
|
|
1268
|
-
*/
|
|
1269
|
-
handle(evt: MessageEvent<Request>): void;
|
|
1270
|
-
/**
|
|
1271
|
-
* Send the ready response when pdf engine is ready
|
|
1272
|
-
* @returns
|
|
1273
|
-
*
|
|
1274
|
-
* @protected
|
|
1275
|
-
*/
|
|
1276
|
-
ready(): void;
|
|
1277
|
-
/**
|
|
1278
|
-
* Execute the request
|
|
1279
|
-
* @param request - request that represent the pdf engine call
|
|
1280
|
-
* @returns
|
|
1281
|
-
*
|
|
1282
|
-
* @protected
|
|
1283
|
-
*/
|
|
1284
|
-
execute: (request: ExecuteRequest) => void;
|
|
1285
|
-
/**
|
|
1286
|
-
* Send back the response
|
|
1287
|
-
* @param response - response that needs sent back
|
|
1288
|
-
*
|
|
1289
|
-
* @protected
|
|
1290
|
-
*/
|
|
1291
|
-
respond(response: Response): void;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
/**
|
|
1295
|
-
* EngineRunner for pdfium-based wasm engine
|
|
1296
|
-
*/
|
|
1297
|
-
declare class PdfiumEngineRunner extends EngineRunner {
|
|
1298
|
-
private wasmBinary;
|
|
1299
|
-
/**
|
|
1300
|
-
* Create an instance of PdfiumEngineRunner
|
|
1301
|
-
* @param wasmBinary - wasm binary that contains the pdfium wasm file
|
|
1302
|
-
*/
|
|
1303
|
-
constructor(wasmBinary: ArrayBuffer);
|
|
1304
|
-
/**
|
|
1305
|
-
* Initialize runner
|
|
1306
|
-
*/
|
|
1307
|
-
prepare(): Promise<void>;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
export { BitmapFormat, PdfiumEngine, PdfiumEngineRunner, PdfiumErrorCode, RenderFlag, browserImageDataToBlobConverter, readArrayBuffer, readString };
|
|
1311
|
-
export type { ImageDataConverter, SearchContext };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PdfiumRuntimeMethods, PdfiumModule } from '@embedpdf/pdfium';
|
|
2
|
+
/**
|
|
3
|
+
* Read string from WASM heap
|
|
4
|
+
* @param wasmModule - pdfium wasm module instance
|
|
5
|
+
* @param readChars - function to read chars
|
|
6
|
+
* @param parseChars - function to parse chars
|
|
7
|
+
* @param defaultLength - default length of chars that needs to read
|
|
8
|
+
* @returns string from the heap
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare function readString(wasmModule: PdfiumRuntimeMethods & PdfiumModule, readChars: (buffer: number, bufferLength: number) => number, parseChars: (buffer: number) => string, defaultLength?: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Read arraybyffer from WASM heap
|
|
15
|
+
* @param wasmModule - pdfium wasm module instance
|
|
16
|
+
* @param readChars - function to read chars
|
|
17
|
+
* @returns arraybuffer from the heap
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare function readArrayBuffer(wasmModule: PdfiumRuntimeMethods & PdfiumModule, readChars: (buffer: number, bufferLength: number) => number): ArrayBuffer;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../engine-BB5n-Wej.cjs"),e=require("../../runner-BBBtCHic.cjs");exports.BitmapFormat=r.BitmapFormat,exports.PdfiumEngine=r.PdfiumEngine,exports.PdfiumErrorCode=r.PdfiumErrorCode,exports.RenderFlag=r.RenderFlag,exports.browserImageDataToBlobConverter=r.browserImageDataToBlobConverter,exports.readArrayBuffer=r.readArrayBuffer,exports.readString=r.readString,exports.PdfiumEngineRunner=e.PdfiumEngineRunner;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { B, a, P, R, b, c, r } from "../../engine-B0ZTENqz.js";
|
|
2
|
+
import { P as P2 } from "../../runner-B-s0R7NN.js";
|
|
3
|
+
export {
|
|
4
|
+
B as BitmapFormat,
|
|
5
|
+
a as PdfiumEngine,
|
|
6
|
+
P2 as PdfiumEngineRunner,
|
|
7
|
+
P as PdfiumErrorCode,
|
|
8
|
+
R as RenderFlag,
|
|
9
|
+
b as browserImageDataToBlobConverter,
|
|
10
|
+
c as readArrayBuffer,
|
|
11
|
+
r as readString
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EngineRunner } from '../webworker/runner';
|
|
2
|
+
/**
|
|
3
|
+
* EngineRunner for pdfium-based wasm engine
|
|
4
|
+
*/
|
|
5
|
+
export declare class PdfiumEngineRunner extends EngineRunner {
|
|
6
|
+
private wasmBinary;
|
|
7
|
+
/**
|
|
8
|
+
* Create an instance of PdfiumEngineRunner
|
|
9
|
+
* @param wasmBinary - wasm binary that contains the pdfium wasm file
|
|
10
|
+
*/
|
|
11
|
+
constructor(wasmBinary: ArrayBuffer);
|
|
12
|
+
/**
|
|
13
|
+
* Initialize runner
|
|
14
|
+
*/
|
|
15
|
+
prepare(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/pdfium"),i=require("../../../engine-BB5n-Wej.cjs");exports.createPdfiumEngine=async function(t,n){const r=await fetch(t),a=await r.arrayBuffer(),u=await e.init({wasmBinary:a});return new i.PdfiumEngine(u,n)};
|
|
2
|
+
//# sourceMappingURL=direct-engine.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct-engine.cjs","sources":["../../../../src/lib/pdfium/web/direct-engine.ts"],"sourcesContent":["import { Logger } from '@embedpdf/models';\nimport { init } from '@embedpdf/pdfium';\n\nimport { PdfiumEngine } from '../engine';\n\nexport async function createPdfiumEngine(wasmUrl: string, logger?: Logger): Promise<PdfiumEngine> {\n const response = await fetch(wasmUrl);\n const wasmBinary = await response.arrayBuffer();\n const wasmModule = await init({ wasmBinary });\n return new PdfiumEngine(wasmModule, logger);\n}\n"],"names":["async","wasmUrl","logger","response","fetch","wasmBinary","arrayBuffer","wasmModule","init","PdfiumEngine"],"mappings":"yLAKsBA,eAAmBC,EAAiBC,GAClD,MAAAC,QAAiBC,MAAMH,GACvBI,QAAmBF,EAASG,cAC5BC,QAAmBC,OAAK,CAAEH,eACzB,OAAA,IAAII,EAAAA,aAAaF,EAAYL,EACtC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { init } from "@embedpdf/pdfium";
|
|
2
|
+
import { a as PdfiumEngine } from "../../../engine-B0ZTENqz.js";
|
|
3
|
+
async function createPdfiumEngine(wasmUrl, logger) {
|
|
4
|
+
const response = await fetch(wasmUrl);
|
|
5
|
+
const wasmBinary = await response.arrayBuffer();
|
|
6
|
+
const wasmModule = await init({ wasmBinary });
|
|
7
|
+
return new PdfiumEngine(wasmModule, logger);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
createPdfiumEngine
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=direct-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct-engine.js","sources":["../../../../src/lib/pdfium/web/direct-engine.ts"],"sourcesContent":["import { Logger } from '@embedpdf/models';\nimport { init } from '@embedpdf/pdfium';\n\nimport { PdfiumEngine } from '../engine';\n\nexport async function createPdfiumEngine(wasmUrl: string, logger?: Logger): Promise<PdfiumEngine> {\n const response = await fetch(wasmUrl);\n const wasmBinary = await response.arrayBuffer();\n const wasmModule = await init({ wasmBinary });\n return new PdfiumEngine(wasmModule, logger);\n}\n"],"names":[],"mappings":";;AAKsB,eAAA,mBAAmB,SAAiB,QAAwC;AAC1F,QAAA,WAAW,MAAM,MAAM,OAAO;AAC9B,QAAA,aAAa,MAAM,SAAS,YAAY;AAC9C,QAAM,aAAa,MAAM,KAAK,EAAE,YAAY;AACrC,SAAA,IAAI,aAAa,YAAY,MAAM;AAC5C;"}
|