oasis-editor 0.0.89 → 0.0.90
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/{OasisEditorApp-cKm4OFIF.js → OasisEditorApp-2b7y3aGj.js} +672 -476
- package/dist/assets/{importDocxWorker-DVDyiqYf.js → importDocxWorker-BN5o1geV.js} +1 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/primitives.d.ts +2 -0
- package/dist/core/model/types/styles.d.ts +21 -1
- package/dist/export/pdf/OasisPdfWriter.d.ts +6 -102
- package/dist/export/pdf/draw/drawFragment.d.ts +2 -0
- package/dist/export/pdf/writer/PdfContentStream.d.ts +20 -0
- package/dist/export/pdf/writer/PdfDocumentSerializer.d.ts +5 -0
- package/dist/export/pdf/writer/PdfFontTable.d.ts +38 -0
- package/dist/export/pdf/writer/PdfImageTable.d.ts +12 -0
- package/dist/export/pdf/writer/pdfPrimitives.d.ts +20 -0
- package/dist/export/pdf/writer/pdfTypes.d.ts +107 -0
- package/dist/{index-BICQTKCZ.js → index-DcElQi6c.js} +285 -94
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* statements that pointed there continue to work via the barrel
|
|
7
7
|
* re-export in `src/core/model.ts`.
|
|
8
8
|
*/
|
|
9
|
-
export type { EditorUnderlineStyle, EditorLigatures, EditorNumberSpacing, EditorNumberForm, EditorTextLanguage, EditorBorderStyle, EditorTabStop, EditorParagraphListStyle, EditorImageCrop, EditorImageFillMode, EditorImageFloatingPosition, EditorImageFloatingLayout, EditorImageRunData, EditorWrapPolygonPoint, EditorFieldData, EditorFieldChar, EditorFootnoteReferenceData, EditorEndnoteReferenceData, EditorRevision, EditorRevisionMetadata, EditorStructuralRevision, EditorPropertyRevision, EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart, EditorDocxWidthValue, EditorTableLayout, EditorTableRowHeightRule, } from './types/primitives.js';
|
|
9
|
+
export type { EditorUnderlineStyle, EditorLigatures, EditorNumberSpacing, EditorNumberForm, EditorTextLanguage, EditorBorderStyle, EditorEmphasisMark, EditorTabStop, EditorParagraphListStyle, EditorImageCrop, EditorImageFillMode, EditorImageFloatingPosition, EditorImageFloatingLayout, EditorImageRunData, EditorWrapPolygonPoint, EditorFieldData, EditorFieldChar, EditorFootnoteReferenceData, EditorEndnoteReferenceData, EditorRevision, EditorRevisionMetadata, EditorStructuralRevision, EditorPropertyRevision, EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart, EditorDocxWidthValue, EditorTableLayout, EditorTableRowHeightRule, } from './types/primitives.js';
|
|
10
10
|
export type { EditorTextStyle, EditorParagraphStyle, EditorTableStyle, EditorTableFloatingLayout, EditorTableConditionalFormat, EditorConditionalRowStyle, EditorTableConditionalType, EditorTableConditionalFlags, EditorNamedStyle, } from './types/styles.js';
|
|
11
11
|
export type { EditorRunBase, EditorTextRun, EditorTextBoxShape, EditorTextBoxBody, EditorTextBoxData, EditorDropCap, EditorParagraphNode, EditorTableCellStyle, EditorTableCellNode, EditorTableRowStyle, EditorTableRowNode, EditorTableNode, EditorBlockNode, } from './types/nodes.js';
|
|
12
12
|
export type { RunKind, RunOfKind, RunVisitor } from './runKind.js';
|
|
@@ -18,6 +18,8 @@ export interface EditorBorderStyle {
|
|
|
18
18
|
type: "solid" | "dashed" | "dotted" | "none";
|
|
19
19
|
color: string;
|
|
20
20
|
}
|
|
21
|
+
/** `w:em/@w:val`: the emphasis mark drawn over each glyph of a run. */
|
|
22
|
+
export type EditorEmphasisMark = "dot" | "comma" | "circle" | "underDot" | "none";
|
|
21
23
|
export interface EditorTabStop {
|
|
22
24
|
position: number;
|
|
23
25
|
type: "left" | "center" | "right" | "decimal" | "bar" | "clear";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorBorderStyle, EditorDocxWidthValue, EditorLigatures, EditorNumberForm, EditorNumberSpacing, EditorPropertyRevision, EditorTabStop, EditorTextLanguage, EditorUnderlineStyle } from './primitives.js';
|
|
1
|
+
import { EditorBorderStyle, EditorDocxWidthValue, EditorEmphasisMark, EditorLigatures, EditorNumberForm, EditorNumberSpacing, EditorPropertyRevision, EditorTabStop, EditorTextLanguage, EditorUnderlineStyle } from './primitives.js';
|
|
2
2
|
import { EditorTableCellStyle } from './nodes.js';
|
|
3
3
|
|
|
4
4
|
export interface EditorTextStyle {
|
|
@@ -18,6 +18,26 @@ export interface EditorTextStyle {
|
|
|
18
18
|
noProof?: boolean;
|
|
19
19
|
webHidden?: boolean;
|
|
20
20
|
specVanish?: boolean;
|
|
21
|
+
/** `w:rtl`: run flows right-to-left. */
|
|
22
|
+
rtl?: boolean;
|
|
23
|
+
/** `w:cs`: run is complex-script text. */
|
|
24
|
+
complexScript?: boolean;
|
|
25
|
+
/** `w:snapToGrid` (run): snap characters to the document grid. Defaults on. */
|
|
26
|
+
snapToGrid?: boolean;
|
|
27
|
+
/** `w:fitText`: compress/expand the run to this target width (in pt). */
|
|
28
|
+
fitText?: number | null;
|
|
29
|
+
/** `w:em`: emphasis mark drawn above (or below for `underDot`) each glyph. */
|
|
30
|
+
emphasisMark?: EditorEmphasisMark | null;
|
|
31
|
+
/** `w:bdr`: border box drawn around the run's text. */
|
|
32
|
+
textBorder?: EditorBorderStyle | null;
|
|
33
|
+
/** `w:outline`: hollow/outlined glyphs. */
|
|
34
|
+
outline?: boolean;
|
|
35
|
+
/** `w:shadow`: drop shadow behind glyphs. */
|
|
36
|
+
shadow?: boolean;
|
|
37
|
+
/** `w:emboss`: raised (embossed) glyphs. */
|
|
38
|
+
emboss?: boolean;
|
|
39
|
+
/** `w:imprint`: engraved glyphs. */
|
|
40
|
+
imprint?: boolean;
|
|
21
41
|
textEffect?: string | null;
|
|
22
42
|
characterScale?: number | null;
|
|
23
43
|
characterSpacing?: number | null;
|
|
@@ -1,102 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export interface OasisPdfPage {
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
commands: string[];
|
|
9
|
-
imageResourceNames: Set<string>;
|
|
10
|
-
}
|
|
11
|
-
export interface OasisPdfRectOptions {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
fill?: string;
|
|
17
|
-
stroke?: string;
|
|
18
|
-
lineWidth?: number;
|
|
19
|
-
}
|
|
20
|
-
export interface OasisPdfLineOptions {
|
|
21
|
-
x1: number;
|
|
22
|
-
y1: number;
|
|
23
|
-
x2: number;
|
|
24
|
-
y2: number;
|
|
25
|
-
stroke?: string;
|
|
26
|
-
lineWidth?: number;
|
|
27
|
-
dashArray?: number[];
|
|
28
|
-
}
|
|
29
|
-
export type OasisPdfPathSegment = {
|
|
30
|
-
type: "move";
|
|
31
|
-
x: number;
|
|
32
|
-
y: number;
|
|
33
|
-
} | {
|
|
34
|
-
type: "line";
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
|
-
} | {
|
|
38
|
-
type: "cubic";
|
|
39
|
-
x1: number;
|
|
40
|
-
y1: number;
|
|
41
|
-
x2: number;
|
|
42
|
-
y2: number;
|
|
43
|
-
x: number;
|
|
44
|
-
y: number;
|
|
45
|
-
} | {
|
|
46
|
-
type: "close";
|
|
47
|
-
};
|
|
48
|
-
export interface OasisPdfPathOptions {
|
|
49
|
-
segments: OasisPdfPathSegment[];
|
|
50
|
-
fill?: string;
|
|
51
|
-
stroke?: string;
|
|
52
|
-
lineWidth?: number;
|
|
53
|
-
}
|
|
54
|
-
export interface OasisPdfTextOptions {
|
|
55
|
-
x: number;
|
|
56
|
-
y: number;
|
|
57
|
-
text: string;
|
|
58
|
-
fontSize?: number;
|
|
59
|
-
color?: string;
|
|
60
|
-
bold?: boolean;
|
|
61
|
-
italic?: boolean;
|
|
62
|
-
fontResourceName?: string;
|
|
63
|
-
characterSpacing?: number;
|
|
64
|
-
horizontalScale?: number;
|
|
65
|
-
}
|
|
66
|
-
export interface OasisPdfImageResource {
|
|
67
|
-
resourceName: string;
|
|
68
|
-
width: number;
|
|
69
|
-
height: number;
|
|
70
|
-
data: Uint8Array;
|
|
71
|
-
filter: "DCTDecode";
|
|
72
|
-
}
|
|
73
|
-
export interface OasisPdfImageOptions {
|
|
74
|
-
resourceName: string;
|
|
75
|
-
x: number;
|
|
76
|
-
y: number;
|
|
77
|
-
width: number;
|
|
78
|
-
height: number;
|
|
79
|
-
rotation?: number;
|
|
80
|
-
}
|
|
81
|
-
export type OasisPdfFontResource = OasisPdfBase14FontResource | OasisPdfUnicodeFontResource;
|
|
82
|
-
export interface OasisPdfBase14FontResource {
|
|
83
|
-
kind: "base14";
|
|
84
|
-
resourceName: string;
|
|
85
|
-
baseFont: string;
|
|
86
|
-
}
|
|
87
|
-
export interface OasisPdfUnicodeFontResource {
|
|
88
|
-
kind: "unicode";
|
|
89
|
-
resourceName: string;
|
|
90
|
-
family: string;
|
|
91
|
-
fontData: Uint8Array;
|
|
92
|
-
postscriptName?: string;
|
|
93
|
-
}
|
|
1
|
+
import { OasisPdfFontResource, OasisPdfImageOptions, OasisPdfImageResource, OasisPdfLineOptions, OasisPdfPageSize, OasisPdfPathOptions, OasisPdfRectOptions, OasisPdfTextOptions } from './writer/pdfTypes.js';
|
|
2
|
+
|
|
3
|
+
export type { OasisPdfPageSize, OasisPdfPage, OasisPdfRectOptions, OasisPdfLineOptions, OasisPdfPathSegment, OasisPdfPathOptions, OasisPdfTextOptions, OasisPdfImageResource, OasisPdfImageOptions, OasisPdfFontResource, OasisPdfBase14FontResource, OasisPdfUnicodeFontResource, } from './writer/pdfTypes.js';
|
|
94
4
|
export declare class OasisPdfWriter {
|
|
95
5
|
private readonly pages;
|
|
96
|
-
private readonly
|
|
97
|
-
private readonly
|
|
98
|
-
private readonly
|
|
99
|
-
private readonly imageResources;
|
|
6
|
+
private readonly streams;
|
|
7
|
+
private readonly fonts;
|
|
8
|
+
private readonly images;
|
|
100
9
|
constructor(fontResources?: OasisPdfFontResource[]);
|
|
101
10
|
registerFontResource(resource: OasisPdfFontResource): void;
|
|
102
11
|
addPage(size: OasisPdfPageSize): number;
|
|
@@ -113,12 +22,7 @@ export declare class OasisPdfWriter {
|
|
|
113
22
|
resourceName?: string;
|
|
114
23
|
}): string;
|
|
115
24
|
drawImage(pageIndex: number, options: OasisPdfImageOptions): void;
|
|
116
|
-
private layoutUnicodeText;
|
|
117
|
-
private encodeUnicodeGlyphRun;
|
|
118
|
-
private drawUnicodeText;
|
|
119
25
|
toArrayBuffer(): ArrayBuffer;
|
|
120
26
|
toBlob(): Blob;
|
|
121
27
|
private toUint8Array;
|
|
122
|
-
private addImageObject;
|
|
123
|
-
private addUnicodeFontObjects;
|
|
124
28
|
}
|
|
@@ -17,5 +17,7 @@ export declare function drawFloatingImagesForParagraph(options: {
|
|
|
17
17
|
}): Promise<void>;
|
|
18
18
|
export declare function drawFragmentHighlight(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>): void;
|
|
19
19
|
export declare function drawFragmentShading(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>): void;
|
|
20
|
+
export declare function drawFragmentBorder(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>): void;
|
|
21
|
+
export declare function drawFragmentEmphasis(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>): void;
|
|
20
22
|
export declare function drawFragmentDecoration(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>, kind: "underline" | "strike" | "doubleStrike"): void;
|
|
21
23
|
export declare function drawFragmentText(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, line: EditorLayoutLine, fragment: EditorLayoutFragment, document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, drawers: BlockDrawers): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OasisPdfImageOptions, OasisPdfLineOptions, OasisPdfPage, OasisPdfPathOptions, OasisPdfRectOptions, OasisPdfTextOptions } from './pdfTypes.js';
|
|
2
|
+
import { PdfFontTable } from './PdfFontTable.js';
|
|
3
|
+
import { PdfImageTable } from './PdfImageTable.js';
|
|
4
|
+
|
|
5
|
+
export declare class PdfContentStream {
|
|
6
|
+
readonly page: OasisPdfPage;
|
|
7
|
+
private readonly fonts;
|
|
8
|
+
private readonly images;
|
|
9
|
+
constructor(page: OasisPdfPage, fonts: PdfFontTable, images: PdfImageTable);
|
|
10
|
+
drawRect(options: OasisPdfRectOptions): void;
|
|
11
|
+
drawLine(options: OasisPdfLineOptions): void;
|
|
12
|
+
drawPath(options: OasisPdfPathOptions): void;
|
|
13
|
+
saveGraphicsState(): void;
|
|
14
|
+
restoreGraphicsState(): void;
|
|
15
|
+
rotateAbout(centerX: number, centerY: number, degrees: number): void;
|
|
16
|
+
clipRect(x: number, y: number, width: number, height: number): void;
|
|
17
|
+
drawText(options: OasisPdfTextOptions): void;
|
|
18
|
+
private emitTextBlock;
|
|
19
|
+
drawImage(options: OasisPdfImageOptions): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OasisPdfPage } from './pdfTypes.js';
|
|
2
|
+
import { PdfFontTable } from './PdfFontTable.js';
|
|
3
|
+
import { PdfImageTable } from './PdfImageTable.js';
|
|
4
|
+
|
|
5
|
+
export declare function serializePdfDocument(pages: OasisPdfPage[], fonts: PdfFontTable, images: PdfImageTable): Uint8Array;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { GlyphInfo, GlyphRun, PdfEmbeddableFont } from '../../../text/fonts/core/types.js';
|
|
2
|
+
import { AddPdfObject, OasisPdfFontResource, OasisPdfTextOptions, OasisPdfUnicodeFontResource } from './pdfTypes.js';
|
|
3
|
+
|
|
4
|
+
interface OasisPdfUnicodeFontState {
|
|
5
|
+
resource: OasisPdfUnicodeFontResource;
|
|
6
|
+
font: PdfEmbeddableFont;
|
|
7
|
+
usedGlyphs: Map<number, GlyphInfo>;
|
|
8
|
+
scale: number;
|
|
9
|
+
layoutCache: Map<string, GlyphRun>;
|
|
10
|
+
}
|
|
11
|
+
export declare class PdfFontTable {
|
|
12
|
+
private readonly fontResources;
|
|
13
|
+
private readonly unicodeFontStates;
|
|
14
|
+
private readonly usedFontResourceNames;
|
|
15
|
+
constructor(fontResources: OasisPdfFontResource[]);
|
|
16
|
+
registerFontResource(resource: OasisPdfFontResource): void;
|
|
17
|
+
/** Resolves the font resource a run uses and marks it as referenced. */
|
|
18
|
+
resolveAndMarkFontName(options: Pick<OasisPdfTextOptions, "bold" | "italic" | "fontResourceName">): string;
|
|
19
|
+
getUnicodeState(resourceName: string): OasisPdfUnicodeFontState | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Builds the glyph-show operator (`<...> Tj` or `[...] TJ`) for an embedded
|
|
22
|
+
* Unicode run, recording the glyphs used for subsetting. Returns `null` when
|
|
23
|
+
* the run produced no glyphs so the caller can skip emission entirely.
|
|
24
|
+
*/
|
|
25
|
+
buildUnicodeShowCommand(state: OasisPdfUnicodeFontState, text: string): string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Emits the font objects (base-14 dictionaries and embedded Unicode font
|
|
28
|
+
* programs) for every referenced resource and returns the `/Font` resource
|
|
29
|
+
* dictionary XML for page objects.
|
|
30
|
+
*/
|
|
31
|
+
buildFontObjects(addObject: AddPdfObject): {
|
|
32
|
+
resourceXml: string;
|
|
33
|
+
};
|
|
34
|
+
private layoutUnicodeText;
|
|
35
|
+
private encodeUnicodeGlyphRun;
|
|
36
|
+
private addUnicodeFontObjects;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AddPdfObject, OasisPdfImageResource } from './pdfTypes.js';
|
|
2
|
+
|
|
3
|
+
export declare class PdfImageTable {
|
|
4
|
+
private readonly imageResources;
|
|
5
|
+
registerImageResource(resource: Omit<OasisPdfImageResource, "resourceName"> & {
|
|
6
|
+
resourceName?: string;
|
|
7
|
+
}): string;
|
|
8
|
+
has(resourceName: string): boolean;
|
|
9
|
+
/** Emits each registered image object, keyed by resource name for page maps. */
|
|
10
|
+
buildImageObjects(addObject: AddPdfObject): Map<string, number>;
|
|
11
|
+
private addImageObject;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OasisPdfFontResource, OasisPdfTextOptions } from './pdfTypes.js';
|
|
2
|
+
|
|
3
|
+
export declare const PDF_HEADER = "%PDF-1.4\n% Oasis PDF\n";
|
|
4
|
+
export declare const DEFAULT_PDF_FONT_RESOURCES: OasisPdfFontResource[];
|
|
5
|
+
export declare function formatNumber(value: number): string;
|
|
6
|
+
export declare function byteLength(value: string): number;
|
|
7
|
+
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
8
|
+
export declare function toHex16(value: number): string;
|
|
9
|
+
export declare function colorCommand(color: string | undefined, operator: "rg" | "RG", fallback: [number, number, number]): string;
|
|
10
|
+
export declare function resolveFontName(options: Pick<OasisPdfTextOptions, "bold" | "italic" | "fontResourceName">): string;
|
|
11
|
+
export declare function fontResourceObjectBody(resource: OasisPdfFontResource): string;
|
|
12
|
+
export declare function sanitizePdfName(value: string | undefined, fallback: string): string;
|
|
13
|
+
export declare function encodePdfHexString(value: string): string;
|
|
14
|
+
export declare function encodePdfUtf16Hex(codePoints: number[]): string;
|
|
15
|
+
export declare function buildToUnicodeCMap(unicode: number[][]): string;
|
|
16
|
+
export declare function streamObjectBody(stream: string, extraDictionary?: string): string;
|
|
17
|
+
export declare function asciiHexStreamObjectBody(bytes: Uint8Array, extraDictionary?: string): string;
|
|
18
|
+
export declare function asciiHexImageStreamObjectBody(bytes: Uint8Array, dictionaryEntries: string[]): string;
|
|
19
|
+
export declare function encodeGlyphHex(glyphId: number): string;
|
|
20
|
+
export declare function textMarkerComment(value: string): string;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public value/option types for the PDF writer. These are the interfaces that
|
|
3
|
+
* callers across `src/export/pdf` (and the font registry) depend on; the
|
|
4
|
+
* `OasisPdfWriter` facade re-exports them so existing import paths keep working.
|
|
5
|
+
*/
|
|
6
|
+
export interface OasisPdfPageSize {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
export interface OasisPdfPage {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
commands: string[];
|
|
14
|
+
imageResourceNames: Set<string>;
|
|
15
|
+
}
|
|
16
|
+
export interface OasisPdfRectOptions {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
fill?: string;
|
|
22
|
+
stroke?: string;
|
|
23
|
+
lineWidth?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface OasisPdfLineOptions {
|
|
26
|
+
x1: number;
|
|
27
|
+
y1: number;
|
|
28
|
+
x2: number;
|
|
29
|
+
y2: number;
|
|
30
|
+
stroke?: string;
|
|
31
|
+
lineWidth?: number;
|
|
32
|
+
dashArray?: number[];
|
|
33
|
+
}
|
|
34
|
+
export type OasisPdfPathSegment = {
|
|
35
|
+
type: "move";
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
} | {
|
|
39
|
+
type: "line";
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
} | {
|
|
43
|
+
type: "cubic";
|
|
44
|
+
x1: number;
|
|
45
|
+
y1: number;
|
|
46
|
+
x2: number;
|
|
47
|
+
y2: number;
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
} | {
|
|
51
|
+
type: "close";
|
|
52
|
+
};
|
|
53
|
+
export interface OasisPdfPathOptions {
|
|
54
|
+
segments: OasisPdfPathSegment[];
|
|
55
|
+
fill?: string;
|
|
56
|
+
stroke?: string;
|
|
57
|
+
lineWidth?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface OasisPdfTextOptions {
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
text: string;
|
|
63
|
+
fontSize?: number;
|
|
64
|
+
color?: string;
|
|
65
|
+
bold?: boolean;
|
|
66
|
+
italic?: boolean;
|
|
67
|
+
fontResourceName?: string;
|
|
68
|
+
characterSpacing?: number;
|
|
69
|
+
horizontalScale?: number;
|
|
70
|
+
/** PDF text render mode (`Tr`): 0 fill (default), 1 stroke, 2 fill+stroke. */
|
|
71
|
+
renderMode?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface OasisPdfImageResource {
|
|
74
|
+
resourceName: string;
|
|
75
|
+
width: number;
|
|
76
|
+
height: number;
|
|
77
|
+
data: Uint8Array;
|
|
78
|
+
filter: "DCTDecode";
|
|
79
|
+
}
|
|
80
|
+
export interface OasisPdfImageOptions {
|
|
81
|
+
resourceName: string;
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
rotation?: number;
|
|
87
|
+
}
|
|
88
|
+
export type OasisPdfFontResource = OasisPdfBase14FontResource | OasisPdfUnicodeFontResource;
|
|
89
|
+
export interface OasisPdfBase14FontResource {
|
|
90
|
+
kind: "base14";
|
|
91
|
+
resourceName: string;
|
|
92
|
+
baseFont: string;
|
|
93
|
+
}
|
|
94
|
+
export interface OasisPdfUnicodeFontResource {
|
|
95
|
+
kind: "unicode";
|
|
96
|
+
resourceName: string;
|
|
97
|
+
family: string;
|
|
98
|
+
fontData: Uint8Array;
|
|
99
|
+
postscriptName?: string;
|
|
100
|
+
}
|
|
101
|
+
/** A serialized indirect PDF object: its 1-based id and dictionary/stream body. */
|
|
102
|
+
export interface PdfObject {
|
|
103
|
+
id: number;
|
|
104
|
+
body: string;
|
|
105
|
+
}
|
|
106
|
+
/** Signature of the object-appending closure used during serialization. */
|
|
107
|
+
export type AddPdfObject = (body: string) => number;
|