@embedpdf/engines 1.0.7 → 1.0.9
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/index.cjs +405 -258
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +101 -56
- package/dist/index.js +406 -259
- package/dist/index.js.map +1 -1
- package/dist/pdfium-direct-engine.cjs +379 -232
- package/dist/pdfium-direct-engine.cjs.map +1 -1
- package/dist/pdfium-direct-engine.d.ts +95 -50
- package/dist/pdfium-direct-engine.js +380 -233
- package/dist/pdfium-direct-engine.js.map +1 -1
- package/dist/pdfium-worker-engine.cjs +21 -21
- package/dist/pdfium-worker-engine.cjs.map +1 -1
- package/dist/pdfium-worker-engine.d.ts +7 -7
- package/dist/pdfium-worker-engine.js +21 -21
- package/dist/pdfium-worker-engine.js.map +1 -1
- package/dist/pdfium.cjs +382 -235
- package/dist/pdfium.cjs.map +1 -1
- package/dist/pdfium.d.ts +95 -50
- package/dist/pdfium.js +383 -236
- package/dist/pdfium.js.map +1 -1
- package/dist/preact.cjs +5 -3
- package/dist/preact.cjs.map +1 -1
- package/dist/preact.d.ts +4 -3
- package/dist/preact.js +5 -3
- package/dist/preact.js.map +1 -1
- package/dist/react.cjs +5 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.ts +4 -3
- package/dist/react.js +5 -3
- package/dist/react.js.map +1 -1
- package/dist/worker.cjs +20 -20
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.ts +7 -7
- package/dist/worker.js +20 -20
- package/dist/worker.js.map +1 -1
- package/package.json +3 -3
package/dist/pdfium.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SearchTarget, PdfImage, ImageConversionTypes, PdfEngine, Logger, Task, PdfErrorReason, PdfFileUrl, PdfUrlOptions, PdfDocumentObject, PdfFile, PdfFileLoader, PdfSignatureObject, PdfBookmarkObject, PdfPageObject, Rotation, PdfRenderOptions, PdfTask, Rect, PdfAnnotationObject,
|
|
1
|
+
import { SearchTarget, PdfImage, ImageConversionTypes, PdfEngine, Logger, Task, PdfErrorReason, PdfFileUrl, PdfUrlOptions, PdfDocumentObject, PdfFile, PdfFileLoader, PdfSignatureObject, PdfBookmarkObject, PdfPageObject, Rotation, PdfRenderOptions, PdfTask, Rect, PdfAnnotationObject, PdfTextRectObject, PdfAttachmentObject, PdfWidgetAnnoObject, FormFieldValue, PdfPageFlattenFlag, PdfPageFlattenResult, PageTextSlice, PdfInkAnnoObject, PdfHighlightAnnoObject, PdfUnderlineAnnoObject, PdfStrikeOutAnnoObject, PdfSquigglyAnnoObject, PdfStampAnnoObjectContents, Position, PdfPageGeometry, PdfGlyphObject, AppearanceMode, PdfAnnotationObjectBase, WebAlphaColor, MatchFlag, SearchAllPagesResult, PdfEngineMethodName, PdfEngineMethodArgs, TaskReturn, PdfEngineMethodReturnType } from '@embedpdf/models';
|
|
2
2
|
import { WrappedPdfiumModule, PdfiumRuntimeMethods, PdfiumModule } from '@embedpdf/pdfium';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -219,12 +219,6 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
219
219
|
* @returns PdfTask<boolean> – true on success
|
|
220
220
|
*/
|
|
221
221
|
updatePageAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject): PdfTask<boolean>;
|
|
222
|
-
/**
|
|
223
|
-
* {@inheritDoc @embedpdf/models!PdfEngine.transformPageAnnotation}
|
|
224
|
-
*
|
|
225
|
-
* @public
|
|
226
|
-
*/
|
|
227
|
-
transformPageAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject, transformation: PdfAnnotationTransformation): Task<boolean, PdfErrorReason> | Task<any, PdfErrorReason>;
|
|
228
222
|
/**
|
|
229
223
|
* {@inheritDoc @embedpdf/models!PdfEngine.removePageAnnotation}
|
|
230
224
|
*
|
|
@@ -339,7 +333,7 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
339
333
|
*
|
|
340
334
|
* @private
|
|
341
335
|
*/
|
|
342
|
-
addInkStroke(page: PdfPageObject, pagePtr: number, annotationPtr: number,
|
|
336
|
+
addInkStroke(page: PdfPageObject, pagePtr: number, annotationPtr: number, annotation: PdfInkAnnoObject): boolean;
|
|
343
337
|
/**
|
|
344
338
|
* Add highlight content to annotation
|
|
345
339
|
* @param page - page info
|
|
@@ -349,7 +343,7 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
349
343
|
*
|
|
350
344
|
* @private
|
|
351
345
|
*/
|
|
352
|
-
addTextMarkupContent(page: PdfPageObject, annotationPtr: number, annotation: PdfHighlightAnnoObject | PdfUnderlineAnnoObject | PdfStrikeOutAnnoObject | PdfSquigglyAnnoObject
|
|
346
|
+
addTextMarkupContent(page: PdfPageObject, pagePtr: number, annotationPtr: number, annotation: PdfHighlightAnnoObject | PdfUnderlineAnnoObject | PdfStrikeOutAnnoObject | PdfSquigglyAnnoObject): boolean;
|
|
353
347
|
/**
|
|
354
348
|
* Add contents to stamp annotation
|
|
355
349
|
* @param docPtr - pointer to pdf document object
|
|
@@ -505,47 +499,6 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
505
499
|
* @private
|
|
506
500
|
*/
|
|
507
501
|
private readAnnotationColor;
|
|
508
|
-
/**
|
|
509
|
-
* Extract the fill (or, if absent, the stroke) colour from a **path object**
|
|
510
|
-
* inside an appearance stream.
|
|
511
|
-
*
|
|
512
|
-
* Works for simple highlights produced by Chrome, Preview, etc. that paint a
|
|
513
|
-
* single filled rectangle with the desired tint.
|
|
514
|
-
*
|
|
515
|
-
* @param pathPtr - pointer to a `FPDF_PAGEOBJECT` of type **PATH**
|
|
516
|
-
* @returns RGBA tuple or `undefined` when no colour is set on the path
|
|
517
|
-
*
|
|
518
|
-
* @private
|
|
519
|
-
*/
|
|
520
|
-
private getColorFromPath;
|
|
521
|
-
/**
|
|
522
|
-
* Recursively walk a page-object tree (PATHs and nested FORM XObjects) until
|
|
523
|
-
* a colour can be extracted.
|
|
524
|
-
*
|
|
525
|
-
* Acrobat often wraps its highlight rectangle in a Form XObject referenced by
|
|
526
|
-
* the "Do" operator, so this function drills down unlimited depth.
|
|
527
|
-
*
|
|
528
|
-
* @param objPtr - pointer to a `FPDF_PAGEOBJECT`
|
|
529
|
-
* @returns First RGBA tint found, or `undefined` if none of the descendants
|
|
530
|
-
* carry an explicit fill/stroke colour
|
|
531
|
-
*
|
|
532
|
-
* @private
|
|
533
|
-
*/
|
|
534
|
-
private walkPageObjTree;
|
|
535
|
-
/**
|
|
536
|
-
* Iterate over every top-level object in the annotation's **appearance stream**
|
|
537
|
-
* and invoke {@link walkPageObjTree} to locate a usable tint.
|
|
538
|
-
*
|
|
539
|
-
* Catches:
|
|
540
|
-
* • Simple filled path (Preview, Chrome)
|
|
541
|
-
* • Form XObject containing the path (Acrobat)
|
|
542
|
-
*
|
|
543
|
-
* @param annotPtr - pointer to an `FPDF_ANNOTATION`
|
|
544
|
-
* @returns RGBA tuple or `undefined` when no colour can be resolved from AP
|
|
545
|
-
*
|
|
546
|
-
* @private
|
|
547
|
-
*/
|
|
548
|
-
private colorFromAppearance;
|
|
549
502
|
/**
|
|
550
503
|
* Resolve the visible fill colour for **Highlight / Underline / StrikeOut /
|
|
551
504
|
* Squiggly** markup annotations.
|
|
@@ -574,6 +527,57 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
574
527
|
* @private
|
|
575
528
|
*/
|
|
576
529
|
private setAnnotationColor;
|
|
530
|
+
/**
|
|
531
|
+
* Border‐style + width helper
|
|
532
|
+
*
|
|
533
|
+
* Tries the new PDFium helper `EPDFAnnot_GetBorderStyle()` (patch series
|
|
534
|
+
* 9 July 2025).
|
|
535
|
+
*
|
|
536
|
+
* @param annotationPtr pointer to an `FPDF_ANNOTATION`
|
|
537
|
+
* @returns `{ ok, style, width }`
|
|
538
|
+
* • `ok` – `true` when the call succeeded
|
|
539
|
+
* • `style` – `PdfAnnotationBorderStyle` enum
|
|
540
|
+
* • `width` – stroke-width in points (defaults to 0 pt)
|
|
541
|
+
*/
|
|
542
|
+
private getBorderStyle;
|
|
543
|
+
private setBorderStyle;
|
|
544
|
+
/**
|
|
545
|
+
* Border-effect (“cloudy”) helper
|
|
546
|
+
*
|
|
547
|
+
* Calls the new PDFium function `EPDFAnnot_GetBorderEffect()` (July 2025).
|
|
548
|
+
*
|
|
549
|
+
* @param annotationPtr pointer to an `FPDF_ANNOTATION`
|
|
550
|
+
* @returns `{ ok, intensity }`
|
|
551
|
+
* • `ok` – `true` when the annotation *does* have a
|
|
552
|
+
* valid cloudy-border effect
|
|
553
|
+
* • `intensity` – radius/intensity value (0 when `ok` is false)
|
|
554
|
+
*/
|
|
555
|
+
private getBorderEffect;
|
|
556
|
+
/**
|
|
557
|
+
* Rectangle-differences helper ( /RD array on Square / Circle annots )
|
|
558
|
+
*
|
|
559
|
+
* Calls `EPDFAnnot_GetRectangleDifferences()` introduced in July 2025.
|
|
560
|
+
*
|
|
561
|
+
* @param annotationPtr pointer to an `FPDF_ANNOTATION`
|
|
562
|
+
* @returns `{ ok, left, top, right, bottom }`
|
|
563
|
+
* • `ok` – `true` when the annotation *has* an /RD entry
|
|
564
|
+
* • the four floats are 0 when `ok` is false
|
|
565
|
+
*/
|
|
566
|
+
private getRectangleDifferences;
|
|
567
|
+
/**
|
|
568
|
+
* Dash-pattern helper ( /BS → /D array, dashed borders only )
|
|
569
|
+
*
|
|
570
|
+
* Uses the two new PDFium helpers:
|
|
571
|
+
* • `EPDFAnnot_GetBorderDashPatternCount`
|
|
572
|
+
* • `EPDFAnnot_GetBorderDashPattern`
|
|
573
|
+
*
|
|
574
|
+
* @param annotationPtr pointer to an `FPDF_ANNOTATION`
|
|
575
|
+
* @returns `{ ok, pattern }`
|
|
576
|
+
* • `ok` – `true` when the annot is dashed *and* the array
|
|
577
|
+
* was retrieved successfully
|
|
578
|
+
* • `pattern` – numeric array of dash/space lengths (empty when `ok` is false)
|
|
579
|
+
*/
|
|
580
|
+
private getBorderDashPattern;
|
|
577
581
|
/**
|
|
578
582
|
* Read `/QuadPoints` from any annotation and convert each quadrilateral to
|
|
579
583
|
* device-space coordinates.
|
|
@@ -601,6 +605,21 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
601
605
|
* @private
|
|
602
606
|
*/
|
|
603
607
|
private syncQuadPointsAnno;
|
|
608
|
+
/**
|
|
609
|
+
* Read ink list from annotation
|
|
610
|
+
* @param page - logical page info object (`PdfPageObject`)
|
|
611
|
+
* @param annotationPtr - pointer to the annotation whose ink list is needed
|
|
612
|
+
* @returns ink list
|
|
613
|
+
*/
|
|
614
|
+
private getInkList;
|
|
615
|
+
/**
|
|
616
|
+
* Add ink list to annotation
|
|
617
|
+
* @param page - logical page info object (`PdfPageObject`)
|
|
618
|
+
* @param annotationPtr - pointer to the annotation whose ink list is needed
|
|
619
|
+
* @param annotation - annotation object (`PdfInkAnnoObject`)
|
|
620
|
+
* @returns `true` if the operation was successful
|
|
621
|
+
*/
|
|
622
|
+
private setInkList;
|
|
604
623
|
/**
|
|
605
624
|
* Read pdf text annotation
|
|
606
625
|
* @param page - pdf page infor
|
|
@@ -819,6 +838,25 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
819
838
|
* @private
|
|
820
839
|
*/
|
|
821
840
|
private readPdfPageObjectTransformMatrix;
|
|
841
|
+
/**
|
|
842
|
+
* Return the stroke-width declared in the annotation’s /Border or /BS entry.
|
|
843
|
+
* Falls back to 1 pt when nothing is defined.
|
|
844
|
+
*
|
|
845
|
+
* @param annotationPtr - pointer to pdf annotation
|
|
846
|
+
* @returns stroke-width
|
|
847
|
+
*
|
|
848
|
+
* @private
|
|
849
|
+
*/
|
|
850
|
+
private getStrokeWidth;
|
|
851
|
+
/**
|
|
852
|
+
* Fetches the `/F` flag bit-field from an annotation.
|
|
853
|
+
*
|
|
854
|
+
* @param annotationPtr pointer to an `FPDF_ANNOTATION`
|
|
855
|
+
* @returns `{ raw, flags }`
|
|
856
|
+
* • `raw` – the 32-bit integer returned by PDFium
|
|
857
|
+
* • `flags` – object with individual booleans
|
|
858
|
+
*/
|
|
859
|
+
private getAnnotationFlags;
|
|
822
860
|
/**
|
|
823
861
|
* Read circle annotation
|
|
824
862
|
* @param page - pdf page infor
|
|
@@ -908,6 +946,13 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
908
946
|
* @private
|
|
909
947
|
*/
|
|
910
948
|
private readPdfWidgetAnnoField;
|
|
949
|
+
/**
|
|
950
|
+
* {@inheritDoc @embedpdf/models!PdfEngine.renderAnnotation}
|
|
951
|
+
*
|
|
952
|
+
* @public
|
|
953
|
+
*/
|
|
954
|
+
renderAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject, scaleFactor: number, rotation: Rotation, dpr?: number, // device-pixel-ratio (canvas)
|
|
955
|
+
mode?: AppearanceMode, imageType?: ImageConversionTypes): PdfTask<T>;
|
|
911
956
|
/**
|
|
912
957
|
* render rectangle of pdf page to image
|
|
913
958
|
* @param docPtr - pointer to pdf document object
|