@embedpdf/engines 1.0.2 → 1.0.4

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 (49) hide show
  1. package/dist/converters.cjs +149 -115
  2. package/dist/converters.cjs.map +1 -1
  3. package/dist/converters.d.ts +2 -1
  4. package/dist/converters.js +143 -86
  5. package/dist/converters.js.map +1 -1
  6. package/dist/index.cjs +5362 -5994
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.ts +1479 -6
  9. package/dist/index.js +5399 -356
  10. package/dist/index.js.map +1 -1
  11. package/dist/pdfium-direct-engine.cjs +4037 -0
  12. package/dist/pdfium-direct-engine.cjs.map +1 -0
  13. package/dist/{pdfium.d.cts → pdfium-direct-engine.d.ts} +4 -96
  14. package/dist/pdfium-direct-engine.js +4035 -0
  15. package/dist/pdfium-direct-engine.js.map +1 -0
  16. package/dist/pdfium-worker-engine.cjs +800 -0
  17. package/dist/pdfium-worker-engine.cjs.map +1 -0
  18. package/dist/{worker.d.cts → pdfium-worker-engine.d.ts} +36 -4
  19. package/dist/pdfium-worker-engine.js +798 -0
  20. package/dist/pdfium-worker-engine.js.map +1 -0
  21. package/dist/pdfium.cjs +4243 -5663
  22. package/dist/pdfium.cjs.map +1 -1
  23. package/dist/pdfium.d.ts +131 -3
  24. package/dist/pdfium.js +4288 -21
  25. package/dist/pdfium.js.map +1 -1
  26. package/dist/preact.cjs +39 -0
  27. package/dist/preact.cjs.map +1 -0
  28. package/dist/preact.d.ts +13 -0
  29. package/dist/preact.js +37 -0
  30. package/dist/preact.js.map +1 -0
  31. package/dist/react.cjs +39 -0
  32. package/dist/react.cjs.map +1 -0
  33. package/dist/react.d.ts +13 -0
  34. package/dist/react.js +37 -0
  35. package/dist/react.js.map +1 -0
  36. package/dist/worker.cjs +771 -1104
  37. package/dist/worker.cjs.map +1 -1
  38. package/dist/worker.d.ts +30 -4
  39. package/dist/worker.js +786 -11
  40. package/dist/worker.js.map +1 -1
  41. package/package.json +42 -8
  42. package/dist/chunk-NDTYBBMQ.js +0 -4615
  43. package/dist/chunk-NDTYBBMQ.js.map +0 -1
  44. package/dist/chunk-YZLT3A2D.js +0 -1101
  45. package/dist/chunk-YZLT3A2D.js.map +0 -1
  46. package/dist/converters.d.cts +0 -69
  47. package/dist/index.d.cts +0 -32
  48. package/dist/runner-BvRtPCKL.d.cts +0 -131
  49. package/dist/runner-BvRtPCKL.d.ts +0 -131
@@ -1,69 +1,12 @@
1
- import { SearchTarget, PdfImage, PdfEngine, Logger, Task, PdfErrorReason, PdfFileUrl, PdfUrlOptions, PdfDocumentObject, PdfFile, PdfFileLoader, PdfSignatureObject, PdfBookmarkObject, PdfPageObject, Rotation, PdfRenderOptions, PdfTask, Rect, PdfAnnotationObject, PdfAnnotationTransformation, PdfTextRectObject, PdfAttachmentObject, PdfWidgetAnnoObject, FormFieldValue, PdfPageFlattenFlag, PdfPageFlattenResult, PdfInkListObject, PdfStampAnnoObjectContents, Position, PdfPageGeometry, PdfGlyphObject, MatchFlag, SearchAllPagesResult } from '@embedpdf/models';
2
- import { WrappedPdfiumModule, PdfiumRuntimeMethods, PdfiumModule } from '@embedpdf/pdfium';
3
- import { e as EngineRunner } from './runner-BvRtPCKL.cjs';
1
+ import { PdfEngine, Logger, Task, PdfErrorReason, PdfFileUrl, PdfUrlOptions, PdfDocumentObject, PdfFile, PdfFileLoader, PdfSignatureObject, PdfBookmarkObject, PdfPageObject, Rotation, PdfRenderOptions, PdfTask, Rect, PdfAnnotationObject, PdfAnnotationTransformation, PdfTextRectObject, PdfAttachmentObject, PdfWidgetAnnoObject, FormFieldValue, PdfPageFlattenFlag, PdfPageFlattenResult, PdfInkListObject, PdfStampAnnoObjectContents, Position, PdfPageGeometry, PdfGlyphObject, MatchFlag, SearchAllPagesResult, PdfImage } from '@embedpdf/models';
2
+ import { WrappedPdfiumModule } from '@embedpdf/pdfium';
4
3
 
