@embedpdf/engine-services 3.0.0-next.3 → 3.0.0-next.5
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 +681 -439
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -19
- package/dist/index.d.ts +95 -19
- package/dist/index.js +681 -441
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfFunctions, PdfRuntimeMemory, PdfRuntimeModule, Ptr } from "@embedpdf/engine-runtime";
|
|
2
|
-
import { ActionReadBudget, AnnotationActor, AnnotationAppearanceRenderOptions, AnnotationAppearancesResult, AnnotationCreateResult, AnnotationDeleteResult, AnnotationListMutationMeta, AnnotationListPageSnapshot, AnnotationListSnapshotAllPages, AnnotationMoveResult, AnnotationMutationKind, AnnotationRef, AnnotationStableId, AnnotationUpdateResult, AttachmentCreateResult, AttachmentDeleteResult, AttachmentFileInfo, AttachmentFileWorkerPayload, DocumentActionsSnapshot, DocumentEvent, DocumentEventInit, DocumentEventStream, DocumentMetadata, DocumentSecurityProbeInfo, EmbeddedFileItem, EmbeddedFileRef, FormDataFormat, FormEffect, FormEffectsResult, FormFieldDTO, FormFieldDraft, FormFieldPatch, FormFieldRef, FormFieldValue, FormImportResult, FormRepairResult, FormSetValueResult, FormSnapshot, FormWidgetRef, MetadataPatch, MetadataUpdateResult, PageDeleteResult, PageFlattenResult, PageFlattenUsage, PageGeometrySnapshot, PageInsertResult, PageListSnapshot, PageMoveResult, PageObjectNumber, PageRenderOptions, PageRotateResult, PageRotation, PageState, PageTextSnapshot, PdfActionTree, PdfSaveMode, RedactionApplyResult, RedactionApplyScope, RevisionToken, SearchRequest, SearchSlice, WeakAnnotationState, WireAnnotationDraft, WireAnnotationPatch, WireAttachmentFile, WirePack, WireResource, WireResourceMap, WorkerRequest, WorkerResponse } from "@embedpdf/engine-core/runtime";
|
|
2
|
+
import { ActionReadBudget, AnnotationActor, AnnotationAppearanceRenderOptions, AnnotationAppearancesResult, AnnotationCreateResult, AnnotationDeleteResult, AnnotationListMutationMeta, AnnotationListPageSnapshot, AnnotationListSnapshotAllPages, AnnotationMoveResult, AnnotationMutationKind, AnnotationRef, AnnotationStableId, AnnotationUpdateResult, AttachmentCreateResult, AttachmentDeleteResult, AttachmentFileInfo, AttachmentFileWorkerPayload, DocumentActionsSnapshot, DocumentEvent, DocumentEventInit, DocumentEventStream, DocumentMetadata, DocumentSecurityProbeInfo, EmbeddedFileItem, EmbeddedFileRef, FormDataFormat, FormEffect, FormEffectsResult, FormFieldDTO, FormFieldDraft, FormFieldPatch, FormFieldRef, FormFieldValue, FormImportResult, FormRepairResult, FormSetValueResult, FormSnapshot, FormWidgetRef, MetadataPatch, MetadataUpdateResult, PageDeleteResult, PageFlattenResult, PageFlattenUsage, PageGeometryRun, PageGeometrySnapshot, PageInsertResult, PageListSnapshot, PageMoveResult, PageObjectNumber, PageRenderOptions, PageRotateResult, PageRotation, PageState, PageTextSnapshot, PdfActionTree, PdfQuad, PdfRect, PdfSaveMode, RedactionApplyResult, RedactionApplyScope, RevisionToken, SearchRequest, SearchSlice, WeakAnnotationState, WireAnnotationDraft, WireAnnotationPatch, WireAttachmentFile, WirePack, WireResource, WireResourceMap, WorkerRequest, WorkerResponse } from "@embedpdf/engine-core/runtime";
|
|
3
3
|
//#region src/runtime/lifecycle/bootstrap.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Initialize the thread-confined PDFium runtime for the calling thread. Each
|
|
@@ -626,29 +626,33 @@ declare class RedactionApplier {
|
|
|
626
626
|
*/
|
|
627
627
|
private preflight;
|
|
628
628
|
private applyAllOnPage;
|
|
629
|
+
private pageHasRedactAnnotations;
|
|
629
630
|
private applyRefsOnPage;
|
|
630
631
|
}
|
|
631
632
|
//#endregion
|
|
632
633
|
//#region src/features/text/PageTextReader.d.ts
|
|
633
634
|
/**
|
|
634
635
|
* Per-page slow-path text reader. Acquires a `pagePtr` from the
|
|
635
|
-
* `PagePtrPool`, opens a PDFium text page (`FPDFText_LoadPage`),
|
|
636
|
-
*
|
|
637
|
-
* and releases everything in reverse order.
|
|
636
|
+
* `PagePtrPool`, opens a PDFium text page (`FPDFText_LoadPage`), extracts
|
|
637
|
+
* the page text, and releases everything in reverse order.
|
|
638
638
|
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
643
|
-
*
|
|
644
|
-
* to a JS string, faithfully preserving surrogate pairs.
|
|
639
|
+
* Index spaces (see engine-core `text/charmap.ts`): `charCount` is the
|
|
640
|
+
* CHARACTER space (`FPDFText_CountChars` — the space geometry runs tile);
|
|
641
|
+
* `text` is the TEXT projection. The two diverge when a character
|
|
642
|
+
* contributes zero text units (non-printing) or two (supplementary plane);
|
|
643
|
+
* `charMap` anchors encode exactly those deviations.
|
|
645
644
|
*
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
645
|
+
* Both come from the fork's batched extension calls, which share one
|
|
646
|
+
* encoding authority (`FX_UTF16Encode`) so text and map can never
|
|
647
|
+
* disagree:
|
|
648
|
+
*
|
|
649
|
+
* - `EPDFText_GetTextFull` — true UTF-16LE extraction; supplementary
|
|
650
|
+
* characters arrive as surrogate pairs instead of being silently
|
|
651
|
+
* dropped by `FPDFText_GetText`'s UCS-2 encoder. Called once with an
|
|
652
|
+
* upper-bound buffer (2 units per character + NUL), so no measure
|
|
653
|
+
* round-trip.
|
|
654
|
+
* - `EPDFText_GetCharToTextMap` — the anchors, measure-then-fill. Zero
|
|
655
|
+
* anchors is the common (identity) page and skips the fill call.
|
|
652
656
|
*/
|
|
653
657
|
declare class PageTextReader {
|
|
654
658
|
private readonly runtime;
|
|
@@ -658,21 +662,93 @@ declare class PageTextReader {
|
|
|
658
662
|
}
|
|
659
663
|
//#endregion
|
|
660
664
|
//#region src/features/geometry/PageGeometryReader.d.ts
|
|
665
|
+
/**
|
|
666
|
+
* One glyph as read from `EPDFText_GetCharGeometry`, plus the run-grouping
|
|
667
|
+
* context sampled alongside it. Pure data — no native handles — so the
|
|
668
|
+
* grouping stage below is a pure function the tests can drive directly.
|
|
669
|
+
*/
|
|
670
|
+
interface RawGeometryGlyphRecord {
|
|
671
|
+
/** Grouping key: the glyph's text object handle (opaque identity). */
|
|
672
|
+
objectKey: number | bigint;
|
|
673
|
+
/** Sampled at each text object's first glyph (run splits inherit it). */
|
|
674
|
+
fontSize?: number;
|
|
675
|
+
/**
|
|
676
|
+
* Wire flags (bit 1 = space, bit 2 = empty). Synthesized-but-visible
|
|
677
|
+
* glyphs (/ActualText pieces) stay 0, exactly like the legacy reader —
|
|
678
|
+
* they represent real, selectable text.
|
|
679
|
+
*/
|
|
680
|
+
flags: number;
|
|
681
|
+
/** Page-space AABB (zeroed when empty). */
|
|
682
|
+
looseBox: PdfRect;
|
|
683
|
+
tightBox?: PdfRect;
|
|
684
|
+
/** Oriented cells — real glyphs with a usable (non-singular) matrix only. */
|
|
685
|
+
looseQuad?: PdfQuad;
|
|
686
|
+
tightQuad?: PdfQuad;
|
|
687
|
+
/** Native uprightness of the char matrix (empty glyphs: true, inert). */
|
|
688
|
+
upright: boolean;
|
|
689
|
+
/** Baseline angle (radians CCW, PDF y-up); 0 when upright. */
|
|
690
|
+
rotation: number;
|
|
691
|
+
/** True when the ascent vector maps opposite the rotated +y (det < 0). */
|
|
692
|
+
ascentFlip: boolean;
|
|
693
|
+
}
|
|
661
694
|
/**
|
|
662
695
|
* Geometry-only text layout reader.
|
|
663
696
|
*
|
|
664
697
|
* Emits geometry in PDF user space (y-up edges) — the canonical engine
|
|
665
698
|
* geometry. The viewer converts to content/view space via the page geometry
|
|
666
699
|
* matrix; this reader applies NO Y-flip or device transform.
|
|
700
|
+
*
|
|
701
|
+
* One `EPDFText_GetCharGeometry` call per glyph supplies boxes, oriented
|
|
702
|
+
* cells, and flags together; `buildRunsFromRawGlyphs` then groups glyphs
|
|
703
|
+
* into the upright/rotated run union. Upright runs are byte-identical to the
|
|
704
|
+
* pre-orientation reader (quads the native layer offers are deliberately
|
|
705
|
+
* dropped — the dominant case never pays for orientation).
|
|
667
706
|
*/
|
|
668
707
|
declare class PageGeometryReader {
|
|
669
708
|
private readonly runtime;
|
|
670
709
|
private readonly session;
|
|
671
710
|
constructor(runtime: PdfRuntimeModule, session: DocumentSession);
|
|
672
711
|
read(pageObjectNumber: PageObjectNumber, signal: AbortSignal): PageGeometrySnapshot;
|
|
673
|
-
private
|
|
674
|
-
private readGlyphInfo;
|
|
712
|
+
private readGlyphRaw;
|
|
675
713
|
}
|
|
714
|
+
/**
|
|
715
|
+
* Group per-glyph records into the run union. Pure — exported for tests.
|
|
716
|
+
*
|
|
717
|
+
* Runs split on text-object change (the legacy rule) and on orientation
|
|
718
|
+
* change between classifiable glyphs (θ drift / mixed orientation). A run's
|
|
719
|
+
* variant is decided by its FIRST classifiable glyph:
|
|
720
|
+
* - empty glyphs never classify (they adopt the run's variant);
|
|
721
|
+
* - real glyphs WITHOUT an oriented cell (singular matrix, synthesized
|
|
722
|
+
* /ActualText pieces) classify as upright — box-only data degrades to
|
|
723
|
+
* exactly the legacy behavior;
|
|
724
|
+
* - real glyphs with a non-upright matrix classify as rotated.
|
|
725
|
+
* Runs that never see a classifiable glyph emit as upright (degenerate,
|
|
726
|
+
* legacy behavior).
|
|
727
|
+
*/
|
|
728
|
+
declare function buildRunsFromRawGlyphs(records: RawGeometryGlyphRecord[]): PageGeometryRun[];
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region src/runtime/memory/structs.d.ts
|
|
731
|
+
/** Generated from `EPDF_CHAR_GEOMETRY`; pinned by native static_asserts. */
|
|
732
|
+
declare const EPDF_CHAR_GEOMETRY_LAYOUT: {
|
|
733
|
+
readonly bytes: 124;
|
|
734
|
+
readonly offsets: {
|
|
735
|
+
readonly looseBox: 0;
|
|
736
|
+
readonly tightBox: 16;
|
|
737
|
+
readonly looseQuad: 32;
|
|
738
|
+
readonly tightQuad: 64;
|
|
739
|
+
readonly matrix: 96;
|
|
740
|
+
readonly flags: 120;
|
|
741
|
+
};
|
|
742
|
+
readonly flags: {
|
|
743
|
+
readonly hasTightBox: number;
|
|
744
|
+
readonly hasLooseQuad: number;
|
|
745
|
+
readonly hasTightQuad: number;
|
|
746
|
+
readonly upright: number;
|
|
747
|
+
readonly space: number;
|
|
748
|
+
readonly empty: number;
|
|
749
|
+
readonly synthesized: number;
|
|
750
|
+
};
|
|
751
|
+
};
|
|
676
752
|
//#endregion
|
|
677
753
|
//#region src/features/render/PageRenderReader.d.ts
|
|
678
754
|
declare class PageRenderReader {
|
|
@@ -1477,5 +1553,5 @@ declare class WorkerHost {
|
|
|
1477
1553
|
private saveLayerArtifact;
|
|
1478
1554
|
}
|
|
1479
1555
|
//#endregion
|
|
1480
|
-
export { ALL_STANDARD_SECURITY_PERMISSIONS, type AcquiredBaseDocument, ActionReadBudgetTracker, AnnotationAppearanceReader, AnnotationMutator, AnnotationReader, AttachmentMutator, AttachmentReader, BaseDocumentRegistry, CloseStack, DocumentActionsReader, PagesMutator as DocumentPagesMutator, PagesMutator, DocumentSaver, DocumentSession, EventHub, FontRegistrar, FormMutator, FormReader, FormsEffectsApplier, type ImpactInputs, type LayerSource, LocalRevisionAuthority, MetadataMutator, MetadataReader, type MutationKind, type OpenedPdfDocument, type OpenedPdfDocumentKind, PageGeometryReader, PagesReader as PageLayoutReader, PagesReader, PagePtrPool, PageRenderReader as PageRasterReader, PageRenderReader, type PageRecord, PageTextReader, PagesExtractor, PagesFlattener, PagesInserter, RawAnnotationReader, RedactionApplier, type RevisionAuthority, SearchReader, SecurityReader, SessionEventPublisher, type StartupFontSpec, WorkerHost, computeMutationImpact, destroyLibrary, disposeFormModel, ensureInitialized, formatPdfDate, generateUuid, hasAllStandardSecurityPermissions, normalizeU32, openFatMemoryDocument, openLayerDocument, pdfDateToIso, readActionModel, readAttachmentFileInfo, throwIfAborted, writeAttachmentFilePayload };
|
|
1556
|
+
export { ALL_STANDARD_SECURITY_PERMISSIONS, type AcquiredBaseDocument, ActionReadBudgetTracker, AnnotationAppearanceReader, AnnotationMutator, AnnotationReader, AttachmentMutator, AttachmentReader, BaseDocumentRegistry, CloseStack, DocumentActionsReader, PagesMutator as DocumentPagesMutator, PagesMutator, DocumentSaver, DocumentSession, EPDF_CHAR_GEOMETRY_LAYOUT, EventHub, FontRegistrar, FormMutator, FormReader, FormsEffectsApplier, type ImpactInputs, type LayerSource, LocalRevisionAuthority, MetadataMutator, MetadataReader, type MutationKind, type OpenedPdfDocument, type OpenedPdfDocumentKind, PageGeometryReader, PagesReader as PageLayoutReader, PagesReader, PagePtrPool, PageRenderReader as PageRasterReader, PageRenderReader, type PageRecord, PageTextReader, PagesExtractor, PagesFlattener, PagesInserter, RawAnnotationReader, type RawGeometryGlyphRecord, RedactionApplier, type RevisionAuthority, SearchReader, SecurityReader, SessionEventPublisher, type StartupFontSpec, WorkerHost, buildRunsFromRawGlyphs, computeMutationImpact, destroyLibrary, disposeFormModel, ensureInitialized, formatPdfDate, generateUuid, hasAllStandardSecurityPermissions, normalizeU32, openFatMemoryDocument, openLayerDocument, pdfDateToIso, readActionModel, readAttachmentFileInfo, throwIfAborted, writeAttachmentFilePayload };
|
|
1481
1557
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionReadBudget, AnnotationActor, AnnotationAppearanceRenderOptions, AnnotationAppearancesResult, AnnotationCreateResult, AnnotationDeleteResult, AnnotationListMutationMeta, AnnotationListPageSnapshot, AnnotationListSnapshotAllPages, AnnotationMoveResult, AnnotationMutationKind, AnnotationRef, AnnotationStableId, AnnotationUpdateResult, AttachmentCreateResult, AttachmentDeleteResult, AttachmentFileInfo, AttachmentFileWorkerPayload, DocumentActionsSnapshot, DocumentEvent, DocumentEventInit, DocumentEventStream, DocumentMetadata, DocumentSecurityProbeInfo, EmbeddedFileItem, EmbeddedFileRef, FormDataFormat, FormEffect, FormEffectsResult, FormFieldDTO, FormFieldDraft, FormFieldPatch, FormFieldRef, FormFieldValue, FormImportResult, FormRepairResult, FormSetValueResult, FormSnapshot, FormWidgetRef, MetadataPatch, MetadataUpdateResult, PageDeleteResult, PageFlattenResult, PageFlattenUsage, PageGeometrySnapshot, PageInsertResult, PageListSnapshot, PageMoveResult, PageObjectNumber, PageRenderOptions, PageRotateResult, PageRotation, PageState, PageTextSnapshot, PdfActionTree, PdfSaveMode, RedactionApplyResult, RedactionApplyScope, RevisionToken, SearchRequest, SearchSlice, WeakAnnotationState, WireAnnotationDraft, WireAnnotationPatch, WireAttachmentFile, WirePack, WireResource, WireResourceMap, WorkerRequest, WorkerResponse } from "@embedpdf/engine-core/runtime";
|
|
1
|
+
import { ActionReadBudget, AnnotationActor, AnnotationAppearanceRenderOptions, AnnotationAppearancesResult, AnnotationCreateResult, AnnotationDeleteResult, AnnotationListMutationMeta, AnnotationListPageSnapshot, AnnotationListSnapshotAllPages, AnnotationMoveResult, AnnotationMutationKind, AnnotationRef, AnnotationStableId, AnnotationUpdateResult, AttachmentCreateResult, AttachmentDeleteResult, AttachmentFileInfo, AttachmentFileWorkerPayload, DocumentActionsSnapshot, DocumentEvent, DocumentEventInit, DocumentEventStream, DocumentMetadata, DocumentSecurityProbeInfo, EmbeddedFileItem, EmbeddedFileRef, FormDataFormat, FormEffect, FormEffectsResult, FormFieldDTO, FormFieldDraft, FormFieldPatch, FormFieldRef, FormFieldValue, FormImportResult, FormRepairResult, FormSetValueResult, FormSnapshot, FormWidgetRef, MetadataPatch, MetadataUpdateResult, PageDeleteResult, PageFlattenResult, PageFlattenUsage, PageGeometryRun, PageGeometrySnapshot, PageInsertResult, PageListSnapshot, PageMoveResult, PageObjectNumber, PageRenderOptions, PageRotateResult, PageRotation, PageState, PageTextSnapshot, PdfActionTree, PdfQuad, PdfRect, PdfSaveMode, RedactionApplyResult, RedactionApplyScope, RevisionToken, SearchRequest, SearchSlice, WeakAnnotationState, WireAnnotationDraft, WireAnnotationPatch, WireAttachmentFile, WirePack, WireResource, WireResourceMap, WorkerRequest, WorkerResponse } from "@embedpdf/engine-core/runtime";
|
|
2
2
|
import { PdfFunctions, PdfRuntimeMemory, PdfRuntimeModule, Ptr } from "@embedpdf/engine-runtime";
|
|
3
3
|
//#region src/runtime/lifecycle/bootstrap.d.ts
|
|
4
4
|
/**
|
|
@@ -626,29 +626,33 @@ declare class RedactionApplier {
|
|
|
626
626
|
*/
|
|
627
627
|
private preflight;
|
|
628
628
|
private applyAllOnPage;
|
|
629
|
+
private pageHasRedactAnnotations;
|
|
629
630
|
private applyRefsOnPage;
|
|
630
631
|
}
|
|
631
632
|
//#endregion
|
|
632
633
|
//#region src/features/text/PageTextReader.d.ts
|
|
633
634
|
/**
|
|
634
635
|
* Per-page slow-path text reader. Acquires a `pagePtr` from the
|
|
635
|
-
* `PagePtrPool`, opens a PDFium text page (`FPDFText_LoadPage`),
|
|
636
|
-
*
|
|
637
|
-
* and releases everything in reverse order.
|
|
636
|
+
* `PagePtrPool`, opens a PDFium text page (`FPDFText_LoadPage`), extracts
|
|
637
|
+
* the page text, and releases everything in reverse order.
|
|
638
638
|
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
643
|
-
*
|
|
644
|
-
* to a JS string, faithfully preserving surrogate pairs.
|
|
639
|
+
* Index spaces (see engine-core `text/charmap.ts`): `charCount` is the
|
|
640
|
+
* CHARACTER space (`FPDFText_CountChars` — the space geometry runs tile);
|
|
641
|
+
* `text` is the TEXT projection. The two diverge when a character
|
|
642
|
+
* contributes zero text units (non-printing) or two (supplementary plane);
|
|
643
|
+
* `charMap` anchors encode exactly those deviations.
|
|
645
644
|
*
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
645
|
+
* Both come from the fork's batched extension calls, which share one
|
|
646
|
+
* encoding authority (`FX_UTF16Encode`) so text and map can never
|
|
647
|
+
* disagree:
|
|
648
|
+
*
|
|
649
|
+
* - `EPDFText_GetTextFull` — true UTF-16LE extraction; supplementary
|
|
650
|
+
* characters arrive as surrogate pairs instead of being silently
|
|
651
|
+
* dropped by `FPDFText_GetText`'s UCS-2 encoder. Called once with an
|
|
652
|
+
* upper-bound buffer (2 units per character + NUL), so no measure
|
|
653
|
+
* round-trip.
|
|
654
|
+
* - `EPDFText_GetCharToTextMap` — the anchors, measure-then-fill. Zero
|
|
655
|
+
* anchors is the common (identity) page and skips the fill call.
|
|
652
656
|
*/
|
|
653
657
|
declare class PageTextReader {
|
|
654
658
|
private readonly runtime;
|
|
@@ -658,21 +662,93 @@ declare class PageTextReader {
|
|
|
658
662
|
}
|
|
659
663
|
//#endregion
|
|
660
664
|
//#region src/features/geometry/PageGeometryReader.d.ts
|
|
665
|
+
/**
|
|
666
|
+
* One glyph as read from `EPDFText_GetCharGeometry`, plus the run-grouping
|
|
667
|
+
* context sampled alongside it. Pure data — no native handles — so the
|
|
668
|
+
* grouping stage below is a pure function the tests can drive directly.
|
|
669
|
+
*/
|
|
670
|
+
interface RawGeometryGlyphRecord {
|
|
671
|
+
/** Grouping key: the glyph's text object handle (opaque identity). */
|
|
672
|
+
objectKey: number | bigint;
|
|
673
|
+
/** Sampled at each text object's first glyph (run splits inherit it). */
|
|
674
|
+
fontSize?: number;
|
|
675
|
+
/**
|
|
676
|
+
* Wire flags (bit 1 = space, bit 2 = empty). Synthesized-but-visible
|
|
677
|
+
* glyphs (/ActualText pieces) stay 0, exactly like the legacy reader —
|
|
678
|
+
* they represent real, selectable text.
|
|
679
|
+
*/
|
|
680
|
+
flags: number;
|
|
681
|
+
/** Page-space AABB (zeroed when empty). */
|
|
682
|
+
looseBox: PdfRect;
|
|
683
|
+
tightBox?: PdfRect;
|
|
684
|
+
/** Oriented cells — real glyphs with a usable (non-singular) matrix only. */
|
|
685
|
+
looseQuad?: PdfQuad;
|
|
686
|
+
tightQuad?: PdfQuad;
|
|
687
|
+
/** Native uprightness of the char matrix (empty glyphs: true, inert). */
|
|
688
|
+
upright: boolean;
|
|
689
|
+
/** Baseline angle (radians CCW, PDF y-up); 0 when upright. */
|
|
690
|
+
rotation: number;
|
|
691
|
+
/** True when the ascent vector maps opposite the rotated +y (det < 0). */
|
|
692
|
+
ascentFlip: boolean;
|
|
693
|
+
}
|
|
661
694
|
/**
|
|
662
695
|
* Geometry-only text layout reader.
|
|
663
696
|
*
|
|
664
697
|
* Emits geometry in PDF user space (y-up edges) — the canonical engine
|
|
665
698
|
* geometry. The viewer converts to content/view space via the page geometry
|
|
666
699
|
* matrix; this reader applies NO Y-flip or device transform.
|
|
700
|
+
*
|
|
701
|
+
* One `EPDFText_GetCharGeometry` call per glyph supplies boxes, oriented
|
|
702
|
+
* cells, and flags together; `buildRunsFromRawGlyphs` then groups glyphs
|
|
703
|
+
* into the upright/rotated run union. Upright runs are byte-identical to the
|
|
704
|
+
* pre-orientation reader (quads the native layer offers are deliberately
|
|
705
|
+
* dropped — the dominant case never pays for orientation).
|
|
667
706
|
*/
|
|
668
707
|
declare class PageGeometryReader {
|
|
669
708
|
private readonly runtime;
|
|
670
709
|
private readonly session;
|
|
671
710
|
constructor(runtime: PdfRuntimeModule, session: DocumentSession);
|
|
672
711
|
read(pageObjectNumber: PageObjectNumber, signal: AbortSignal): PageGeometrySnapshot;
|
|
673
|
-
private
|
|
674
|
-
private readGlyphInfo;
|
|
712
|
+
private readGlyphRaw;
|
|
675
713
|
}
|
|
714
|
+
/**
|
|
715
|
+
* Group per-glyph records into the run union. Pure — exported for tests.
|
|
716
|
+
*
|
|
717
|
+
* Runs split on text-object change (the legacy rule) and on orientation
|
|
718
|
+
* change between classifiable glyphs (θ drift / mixed orientation). A run's
|
|
719
|
+
* variant is decided by its FIRST classifiable glyph:
|
|
720
|
+
* - empty glyphs never classify (they adopt the run's variant);
|
|
721
|
+
* - real glyphs WITHOUT an oriented cell (singular matrix, synthesized
|
|
722
|
+
* /ActualText pieces) classify as upright — box-only data degrades to
|
|
723
|
+
* exactly the legacy behavior;
|
|
724
|
+
* - real glyphs with a non-upright matrix classify as rotated.
|
|
725
|
+
* Runs that never see a classifiable glyph emit as upright (degenerate,
|
|
726
|
+
* legacy behavior).
|
|
727
|
+
*/
|
|
728
|
+
declare function buildRunsFromRawGlyphs(records: RawGeometryGlyphRecord[]): PageGeometryRun[];
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region src/runtime/memory/structs.d.ts
|
|
731
|
+
/** Generated from `EPDF_CHAR_GEOMETRY`; pinned by native static_asserts. */
|
|
732
|
+
declare const EPDF_CHAR_GEOMETRY_LAYOUT: {
|
|
733
|
+
readonly bytes: 124;
|
|
734
|
+
readonly offsets: {
|
|
735
|
+
readonly looseBox: 0;
|
|
736
|
+
readonly tightBox: 16;
|
|
737
|
+
readonly looseQuad: 32;
|
|
738
|
+
readonly tightQuad: 64;
|
|
739
|
+
readonly matrix: 96;
|
|
740
|
+
readonly flags: 120;
|
|
741
|
+
};
|
|
742
|
+
readonly flags: {
|
|
743
|
+
readonly hasTightBox: number;
|
|
744
|
+
readonly hasLooseQuad: number;
|
|
745
|
+
readonly hasTightQuad: number;
|
|
746
|
+
readonly upright: number;
|
|
747
|
+
readonly space: number;
|
|
748
|
+
readonly empty: number;
|
|
749
|
+
readonly synthesized: number;
|
|
750
|
+
};
|
|
751
|
+
};
|
|
676
752
|
//#endregion
|
|
677
753
|
//#region src/features/render/PageRenderReader.d.ts
|
|
678
754
|
declare class PageRenderReader {
|
|
@@ -1477,5 +1553,5 @@ declare class WorkerHost {
|
|
|
1477
1553
|
private saveLayerArtifact;
|
|
1478
1554
|
}
|
|
1479
1555
|
//#endregion
|
|
1480
|
-
export { ALL_STANDARD_SECURITY_PERMISSIONS, type AcquiredBaseDocument, ActionReadBudgetTracker, AnnotationAppearanceReader, AnnotationMutator, AnnotationReader, AttachmentMutator, AttachmentReader, BaseDocumentRegistry, CloseStack, DocumentActionsReader, PagesMutator as DocumentPagesMutator, PagesMutator, DocumentSaver, DocumentSession, EventHub, FontRegistrar, FormMutator, FormReader, FormsEffectsApplier, type ImpactInputs, type LayerSource, LocalRevisionAuthority, MetadataMutator, MetadataReader, type MutationKind, type OpenedPdfDocument, type OpenedPdfDocumentKind, PageGeometryReader, PagesReader as PageLayoutReader, PagesReader, PagePtrPool, PageRenderReader as PageRasterReader, PageRenderReader, type PageRecord, PageTextReader, PagesExtractor, PagesFlattener, PagesInserter, RawAnnotationReader, RedactionApplier, type RevisionAuthority, SearchReader, SecurityReader, SessionEventPublisher, type StartupFontSpec, WorkerHost, computeMutationImpact, destroyLibrary, disposeFormModel, ensureInitialized, formatPdfDate, generateUuid, hasAllStandardSecurityPermissions, normalizeU32, openFatMemoryDocument, openLayerDocument, pdfDateToIso, readActionModel, readAttachmentFileInfo, throwIfAborted, writeAttachmentFilePayload };
|
|
1556
|
+
export { ALL_STANDARD_SECURITY_PERMISSIONS, type AcquiredBaseDocument, ActionReadBudgetTracker, AnnotationAppearanceReader, AnnotationMutator, AnnotationReader, AttachmentMutator, AttachmentReader, BaseDocumentRegistry, CloseStack, DocumentActionsReader, PagesMutator as DocumentPagesMutator, PagesMutator, DocumentSaver, DocumentSession, EPDF_CHAR_GEOMETRY_LAYOUT, EventHub, FontRegistrar, FormMutator, FormReader, FormsEffectsApplier, type ImpactInputs, type LayerSource, LocalRevisionAuthority, MetadataMutator, MetadataReader, type MutationKind, type OpenedPdfDocument, type OpenedPdfDocumentKind, PageGeometryReader, PagesReader as PageLayoutReader, PagesReader, PagePtrPool, PageRenderReader as PageRasterReader, PageRenderReader, type PageRecord, PageTextReader, PagesExtractor, PagesFlattener, PagesInserter, RawAnnotationReader, type RawGeometryGlyphRecord, RedactionApplier, type RevisionAuthority, SearchReader, SecurityReader, SessionEventPublisher, type StartupFontSpec, WorkerHost, buildRunsFromRawGlyphs, computeMutationImpact, destroyLibrary, disposeFormModel, ensureInitialized, formatPdfDate, generateUuid, hasAllStandardSecurityPermissions, normalizeU32, openFatMemoryDocument, openLayerDocument, pdfDateToIso, readActionModel, readAttachmentFileInfo, throwIfAborted, writeAttachmentFilePayload };
|
|
1481
1557
|
//# sourceMappingURL=index.d.ts.map
|