@embedpdf/engines 1.0.6 → 1.0.7
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 +368 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +72 -21
- package/dist/index.js +369 -185
- package/dist/index.js.map +1 -1
- package/dist/pdfium-direct-engine.cjs +325 -177
- package/dist/pdfium-direct-engine.cjs.map +1 -1
- package/dist/pdfium-direct-engine.d.ts +69 -20
- package/dist/pdfium-direct-engine.js +326 -178
- package/dist/pdfium-direct-engine.js.map +1 -1
- package/dist/pdfium-worker-engine.cjs +31 -1
- package/dist/pdfium-worker-engine.cjs.map +1 -1
- package/dist/pdfium-worker-engine.d.ts +4 -2
- package/dist/pdfium-worker-engine.js +31 -1
- package/dist/pdfium-worker-engine.js.map +1 -1
- package/dist/pdfium.cjs +332 -178
- package/dist/pdfium.cjs.map +1 -1
- package/dist/pdfium.d.ts +69 -20
- package/dist/pdfium.js +333 -179
- package/dist/pdfium.js.map +1 -1
- package/dist/worker.cjs +30 -0
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.ts +4 -2
- package/dist/worker.js +30 -0
- 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, PdfAnnotationTransformation, PdfTextRectObject, PdfAttachmentObject, PdfWidgetAnnoObject, FormFieldValue, PdfPageFlattenFlag, PdfPageFlattenResult, PageTextSlice, PdfInkListObject, PdfStampAnnoObjectContents, Position, PdfPageGeometry, PdfGlyphObject, MatchFlag, SearchAllPagesResult, PdfEngineMethodName, PdfEngineMethodArgs, TaskReturn, PdfEngineMethodReturnType } from '@embedpdf/models';
|
|
1
|
+
import { SearchTarget, PdfImage, ImageConversionTypes, PdfEngine, Logger, Task, PdfErrorReason, PdfFileUrl, PdfUrlOptions, PdfDocumentObject, PdfFile, PdfFileLoader, PdfSignatureObject, PdfBookmarkObject, PdfPageObject, Rotation, PdfRenderOptions, PdfTask, Rect, PdfAnnotationObject, PdfAnnotationTransformation, PdfTextRectObject, PdfAttachmentObject, PdfWidgetAnnoObject, FormFieldValue, PdfPageFlattenFlag, PdfPageFlattenResult, PageTextSlice, PdfInkListObject, PdfHighlightAnnoObject, PdfUnderlineAnnoObject, PdfStrikeOutAnnoObject, PdfSquigglyAnnoObject, PdfStampAnnoObjectContents, Position, PdfPageGeometry, PdfGlyphObject, PdfAnnotationObjectBase, WebAlphaColor, MatchFlag, SearchAllPagesResult, PdfEngineMethodName, PdfEngineMethodArgs, TaskReturn, PdfEngineMethodReturnType } from '@embedpdf/models';
|
|
2
2
|
import { WrappedPdfiumModule, PdfiumRuntimeMethods, PdfiumModule } from '@embedpdf/pdfium';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -208,7 +208,17 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
208
208
|
*
|
|
209
209
|
* @public
|
|
210
210
|
*/
|
|
211
|
-
createPageAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject):
|
|
211
|
+
createPageAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject): PdfTask<number>;
|
|
212
|
+
/**
|
|
213
|
+
* Update an existing page annotation in-place
|
|
214
|
+
*
|
|
215
|
+
* • Locates the annot by page-local index (`annotation.id`)
|
|
216
|
+
* • Re-writes its /Rect and type-specific payload
|
|
217
|
+
* • Calls FPDFPage_GenerateContent so the new appearance is rendered
|
|
218
|
+
*
|
|
219
|
+
* @returns PdfTask<boolean> – true on success
|
|
220
|
+
*/
|
|
221
|
+
updatePageAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject): PdfTask<boolean>;
|
|
212
222
|
/**
|
|
213
223
|
* {@inheritDoc @embedpdf/models!PdfEngine.transformPageAnnotation}
|
|
214
224
|
*
|
|
@@ -330,6 +340,16 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
330
340
|
* @private
|
|
331
341
|
*/
|
|
332
342
|
addInkStroke(page: PdfPageObject, pagePtr: number, annotationPtr: number, inkList: PdfInkListObject[]): boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Add highlight content to annotation
|
|
345
|
+
* @param page - page info
|
|
346
|
+
* @param annotationPtr - pointer to highlight annotation
|
|
347
|
+
* @param annotation - highlight annotation
|
|
348
|
+
* @returns whether highlight content is added to annotation
|
|
349
|
+
*
|
|
350
|
+
* @private
|
|
351
|
+
*/
|
|
352
|
+
addTextMarkupContent(page: PdfPageObject, annotationPtr: number, annotation: PdfHighlightAnnoObject | PdfUnderlineAnnoObject | PdfStrikeOutAnnoObject | PdfSquigglyAnnoObject, shouldClearAP?: boolean): boolean;
|
|
333
353
|
/**
|
|
334
354
|
* Add contents to stamp annotation
|
|
335
355
|
* @param docPtr - pointer to pdf document object
|
|
@@ -537,11 +557,23 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
537
557
|
*
|
|
538
558
|
* @param annotationPtr - pointer to an `FPDF_ANNOTATION`
|
|
539
559
|
* @param fallback - colour to use when the PDF stores no tint at all
|
|
540
|
-
* @returns
|
|
560
|
+
* @returns WebAlphaColor with hex color and opacity (0-1)
|
|
541
561
|
*
|
|
542
562
|
* @private
|
|
543
563
|
*/
|
|
544
564
|
private resolveAnnotationColor;
|
|
565
|
+
/**
|
|
566
|
+
* Set the fill/stroke colour for a **Highlight / Underline / StrikeOut / Squiggly** markup annotation.
|
|
567
|
+
*
|
|
568
|
+
* @param annotationPtr - pointer to the annotation whose colour is being set
|
|
569
|
+
* @param webAlphaColor - WebAlphaColor with hex color and opacity (0-1)
|
|
570
|
+
* @param shouldClearAP - whether to clear the /AP entry
|
|
571
|
+
* @param which - which colour to set (0 = fill, 1 = stroke)
|
|
572
|
+
* @returns `true` if the operation was successful
|
|
573
|
+
*
|
|
574
|
+
* @private
|
|
575
|
+
*/
|
|
576
|
+
private setAnnotationColor;
|
|
545
577
|
/**
|
|
546
578
|
* Read `/QuadPoints` from any annotation and convert each quadrilateral to
|
|
547
579
|
* device-space coordinates.
|
|
@@ -553,11 +585,22 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
553
585
|
*
|
|
554
586
|
* @param page - logical page info object (`PdfPageObject`)
|
|
555
587
|
* @param annotationPtr - pointer to the annotation whose quads are needed
|
|
556
|
-
* @returns Array of `
|
|
588
|
+
* @returns Array of `Rect` objects (`[]` if the annotation has no quads)
|
|
589
|
+
*
|
|
590
|
+
* @private
|
|
591
|
+
*/
|
|
592
|
+
private getQuadPointsAnno;
|
|
593
|
+
/**
|
|
594
|
+
* Set the quadrilaterals for a **Highlight / Underline / StrikeOut / Squiggly** markup annotation.
|
|
595
|
+
*
|
|
596
|
+
* @param page - logical page info object (`PdfPageObject`)
|
|
597
|
+
* @param annotationPtr - pointer to the annotation whose quads are needed
|
|
598
|
+
* @param rects - array of `Rect` objects (`[]` if the annotation has no quads)
|
|
599
|
+
* @returns `true` if the operation was successful
|
|
557
600
|
*
|
|
558
601
|
* @private
|
|
559
602
|
*/
|
|
560
|
-
private
|
|
603
|
+
private syncQuadPointsAnno;
|
|
561
604
|
/**
|
|
562
605
|
* Read pdf text annotation
|
|
563
606
|
* @param page - pdf page infor
|
|
@@ -820,14 +863,6 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
820
863
|
* @private
|
|
821
864
|
*/
|
|
822
865
|
private getInReplyToId;
|
|
823
|
-
/**
|
|
824
|
-
* Parse a PDF date string **D:YYYYMMDDHHmmSSOHH'mm'** to ISO-8601.
|
|
825
|
-
*
|
|
826
|
-
* Returns `undefined` if the input is malformed.
|
|
827
|
-
*
|
|
828
|
-
* @private
|
|
829
|
-
*/
|
|
830
|
-
private toIsoDate;
|
|
831
866
|
/**
|
|
832
867
|
* Fetch a string value (`/T`, `/M`, `/State`, …) from an annotation.
|
|
833
868
|
*
|
|
@@ -837,16 +872,13 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
837
872
|
*/
|
|
838
873
|
private getAnnotString;
|
|
839
874
|
/**
|
|
840
|
-
*
|
|
841
|
-
*
|
|
842
|
-
* @
|
|
843
|
-
* @param annotationPtr - pointer to pdf annotation
|
|
844
|
-
* @param index - index of annotation in the pdf page
|
|
845
|
-
* @returns pdf popup linked to annotation
|
|
875
|
+
* Set a string value (`/T`, `/M`, `/State`, …) to an annotation.
|
|
876
|
+
*
|
|
877
|
+
* @returns `true` if the operation was successful
|
|
846
878
|
*
|
|
847
879
|
* @private
|
|
848
880
|
*/
|
|
849
|
-
private
|
|
881
|
+
private setAnnotString;
|
|
850
882
|
/**
|
|
851
883
|
* Read vertices of pdf annotation
|
|
852
884
|
* @param page - pdf page infor
|
|
@@ -972,6 +1004,23 @@ declare class PdfiumEngine<T = Blob> implements PdfEngine<T> {
|
|
|
972
1004
|
* @private
|
|
973
1005
|
*/
|
|
974
1006
|
private readPageAnnoAppearanceStream;
|
|
1007
|
+
/**
|
|
1008
|
+
* Change the visible colour (and opacity) of an existing annotation.
|
|
1009
|
+
*
|
|
1010
|
+
* For markup annotations (highlight / underline / strikeout / squiggly) we
|
|
1011
|
+
* first clear the AP dictionary entry, otherwise the stored appearance stream
|
|
1012
|
+
* will override the new tint. For all other sub-types we keep the existing
|
|
1013
|
+
* AP so custom artwork isn't lost.
|
|
1014
|
+
*
|
|
1015
|
+
* @param doc logical document object
|
|
1016
|
+
* @param page logical page object
|
|
1017
|
+
* @param annotation the annotation we want to recolour
|
|
1018
|
+
* @param colour RGBA tuple (0-255 per channel)
|
|
1019
|
+
* @param which 0 = stroke/fill colour (PDFium's "colourType" param)
|
|
1020
|
+
*
|
|
1021
|
+
* @returns `true` when the operation succeeded
|
|
1022
|
+
*/
|
|
1023
|
+
updateAnnotationColor(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObjectBase, color: WebAlphaColor, which?: number): PdfTask<boolean>;
|
|
975
1024
|
/**
|
|
976
1025
|
* Set the rect of specified annotation
|
|
977
1026
|
* @param page - page info that the annotation is belonged to
|