5
- /**
6
- * Format of bitmap
7
- */
8
- declare enum BitmapFormat {
9
- Bitmap_Gray = 1,
10
- Bitmap_BGR = 2,
11
- Bitmap_BGRx = 3,
12
- Bitmap_BGRA = 4
13
- }
14
- /**
15
- * Pdf rendering flag
16
- */
17
- declare enum RenderFlag {
18
- ANNOT = 1,// Set if annotations are to be rendered.
19
- LCD_TEXT = 2,// Set if using text rendering optimized for LCD display.
20
- NO_NATIVETEXT = 4,// Don't use the native text output available on some platforms
21
- GRAYSCALE = 8,// Grayscale output.
22
- DEBUG_INFO = 128,// Set if you want to get some debug info. Please discuss with Foxit first if you need to collect debug info.
23
- NO_CATCH = 256,// Set if you don't want to catch exception.
24
- RENDER_LIMITEDIMAGECACHE = 512,// Limit image cache size.
25
- RENDER_FORCEHALFTONE = 1024,// Always use halftone for image stretching.
26
- PRINTING = 2048,// Render for printing.
27
- REVERSE_BYTE_ORDER = 16
28
- }
29
- /**
30
- * Context used for searching
31
- */
32
- interface SearchContext {
33
- /**
34
- * search target
35
- */
36
- target: SearchTarget;
37
- /**
38
- * current page index
39
- */
40
- currPageIndex: number;
41
- /**
42
- * index of text in the current pdf page, -1 means reach the end
43
- */
44
- startIndex: number;
45
- }
46
- /**
47
- * Error code of pdfium library
48
- */
49
- declare enum PdfiumErrorCode {
50
- Success = 0,
51
- Unknown = 1,
52
- File = 2,
53
- Format = 3,
54
- Password = 4,
55
- Security = 5,
56
- Page = 6,
57
- XFALoad = 7,
58
- XFALayout = 8
59
- }
60
4
  /**
61
5
  * Function type for converting ImageData to Blob
62
6
  * In browser: uses OffscreenCanvas
63
7
  * In Node.js: can use Sharp or other image processing libraries
64
8
  */
65
9
  type ImageDataConverter<T = Blob> = (imageData: PdfImage) => Promise<T>;
66
- declare const browserImageDataToBlobConverter: ImageDataConverter<Blob>;
67
10
  /**
68
11
  * Pdf engine that based on pdfium wasm
69
12
  */
@@ -1043,41 +986,6 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
1043
986
  private searchAllInPage;
1044
987
  }
1045
988
 
1046
- /**
1047
- * Read string from WASM heap
1048
- * @param wasmModule - pdfium wasm module instance
1049
- * @param readChars - function to read chars
1050
- * @param parseChars - function to parse chars
1051
- * @param defaultLength - default length of chars that needs to read
1052
- * @returns string from the heap
1053
- *
1054
- * @public
1055
- */
1056
- declare function readString(wasmModule: PdfiumRuntimeMethods & PdfiumModule, readChars: (buffer: number, bufferLength: number) => number, parseChars: (buffer: number) => string, defaultLength?: number): string;
1057
- /**
1058
- * Read arraybyffer from WASM heap
1059
- * @param wasmModule - pdfium wasm module instance
1060
- * @param readChars - function to read chars
1061
- * @returns arraybuffer from the heap
1062
- *
1063
- * @public
1064
- */
1065
- declare function readArrayBuffer(wasmModule: PdfiumRuntimeMethods & PdfiumModule, readChars: (buffer: number, bufferLength: number) => number): ArrayBuffer;
1066
-
1067
- /**
1068
- * EngineRunner for pdfium-based wasm engine
1069
- */
1070
- declare class PdfiumEngineRunner extends EngineRunner {
1071
- private wasmBinary;
1072
- /**
1073
- * Create an instance of PdfiumEngineRunner
1074
- * @param wasmBinary - wasm binary that contains the pdfium wasm file
1075
- */
1076
- constructor(wasmBinary: ArrayBuffer);
1077
- /**
1078
- * Initialize runner
1079
- */
1080
- prepare(): Promise<void>;
1081
- }
989
+ declare function createPdfiumEngine(wasmUrl: string): Promise<PdfiumEngine>;
1082
990
 
1083
- export { BitmapFormat, type ImageDataConverter, PdfiumEngine, PdfiumEngineRunner, PdfiumErrorCode, RenderFlag, type SearchContext, browserImageDataToBlobConverter, readArrayBuffer, readString };
991
+ export { createPdfiumEngine };