pptx-glimpse 2.0.0 → 3.1.0
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/browser.cjs +16650 -0
- package/dist/browser.d.cts +200 -0
- package/dist/browser.d.ts +200 -0
- package/dist/browser.js +3643 -0
- package/dist/chunk-NMAO44T7.js +11349 -0
- package/dist/chunk-PGCREQQU.js +1575 -0
- package/dist/chunk-QPT6BMN5.js +25 -0
- package/dist/chunk-WAMKNW47.js +125 -0
- package/dist/chunk-XGCLQP2P.js +83 -0
- package/dist/chunk-ZZKN4U5J.js +141 -0
- package/dist/cli.cjs +11214 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +195 -0
- package/dist/font-collector-BYuaCG-o.d.cts +547 -0
- package/dist/font-collector-BYuaCG-o.d.ts +547 -0
- package/dist/index.cjs +9221 -8751
- package/dist/index.d.cts +5 -538
- package/dist/index.d.ts +5 -538
- package/dist/index.js +25 -10692
- package/dist/node-E6UXPQSQ.js +9 -0
- package/dist/node-font-loader-OE3OLNDI.js +45 -0
- package/dist/png-IONMVVDQ.js +53 -0
- package/package.json +14 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,541 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* PptxSourceModel source node is a writer / editor / round-trip
|
|
5
|
-
* In order to do this, we can use ``which package part and which node it came from'' as a stable handle.
|
|
6
|
-
* A handle is not a direct mutable pointer, but a stable reference
|
|
7
|
-
* (see part path / relationship id / node id / order within siblings / raw sidecar)
|
|
8
|
-
* composes it.
|
|
9
|
-
*/
|
|
10
|
-
declare const PartPathBrand: unique symbol;
|
|
11
|
-
declare const RelationshipIdBrand: unique symbol;
|
|
12
|
-
declare const SourceNodeIdBrand: unique symbol;
|
|
13
|
-
declare const RawSidecarIdBrand: unique symbol;
|
|
14
|
-
/** Part path inside the OOXML package (Example: `ppt/slides/slide1.xml`). */
|
|
15
|
-
type PartPath = string & {
|
|
16
|
-
readonly [PartPathBrand]: typeof PartPathBrand;
|
|
17
|
-
};
|
|
18
|
-
/** Relationship id (Example: `rId1`).`_rels/*.rels` source. */
|
|
19
|
-
type RelationshipId = string & {
|
|
20
|
-
readonly [RelationshipIdBrand]: typeof RelationshipIdBrand;
|
|
21
|
-
};
|
|
22
|
-
/** An id that uniquely points to an element within the source part (spid / generation id, etc.). */
|
|
23
|
-
type SourceNodeId = string & {
|
|
24
|
-
readonly [SourceNodeIdBrand]: typeof SourceNodeIdBrand;
|
|
25
|
-
};
|
|
26
|
-
/** Id pointing to a raw sidecar. */
|
|
27
|
-
type RawSidecarId = string & {
|
|
28
|
-
readonly [RawSidecarIdBrand]: typeof RawSidecarIdBrand;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Stable handle describing a source node's provenance. The writer uses the handle to decide whether a generated
|
|
32
|
-
* node can be spliced into an existing part or whether a broader scope must be regenerated.
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
interface SourceHandle {
|
|
36
|
-
/** Package part that owns this node. */
|
|
37
|
-
readonly partPath: PartPath;
|
|
38
|
-
/** Node id inside the part (when available). */
|
|
39
|
-
readonly nodeId?: SourceNodeId;
|
|
40
|
-
/** The relationship id referencing this node (e.g. `r:embed` in blip). */
|
|
41
|
-
readonly relationshipId?: RelationshipId;
|
|
42
|
-
/** The child's order slot within the parent element. Used to restore order with raw sidecar. */
|
|
43
|
-
readonly orderingSlot?: number;
|
|
44
|
-
/** Raw sidecar ids associated with this node. */
|
|
45
|
-
readonly rawSidecarIds?: readonly RawSidecarId[];
|
|
46
|
-
}
|
|
1
|
+
export { C as ConversionDiagnostic, a as ConvertOptions, D as DEFAULT_FONT_MAPPING, F as FontBuffer, b as FontMapping, L as LogLevel, O as OpentypeSetup, P as PngConversionReport, S as SlideImage, c as SlideSupportCoverage, d as SlideSvg, e as SupportCoverage, f as SupportCoverageCounts, g as SvgConversionReport, U as UsedFonts, W as WarningEntry, h as WarningSummary, i as clearFontCache, j as collectUsedFonts, k as convertPptxToPng, l as convertPptxToSvg, n as createFontMapping, o as createOpentypeSetupFromBuffers, p as createOpentypeTextMeasurerFromBuffers, q as getMappedFont, r as getWarningEntries, s as getWarningSummary, t as renderPptxSourceModelToSvg } from './font-collector-BYuaCG-o.cjs';
|
|
2
|
+
export { PptxSourceModel } from '@pptx-glimpse/document';
|
|
47
3
|
|
|
48
|
-
|
|
49
|
-
* Font resolver context for text-to-path conversion.
|
|
50
|
-
* Provides access to a Font object with the opentype.js getPath() method.
|
|
51
|
-
*/
|
|
52
|
-
interface OpentypePath {
|
|
53
|
-
toPathData(decimalPlaces?: number): string;
|
|
54
|
-
}
|
|
55
|
-
interface OpentypeFullFont {
|
|
56
|
-
unitsPerEm: number;
|
|
57
|
-
ascender: number;
|
|
58
|
-
descender: number;
|
|
59
|
-
getPath(text: string, x: number, y: number, fontSize: number): OpentypePath;
|
|
60
|
-
getAdvanceWidth(text: string, fontSize: number): number;
|
|
61
|
-
}
|
|
62
|
-
interface TextPathFontResolver {
|
|
63
|
-
resolveFont(fontFamily: string | null | undefined, fontFamilyEa: string | null | undefined, jpanFallback?: string | null): OpentypeFullFont | null;
|
|
64
|
-
}
|
|
4
|
+
type ResvgWasmInput = ArrayBuffer | Uint8Array | Response;
|
|
65
5
|
|
|
66
|
-
|
|
67
|
-
* Mapping from PPTX font family names to replacement font family names.
|
|
68
|
-
*
|
|
69
|
-
* Keys are font names found in PPTX files. Values are font names that should be
|
|
70
|
-
* present in the rendering environment, commonly open-source alternatives to
|
|
71
|
-
* proprietary Microsoft Office fonts.
|
|
72
|
-
*/
|
|
73
|
-
type FontMapping = Record<string, string>;
|
|
74
|
-
/**
|
|
75
|
-
* Default replacement mapping for common Microsoft Office fonts.
|
|
76
|
-
*
|
|
77
|
-
* The table maps fonts such as Calibri, Arial, Meiryo, and MS Gothic to
|
|
78
|
-
* open-source alternatives used during text measurement, SVG path generation,
|
|
79
|
-
* and font lookup.
|
|
80
|
-
*/
|
|
81
|
-
declare const DEFAULT_FONT_MAPPING: Readonly<FontMapping>;
|
|
82
|
-
/**
|
|
83
|
-
* Create a font mapping table by merging defaults with user overrides.
|
|
84
|
-
*
|
|
85
|
-
* @param userMapping Custom PPTX font name to replacement font name entries.
|
|
86
|
-
* User-specified entries take precedence over `DEFAULT_FONT_MAPPING`.
|
|
87
|
-
* @returns A new mutable mapping object.
|
|
88
|
-
*/
|
|
89
|
-
declare function createFontMapping(userMapping?: FontMapping): FontMapping;
|
|
90
|
-
/**
|
|
91
|
-
* Look up the replacement font for a PPTX font family.
|
|
92
|
-
*
|
|
93
|
-
* Matching is case-insensitive and normalizes full-width alphanumeric
|
|
94
|
-
* characters used by some Japanese Office font names.
|
|
95
|
-
*
|
|
96
|
-
* @param fontFamily PPTX font family name to resolve.
|
|
97
|
-
* @param mapping Mapping table, usually from `createFontMapping`.
|
|
98
|
-
* @returns The replacement font name, or `null` when no mapping exists.
|
|
99
|
-
*/
|
|
100
|
-
declare function getMappedFont(fontFamily: string | null | undefined, mapping: FontMapping): string | null;
|
|
6
|
+
declare function initResvgWasm(wasm?: ResvgWasmInput): Promise<void>;
|
|
101
7
|
|
|
102
|
-
|
|
103
|
-
* Interface for measuring text width and line height.
|
|
104
|
-
* By default, measurement uses static font metrics.
|
|
105
|
-
* Users can pass their own implementation to ConvertOptions.textMeasurer
|
|
106
|
-
* Can be replaced with any measurement backend such as Canvas API or opentype.js.
|
|
107
|
-
*/
|
|
108
|
-
interface TextMeasurer {
|
|
109
|
-
/**
|
|
110
|
-
* Returns the estimated width of the text in pixels.
|
|
111
|
-
* @param text - text to measure
|
|
112
|
-
* @param fontSizePt - font size (points)
|
|
113
|
-
* @param bold - whether the text is bold
|
|
114
|
-
* @param fontFamily - font family name for Latin text
|
|
115
|
-
* @param fontFamilyEa - font family name for East Asian text
|
|
116
|
-
*/
|
|
117
|
-
measureTextWidth(text: string, fontSizePt: number, bold: boolean, fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
118
|
-
/**
|
|
119
|
-
* Returns the font's natural line height ratio (line height / font size).
|
|
120
|
-
* Returns 1.2 as a fallback value if the metric is unknown.
|
|
121
|
-
* @param fontFamily - font family name for Latin text
|
|
122
|
-
* @param fontFamilyEa - font family name for East Asian text
|
|
123
|
-
*/
|
|
124
|
-
getLineHeightRatio(fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
125
|
-
/**
|
|
126
|
-
* Font ascender ratio (ascender / unitsPerEm) .
|
|
127
|
-
* Used for baseline offset calculation in the first row.
|
|
128
|
-
* Returns 1.0 as a fallback value if the metric is unknown.
|
|
129
|
-
* @param fontFamily - font family name for Latin text
|
|
130
|
-
* @param fontFamilyEa - font family name for East Asian text
|
|
131
|
-
*/
|
|
132
|
-
getAscenderRatio(fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
interface OpentypeGlyph {
|
|
136
|
-
advanceWidth?: number;
|
|
137
|
-
}
|
|
138
|
-
interface OpentypeFont {
|
|
139
|
-
unitsPerEm: number;
|
|
140
|
-
ascender: number;
|
|
141
|
-
descender: number;
|
|
142
|
-
stringToGlyphs(text: string): OpentypeGlyph[];
|
|
143
|
-
}
|
|
144
|
-
declare class OpentypeTextMeasurer implements TextMeasurer {
|
|
145
|
-
private fonts;
|
|
146
|
-
private defaultFont;
|
|
147
|
-
private warnedFonts;
|
|
148
|
-
/**
|
|
149
|
-
* @param fonts - font name -> opentype.js Map of Font objects
|
|
150
|
-
* @param defaultFont - fallback font (optional)
|
|
151
|
-
*/
|
|
152
|
-
constructor(fonts: Map<string, OpentypeFont>, defaultFont?: OpentypeFont);
|
|
153
|
-
measureTextWidth(text: string, fontSizePt: number, bold: boolean, fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
154
|
-
getLineHeightRatio(fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
155
|
-
getAscenderRatio(fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
156
|
-
private resolveBoldFont;
|
|
157
|
-
private resolveFont;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Font file data supplied directly by the caller.
|
|
162
|
-
*
|
|
163
|
-
* Use this when system font scanning is unavailable or undesirable, such as in
|
|
164
|
-
* serverless environments. `name` is used to register TTF/OTF buffers under a
|
|
165
|
-
* specific family name; TTC buffers also read family names from their names
|
|
166
|
-
* table.
|
|
167
|
-
*/
|
|
168
|
-
interface FontBuffer {
|
|
169
|
-
/**
|
|
170
|
-
* Optional font family name to register for this buffer.
|
|
171
|
-
*/
|
|
172
|
-
name?: string;
|
|
173
|
-
/**
|
|
174
|
-
* Raw TTF, OTF, or TTC font file bytes.
|
|
175
|
-
*/
|
|
176
|
-
data: ArrayBuffer | Uint8Array;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Create a text measurer from caller-provided font buffers.
|
|
180
|
-
*
|
|
181
|
-
* This low-level helper is useful when rendering in an environment where fonts
|
|
182
|
-
* are bundled as bytes instead of discovered from the OS. It dynamically imports
|
|
183
|
-
* `opentype.js` and returns `null` if no fonts can be parsed or the optional
|
|
184
|
-
* dependency is unavailable.
|
|
185
|
-
*
|
|
186
|
-
* @param fontBuffers Font file bytes to parse.
|
|
187
|
-
* @param fontMapping Optional PPTX font name to replacement font mapping.
|
|
188
|
-
* @returns A text measurer, or `null` when setup is not possible.
|
|
189
|
-
*/
|
|
190
|
-
declare function createOpentypeTextMeasurerFromBuffers(fontBuffers: FontBuffer[], fontMapping?: FontMapping): Promise<OpentypeTextMeasurer | null>;
|
|
191
|
-
/**
|
|
192
|
-
* Font services created from OpenType font data.
|
|
193
|
-
*/
|
|
194
|
-
interface OpentypeSetup {
|
|
195
|
-
/**
|
|
196
|
-
* Measures text width for layout and wrapping.
|
|
197
|
-
*/
|
|
198
|
-
measurer: OpentypeTextMeasurer;
|
|
199
|
-
/**
|
|
200
|
-
* Resolves fonts for converting text to SVG path outlines.
|
|
201
|
-
*/
|
|
202
|
-
fontResolver: TextPathFontResolver;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Create font measurement and SVG path resolution services from font buffers.
|
|
206
|
-
*
|
|
207
|
-
* Use this for advanced integrations that need to provide fonts explicitly
|
|
208
|
-
* instead of relying on system font directories. Returned services can be wired
|
|
209
|
-
* into renderer internals; the public conversion APIs usually only need
|
|
210
|
-
* `fontDirs`, `skipSystemFonts`, and `fontMapping`.
|
|
211
|
-
*
|
|
212
|
-
* @param fontBuffers TTF, OTF, or TTC font file bytes.
|
|
213
|
-
* @param fontMapping Optional PPTX font name to replacement font mapping.
|
|
214
|
-
* @returns Font services, or `null` when no usable font setup can be created.
|
|
215
|
-
*/
|
|
216
|
-
declare function createOpentypeSetupFromBuffers(fontBuffers: FontBuffer[], fontMapping?: FontMapping): Promise<OpentypeSetup | null>;
|
|
217
|
-
/**
|
|
218
|
-
* Clear the module-level cache of parsed system fonts.
|
|
219
|
-
*
|
|
220
|
-
* Conversion APIs cache parsed font objects for repeated calls with the same
|
|
221
|
-
* font options. Call this after installing, removing, or replacing fonts in a
|
|
222
|
-
* long-running process when subsequent conversions must reload font files.
|
|
223
|
-
*/
|
|
224
|
-
declare function clearFontCache(): void;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Initialize the resvg-wasm module used for PNG conversion.
|
|
228
|
-
*
|
|
229
|
-
* Calling this is optional because `convertPptxToPng` initializes resvg-wasm on
|
|
230
|
-
* first use. Applications may call it during startup to pay the WASM loading
|
|
231
|
-
* cost before handling the first conversion request.
|
|
232
|
-
*/
|
|
233
|
-
declare function initResvgWasm(): Promise<void>;
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Controls how unsupported-feature warnings are collected and printed.
|
|
237
|
-
*
|
|
238
|
-
* `"off"` disables collection, `"warn"` collects entries and prints summaries,
|
|
239
|
-
* and `"debug"` also prints each warning as it is recorded.
|
|
240
|
-
*/
|
|
241
|
-
type LogLevel = "off" | "warn" | "debug";
|
|
242
|
-
/**
|
|
243
|
-
* One unsupported or approximated feature encountered during conversion.
|
|
244
|
-
*/
|
|
245
|
-
interface WarningEntry {
|
|
246
|
-
/**
|
|
247
|
-
* Stable feature key, for example `"sp.style"` or `"bodyPr@vert"`.
|
|
248
|
-
*/
|
|
249
|
-
feature: string;
|
|
250
|
-
/**
|
|
251
|
-
* Human-readable warning message.
|
|
252
|
-
*/
|
|
253
|
-
message: string;
|
|
254
|
-
/**
|
|
255
|
-
* Optional location context, for example `"Slide 1"`.
|
|
256
|
-
*/
|
|
257
|
-
context?: string;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Aggregated warnings from the most recent conversion cycle.
|
|
261
|
-
*/
|
|
262
|
-
interface WarningSummary {
|
|
263
|
-
/**
|
|
264
|
-
* Total number of warning entries.
|
|
265
|
-
*/
|
|
266
|
-
totalCount: number;
|
|
267
|
-
/**
|
|
268
|
-
* Warning counts grouped by feature key.
|
|
269
|
-
*/
|
|
270
|
-
features: {
|
|
271
|
-
feature: string;
|
|
272
|
-
message: string;
|
|
273
|
-
count: number;
|
|
274
|
-
}[];
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Return a grouped summary of currently collected warnings.
|
|
278
|
-
*
|
|
279
|
-
* This reads the active warning logger state. The public conversion APIs flush
|
|
280
|
-
* warnings at the end of a conversion so summaries can be printed; after that
|
|
281
|
-
* flush, this returns an empty summary until new warnings are recorded. It is
|
|
282
|
-
* mainly useful for lower-level renderer workflows, tests, and integrations
|
|
283
|
-
* that manage the warning cycle directly.
|
|
284
|
-
*/
|
|
285
|
-
declare function getWarningSummary(): WarningSummary;
|
|
286
|
-
/**
|
|
287
|
-
* Return individual warning entries collected in the current warning cycle.
|
|
288
|
-
*
|
|
289
|
-
* Entries include optional slide or element context when available. The public
|
|
290
|
-
* conversion APIs flush entries at the end of a conversion, so this is mainly
|
|
291
|
-
* useful for lower-level renderer workflows, tests, and integrations that
|
|
292
|
-
* manage the warning cycle directly.
|
|
293
|
-
*/
|
|
294
|
-
declare function getWarningEntries(): readonly WarningEntry[];
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Options shared by PPTX-to-SVG and PPTX-to-PNG conversion.
|
|
298
|
-
*/
|
|
299
|
-
interface ConvertOptions {
|
|
300
|
-
/**
|
|
301
|
-
* Target slide numbers to convert, using PowerPoint-style 1-based numbering.
|
|
302
|
-
*
|
|
303
|
-
* When omitted, every slide in the presentation is converted. Missing or
|
|
304
|
-
* out-of-range slide numbers produce no output for those entries.
|
|
305
|
-
*/
|
|
306
|
-
slides?: number[];
|
|
307
|
-
/**
|
|
308
|
-
* Output width in pixels.
|
|
309
|
-
*
|
|
310
|
-
* PNG output rasterizes to this width while preserving the slide aspect
|
|
311
|
-
* ratio. Defaults to 960. SVG output keeps the slide's native pixel size from
|
|
312
|
-
* the PPTX slide dimensions and does not use this option.
|
|
313
|
-
*/
|
|
314
|
-
width?: number;
|
|
315
|
-
/**
|
|
316
|
-
* Output height in pixels.
|
|
317
|
-
*
|
|
318
|
-
* PNG rasterization currently always uses `width`, either the provided value
|
|
319
|
-
* or the default width, so this option is ignored by the public conversion
|
|
320
|
-
* APIs. SVG output keeps the slide's native pixel size and does not use this
|
|
321
|
-
* option.
|
|
322
|
-
*/
|
|
323
|
-
height?: number;
|
|
324
|
-
/**
|
|
325
|
-
* Warning log level for unsupported or approximated PPTX features.
|
|
326
|
-
*
|
|
327
|
-
* Defaults to `"off"`. Diagnostics are always collected in the conversion
|
|
328
|
-
* report; this option only controls console output. Use `"warn"` to print
|
|
329
|
-
* summaries, or `"debug"` to print individual warning entries as they are
|
|
330
|
-
* recorded.
|
|
331
|
-
*/
|
|
332
|
-
logLevel?: LogLevel;
|
|
333
|
-
/**
|
|
334
|
-
* Additional directories that are scanned for font files.
|
|
335
|
-
*
|
|
336
|
-
* These directories are searched in addition to system font directories unless
|
|
337
|
-
* `skipSystemFonts` is true.
|
|
338
|
-
*/
|
|
339
|
-
fontDirs?: string[];
|
|
340
|
-
/**
|
|
341
|
-
* Custom PPTX font name to replacement font name mapping.
|
|
342
|
-
*
|
|
343
|
-
* Entries are merged with `DEFAULT_FONT_MAPPING`; user-provided entries take
|
|
344
|
-
* precedence. This is useful when a PPTX references proprietary or corporate
|
|
345
|
-
* fonts that should render with installed alternatives.
|
|
346
|
-
*/
|
|
347
|
-
fontMapping?: FontMapping;
|
|
348
|
-
/**
|
|
349
|
-
* Skip OS system font directories and only scan `fontDirs`.
|
|
350
|
-
*
|
|
351
|
-
* This is useful in containers or serverless environments where bundled fonts
|
|
352
|
-
* should be the only fonts used.
|
|
353
|
-
*/
|
|
354
|
-
skipSystemFonts?: boolean;
|
|
355
|
-
/**
|
|
356
|
-
* Text output mode for SVG conversion.
|
|
357
|
-
*
|
|
358
|
-
* Defaults to `"path"`, which emits glyph outlines as `<path>` elements and
|
|
359
|
-
* does not require fonts in the SVG viewing environment. `"text"` emits native
|
|
360
|
-
* `<text>` elements with subset-font `@font-face` data URIs, enabling browser
|
|
361
|
-
* text selection and native text rendering for inline SVG.
|
|
362
|
-
*
|
|
363
|
-
* Embedded fonts and native text may not render as expected when the SVG is
|
|
364
|
-
* loaded through `<img src="...svg">` or sanitized. `convertPptxToPng` ignores
|
|
365
|
-
* this option and always renders with `"path"` output because resvg does not
|
|
366
|
-
* interpret the embedded `@font-face` rules used by SVG text output.
|
|
367
|
-
*/
|
|
368
|
-
textOutput?: "path" | "text";
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* SVG conversion result for one slide.
|
|
372
|
-
*/
|
|
373
|
-
interface SlideSvg {
|
|
374
|
-
/**
|
|
375
|
-
* Original slide number in the PPTX file, using 1-based numbering.
|
|
376
|
-
*/
|
|
377
|
-
slideNumber: number;
|
|
378
|
-
/**
|
|
379
|
-
* Complete SVG document string for the slide.
|
|
380
|
-
*/
|
|
381
|
-
svg: string;
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* PNG conversion result for one slide.
|
|
385
|
-
*/
|
|
386
|
-
interface SlideImage {
|
|
387
|
-
/**
|
|
388
|
-
* Original slide number in the PPTX file, using 1-based numbering.
|
|
389
|
-
*/
|
|
390
|
-
slideNumber: number;
|
|
391
|
-
/**
|
|
392
|
-
* PNG image bytes for the rendered slide.
|
|
393
|
-
*/
|
|
394
|
-
png: Buffer;
|
|
395
|
-
/**
|
|
396
|
-
* Actual output image width in pixels after rasterization.
|
|
397
|
-
*/
|
|
398
|
-
width: number;
|
|
399
|
-
/**
|
|
400
|
-
* Actual output image height in pixels after rasterization.
|
|
401
|
-
*/
|
|
402
|
-
height: number;
|
|
403
|
-
}
|
|
404
|
-
interface ConversionDiagnostic {
|
|
405
|
-
readonly source: "document" | "computed-view" | "renderer-adapter" | "renderer";
|
|
406
|
-
readonly severity: "info" | "warning" | "error";
|
|
407
|
-
readonly code: string;
|
|
408
|
-
readonly message: string;
|
|
409
|
-
readonly slideNumber?: number;
|
|
410
|
-
readonly sourcePartPath?: string;
|
|
411
|
-
readonly context?: string;
|
|
412
|
-
readonly handle?: SourceHandle;
|
|
413
|
-
}
|
|
414
|
-
interface SupportCoverageCounts {
|
|
415
|
-
/**
|
|
416
|
-
* Number of PPTX source/computed elements considered for rendering.
|
|
417
|
-
*/
|
|
418
|
-
readonly inputElements: number;
|
|
419
|
-
/**
|
|
420
|
-
* Number of renderer-model elements produced for SVG / PNG output.
|
|
421
|
-
*/
|
|
422
|
-
readonly outputElements: number;
|
|
423
|
-
/**
|
|
424
|
-
* Elements or raw nodes skipped because they are outside the supported render subset.
|
|
425
|
-
*/
|
|
426
|
-
readonly skippedElements: number;
|
|
427
|
-
/**
|
|
428
|
-
* Elements skipped because a referenced PPTX part or relationship could not be resolved.
|
|
429
|
-
*/
|
|
430
|
-
readonly unresolvedElements: number;
|
|
431
|
-
/**
|
|
432
|
-
* Elements or properties rendered with a fallback or ignored unsupported property.
|
|
433
|
-
*/
|
|
434
|
-
readonly fallbackElements: number;
|
|
435
|
-
/**
|
|
436
|
-
* Diagnostics with warning severity that affect support/renderability confidence.
|
|
437
|
-
*/
|
|
438
|
-
readonly warnings: number;
|
|
439
|
-
}
|
|
440
|
-
interface SlideSupportCoverage extends SupportCoverageCounts {
|
|
441
|
-
readonly slideNumber: number;
|
|
442
|
-
}
|
|
443
|
-
interface SupportCoverage {
|
|
444
|
-
/**
|
|
445
|
-
* Support/renderability coverage summary. This is not a visual-match or pixel accuracy metric.
|
|
446
|
-
*/
|
|
447
|
-
readonly overall: SupportCoverageCounts;
|
|
448
|
-
readonly slides: readonly SlideSupportCoverage[];
|
|
449
|
-
}
|
|
450
|
-
interface SvgConversionReport {
|
|
451
|
-
readonly slides: readonly SlideSvg[];
|
|
452
|
-
readonly diagnostics: readonly ConversionDiagnostic[];
|
|
453
|
-
readonly supportCoverage: SupportCoverage;
|
|
454
|
-
}
|
|
455
|
-
interface PngConversionReport {
|
|
456
|
-
readonly slides: readonly SlideImage[];
|
|
457
|
-
readonly diagnostics: readonly ConversionDiagnostic[];
|
|
458
|
-
readonly supportCoverage: SupportCoverage;
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Convert a PPTX file to SVG documents.
|
|
462
|
-
*
|
|
463
|
-
* @param input PPTX binary data as a Node.js `Buffer` or `Uint8Array`.
|
|
464
|
-
* @param options Conversion options. `slides` uses 1-based slide numbers; when
|
|
465
|
-
* omitted, all slides are converted.
|
|
466
|
-
* @returns A conversion report containing converted slides, diagnostics, and support coverage.
|
|
467
|
-
*
|
|
468
|
-
* Text is emitted as SVG paths by default for portable rendering. Set
|
|
469
|
-
* `textOutput: "text"` to emit native `<text>` elements with embedded subset
|
|
470
|
-
* fonts for inline browser SVG use. Font directories and font mapping options
|
|
471
|
-
* control how PPTX font names are resolved for text measurement and text output.
|
|
472
|
-
*/
|
|
473
|
-
declare function convertPptxToSvg(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SvgConversionReport>;
|
|
474
|
-
/**
|
|
475
|
-
* Convert a PPTX file to PNG images.
|
|
476
|
-
*
|
|
477
|
-
* @param input PPTX binary data as a Node.js `Buffer` or `Uint8Array`.
|
|
478
|
-
* @param options Conversion options. `slides` uses 1-based slide numbers; when
|
|
479
|
-
* omitted, all slides are converted.
|
|
480
|
-
* @returns A conversion report containing converted PNG slides, diagnostics, and support coverage.
|
|
481
|
-
*
|
|
482
|
-
* PNG conversion first renders each slide to SVG and then rasterizes it with
|
|
483
|
-
* resvg. The `textOutput` option is intentionally ignored: PNG rendering always
|
|
484
|
-
* uses path-based text output because resvg does not interpret the embedded
|
|
485
|
-
* `@font-face` rules used by SVG text mode. Font directories and font mapping
|
|
486
|
-
* options are still used to resolve glyph outlines and text metrics.
|
|
487
|
-
*/
|
|
488
|
-
declare function convertPptxToPng(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<PngConversionReport>;
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Font names discovered in a PPTX file.
|
|
492
|
-
*/
|
|
493
|
-
interface UsedFonts {
|
|
494
|
-
/**
|
|
495
|
-
* Theme font slots resolved from the presentation's default theme.
|
|
496
|
-
*/
|
|
497
|
-
theme: {
|
|
498
|
-
/**
|
|
499
|
-
* Major Latin theme font.
|
|
500
|
-
*/
|
|
501
|
-
majorFont: string;
|
|
502
|
-
/**
|
|
503
|
-
* Minor Latin theme font.
|
|
504
|
-
*/
|
|
505
|
-
minorFont: string;
|
|
506
|
-
/**
|
|
507
|
-
* Major East Asian theme font, when present.
|
|
508
|
-
*/
|
|
509
|
-
majorFontEa: string | null;
|
|
510
|
-
/**
|
|
511
|
-
* Minor East Asian theme font, when present.
|
|
512
|
-
*/
|
|
513
|
-
minorFontEa: string | null;
|
|
514
|
-
/**
|
|
515
|
-
* Major complex-script theme font, when present.
|
|
516
|
-
*/
|
|
517
|
-
majorFontCs: string | null;
|
|
518
|
-
/**
|
|
519
|
-
* Minor complex-script theme font, when present.
|
|
520
|
-
*/
|
|
521
|
-
minorFontCs: string | null;
|
|
522
|
-
};
|
|
523
|
-
/**
|
|
524
|
-
* Unique sorted font names used by text runs, bullets, and theme font slots.
|
|
525
|
-
*/
|
|
526
|
-
fonts: string[];
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* Parse a PPTX file and collect the font names it references.
|
|
530
|
-
*
|
|
531
|
-
* This is a lightweight preflight helper: it reads the document model and text
|
|
532
|
-
* styles but does not render slides or load font files. Use it to decide which
|
|
533
|
-
* fonts should be installed, bundled, or mapped before calling the conversion
|
|
534
|
-
* APIs.
|
|
535
|
-
*
|
|
536
|
-
* @param input PPTX binary data as a Node.js `Buffer` or `Uint8Array`.
|
|
537
|
-
* @returns Theme font slots and a unique sorted list of referenced font names.
|
|
538
|
-
*/
|
|
539
|
-
declare function collectUsedFonts(input: Buffer | Uint8Array): UsedFonts;
|
|
540
|
-
|
|
541
|
-
export { type ConversionDiagnostic, type ConvertOptions, DEFAULT_FONT_MAPPING, type FontBuffer, type FontMapping, type LogLevel, type OpentypeSetup, type PngConversionReport, type SlideImage, type SlideSupportCoverage, type SlideSvg, type SupportCoverage, type SupportCoverageCounts, type SvgConversionReport, type UsedFonts, type WarningEntry, type WarningSummary, clearFontCache, collectUsedFonts, convertPptxToPng, convertPptxToSvg, createFontMapping, createOpentypeSetupFromBuffers, createOpentypeTextMeasurerFromBuffers, getMappedFont, getWarningEntries, getWarningSummary, initResvgWasm };
|
|
8
|
+
export { type ResvgWasmInput, initResvgWasm };
|