pd4ml 0.0.0-stage → 1.0.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/README.md +88 -3
- package/bin/pd4ml.js +131 -0
- package/docs/api.md +546 -0
- package/docs/guide.md +795 -0
- package/index.d.ts +655 -0
- package/index.js +61 -0
- package/index.mjs +40 -0
- package/lib/bridge-worker.js +64 -0
- package/lib/bridge.js +309 -0
- package/lib/errors.js +55 -0
- package/lib/installer.js +218 -0
- package/lib/java.js +149 -0
- package/lib/pd4ml-bridge.jar +0 -0
- package/lib/pd4ml.js +192 -0
- package/lib/pdf.js +63 -0
- package/lib/runtime.js +87 -0
- package/package.json +50 -6
package/index.d.ts
ADDED
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
// Type declarations of pd4ml (PD4ML for Node.js). The part after the marker line is generated
|
|
2
|
+
// by tools/gen-types.js from the PD4ML Java classes; this header is tools/types-header.d.ts.
|
|
3
|
+
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
|
|
6
|
+
/** A Java object living in the bridge: call any Java method by its Java name. */
|
|
7
|
+
export interface JavaObject {
|
|
8
|
+
/** The Java class name (`com.pd4ml.PageSize`). */
|
|
9
|
+
readonly $class: string;
|
|
10
|
+
/** For an enum constant, its name (`v42`, `MM`); else null. */
|
|
11
|
+
readonly $enum: string | null;
|
|
12
|
+
/** Reads a public field. */
|
|
13
|
+
$get(field: string): any;
|
|
14
|
+
/** Writes a public field. */
|
|
15
|
+
$set(field: string, value: unknown): void;
|
|
16
|
+
/** Calls a Java method by name. */
|
|
17
|
+
$call(method: string, ...args: unknown[]): any;
|
|
18
|
+
/** Whether the object is an instance of the Java class or interface. */
|
|
19
|
+
$instanceOf(javaClass: string): boolean;
|
|
20
|
+
/** Java `toString()`. */
|
|
21
|
+
toString(): string;
|
|
22
|
+
/** Any other Java method. */
|
|
23
|
+
[method: string]: any;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A Java class: static fields and methods as properties, constructors with `new`. */
|
|
27
|
+
export interface JavaClass {
|
|
28
|
+
readonly $name: string;
|
|
29
|
+
new (...args: unknown[]): JavaObject;
|
|
30
|
+
$new(...args: unknown[]): JavaObject;
|
|
31
|
+
$get(field: string): any;
|
|
32
|
+
$set(field: string, value: unknown): void;
|
|
33
|
+
$call(method: string, ...args: unknown[]): any;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A number passed to Java as a float/double (`Java.float(10)`). */
|
|
37
|
+
export interface JavaFloat {
|
|
38
|
+
readonly value: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Where output goes: a file path, a file descriptor, or a writable stream (`write()`). */
|
|
42
|
+
export type Target = string | URL | number | { write(data: Buffer): unknown };
|
|
43
|
+
|
|
44
|
+
/** A document to read: a path or URL, its bytes, or a Java URL/InputStream. */
|
|
45
|
+
export type Source = string | URL | Buffer | Uint8Array | JavaObject;
|
|
46
|
+
|
|
47
|
+
export interface PD4MLOptions {
|
|
48
|
+
/** A license serial number or license file URL (default: pd4ml.lic, else evaluation mode). */
|
|
49
|
+
license?: string;
|
|
50
|
+
/** The width in pixels the HTML is laid out in. */
|
|
51
|
+
htmlWidth?: number;
|
|
52
|
+
/** 'v42' (default where the build has it), 'v40', a LayoutEngine, or false for the Java default. */
|
|
53
|
+
engine?: 'v42' | 'v40' | LayoutEngine | false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* An HTML to PDF/DOCX/RTF/image converter: com.pd4ml.PD4ML with Node I/O and the v42 layout
|
|
58
|
+
* engine by default. Every Java method is available by its Java name.
|
|
59
|
+
*/
|
|
60
|
+
export interface PD4ML extends PD4MLJava {
|
|
61
|
+
/** The Java object (com.pd4ml.PD4ML). */
|
|
62
|
+
readonly java: JavaObject;
|
|
63
|
+
/** The layout engine chosen ('v42', 'v40'), or null for the build's own. */
|
|
64
|
+
readonly engine: string | null;
|
|
65
|
+
useHtmlRenderer(engine?: 'v42' | 'v40' | LayoutEngine, htmlWidth?: number | null, params?: Record<string, string | number> | null): void;
|
|
66
|
+
readHTML(source: Source, baseUrl?: string | null, encoding?: string | null): void;
|
|
67
|
+
readHtmlString(html: string, baseUrl?: string | null): void;
|
|
68
|
+
writePDF(): Buffer;
|
|
69
|
+
writePDF(target: null, spec?: string | PdfSpec | null): Buffer;
|
|
70
|
+
writePDF(target: Target, spec?: string | PdfSpec | null): void;
|
|
71
|
+
writeDOCX(): Buffer;
|
|
72
|
+
writeDOCX(target: Target): void;
|
|
73
|
+
writeRTF(): Buffer;
|
|
74
|
+
writeRTF(target: null, rtfWmf?: boolean): Buffer;
|
|
75
|
+
writeRTF(target: Target, rtfWmf?: boolean): void;
|
|
76
|
+
renderAsImages(format: string): Buffer[];
|
|
77
|
+
renderAsImages(directory: string, name: string, format: string): JavaObject;
|
|
78
|
+
renderAsImages(): JavaObject[];
|
|
79
|
+
renderPng(): Buffer[];
|
|
80
|
+
monitorProgressWith(listener: ((messageId: number, progress: number, note: string | null, msec: number) => void) | JavaObject): void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const PD4ML: {
|
|
84
|
+
new (options?: PD4MLOptions): PD4ML;
|
|
85
|
+
readonly DEFAULT_ENGINE: 'v42';
|
|
86
|
+
} & PD4MLStatics;
|
|
87
|
+
|
|
88
|
+
export const Java: {
|
|
89
|
+
/** Any Java class by name (`Java.type('java.util.Locale')`). */
|
|
90
|
+
type(name: string): JavaClass & { [member: string]: any };
|
|
91
|
+
/** A Java object implementing `iface`; its methods call `fn(method, args)`. */
|
|
92
|
+
proxy(iface: string, fn: (method: string, args: any[]) => void): JavaObject;
|
|
93
|
+
/** A number passed as a Java float/double. */
|
|
94
|
+
float(value: number): JavaFloat;
|
|
95
|
+
isJavaObject(value: unknown): boolean;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export interface HtmlToPdfOptions {
|
|
99
|
+
baseUrl?: string;
|
|
100
|
+
pageSize?: PageSize;
|
|
101
|
+
pageMargins?: PageMargins;
|
|
102
|
+
spec?: string | PdfSpec;
|
|
103
|
+
engine?: PD4MLOptions['engine'];
|
|
104
|
+
htmlWidth?: number;
|
|
105
|
+
}
|
|
106
|
+
export function htmlToPdf(source: Source, target?: null, options?: HtmlToPdfOptions): Buffer;
|
|
107
|
+
export function htmlToPdf(source: Source, target: Target, options?: HtmlToPdfOptions): void;
|
|
108
|
+
export function openPdf(source: string | URL | Buffer | Uint8Array, password?: string | null): PdfDocument;
|
|
109
|
+
export function writePdf(document: PdfDocument, target?: null, options?: { password?: string; permissions?: number }): Buffer;
|
|
110
|
+
export function writePdf(document: PdfDocument, target: Target, options?: { password?: string; permissions?: number }): void;
|
|
111
|
+
export function mergePdfs(first: string | Buffer | Uint8Array, second: string | Buffer | Uint8Array, target?: null): Buffer;
|
|
112
|
+
export function mergePdfs(first: string | Buffer | Uint8Array, second: string | Buffer | Uint8Array, target: Target): void;
|
|
113
|
+
|
|
114
|
+
export function version(): string;
|
|
115
|
+
export function hasLayoutEngines(): boolean;
|
|
116
|
+
export function toUrl(location: string | URL | JavaObject): JavaObject;
|
|
117
|
+
export function pdfSpec(spec: string | PdfSpec | null): string | PdfSpec | null;
|
|
118
|
+
export function configure(options: { classpath?: string[]; java?: string; jvmOptions?: string[]; server?: string; logFile?: string }): void;
|
|
119
|
+
export function shutdown(): void;
|
|
120
|
+
|
|
121
|
+
export interface InstallOptions {
|
|
122
|
+
snapshots?: boolean;
|
|
123
|
+
jakarta?: boolean;
|
|
124
|
+
repository?: string;
|
|
125
|
+
home?: string;
|
|
126
|
+
force?: boolean;
|
|
127
|
+
quiet?: boolean;
|
|
128
|
+
bouncycastle?: boolean;
|
|
129
|
+
}
|
|
130
|
+
export function install(version?: string, options?: InstallOptions): string;
|
|
131
|
+
export function installedJar(home?: string): string | null;
|
|
132
|
+
export function installedClasspath(home?: string): string[];
|
|
133
|
+
export function installedVersion(home?: string): string | null;
|
|
134
|
+
export function availableVersions(repository?: string): string[];
|
|
135
|
+
|
|
136
|
+
export class BridgeError extends Error {}
|
|
137
|
+
export class JavaError extends Error {
|
|
138
|
+
readonly javaClass: string;
|
|
139
|
+
readonly hierarchy: string[];
|
|
140
|
+
readonly javaMessage: string;
|
|
141
|
+
readonly causes: string[];
|
|
142
|
+
readonly javaTrace: string;
|
|
143
|
+
isInstanceOf(javaClass: string): boolean;
|
|
144
|
+
}
|
|
145
|
+
export class CallbackError extends Error {}
|
|
146
|
+
export class InstallError extends Error {}
|
|
147
|
+
|
|
148
|
+
// ---- generated by tools/gen-types.js from the PD4ML Java classes - do not edit below ----
|
|
149
|
+
|
|
150
|
+
/** The Java class `com.pd4ml.PD4ML`. */
|
|
151
|
+
export interface PD4MLJava extends JavaObject {
|
|
152
|
+
applyLicense(license: string): boolean;
|
|
153
|
+
isDemoMode(): boolean;
|
|
154
|
+
isPro(): boolean;
|
|
155
|
+
merge(pdf: PdfDocument, fromPage: number | JavaFloat, toPage: number | JavaFloat, append: boolean): void;
|
|
156
|
+
terminate(): void;
|
|
157
|
+
setLogLevel(level: number | JavaFloat): void;
|
|
158
|
+
setErrorPolicy(policy: ErrorPolicy): void;
|
|
159
|
+
useTTF(pathToFontDirs: string): void;
|
|
160
|
+
useTTF(pathToFontDirs: string, generateFontMappingFileIfMissing: boolean): void;
|
|
161
|
+
useTTF(pathToFontDirs: string, fontFileNameFilter: string): void;
|
|
162
|
+
embedTTFs(embed: boolean, allGlyphs: boolean): void;
|
|
163
|
+
generateForms(enable: boolean, useTtfFont: string): void;
|
|
164
|
+
generateForms(enable: boolean, useTtfFont: string, formFontCharRange: string): void;
|
|
165
|
+
isGenerateForms(): boolean;
|
|
166
|
+
getFormFont(): string;
|
|
167
|
+
getFormFontCharRange(): string;
|
|
168
|
+
generateMulticolumn(columns: number | JavaFloat, span: number | JavaFloat, millimeters: boolean): void;
|
|
169
|
+
useHttpRequest(httpRequest: unknown, httpResponse: unknown): void;
|
|
170
|
+
addCustomResourceProvider(customProviderClassName: string): void;
|
|
171
|
+
addCustomTagHandler(customTagName: string, implementation: CustomTag): void;
|
|
172
|
+
generateBookmarksFromHeadings(enable: boolean): void;
|
|
173
|
+
generateBookmarksFromAnchors(enable: boolean): void;
|
|
174
|
+
generateBookmarksFromHeadings(): boolean;
|
|
175
|
+
generateBookmarksFromAnchors(): boolean;
|
|
176
|
+
setSessionID(sessionID: string): void;
|
|
177
|
+
overrideDocumentEncoding(encoding: string): void;
|
|
178
|
+
enableHyperlinks(enable: boolean): void;
|
|
179
|
+
isHyperlinksDisabled(): boolean;
|
|
180
|
+
isGenerateTooltips(): boolean;
|
|
181
|
+
setPageHeader(htmlCode: string, heightPx: number | JavaFloat): void;
|
|
182
|
+
setPageHeader(htmlCode: string, heightPx: number | JavaFloat, scope: string): void;
|
|
183
|
+
setPageFooter(htmlCode: string, heightPx: number | JavaFloat): void;
|
|
184
|
+
setPageFooter(htmlCode: string, heightPx: number | JavaFloat, scope: string): void;
|
|
185
|
+
setWatermark(htmlCode: string, left: number | JavaFloat, top: number | JavaFloat, opacity: number | JavaFloat, angle: number | JavaFloat, scale: number | JavaFloat, screen: boolean, print: boolean, scope: string): void;
|
|
186
|
+
setPageBackground(htmlCode: string): void;
|
|
187
|
+
setPageBackground(htmlCode: string, scope: string): void;
|
|
188
|
+
setPermissions(password: string, permissions: number | JavaFloat): void;
|
|
189
|
+
setPermissions(password: string, permissions: number | JavaFloat, encryptionMethod: number | JavaFloat): void;
|
|
190
|
+
setCookie(name: string, value: string): void;
|
|
191
|
+
setHttpOptions(proxy: string, basicAuthentication: string): void;
|
|
192
|
+
addDocumentActionHandler(actionType: string, javaScript: string): void;
|
|
193
|
+
getActionHandlers(): JavaObject;
|
|
194
|
+
setPageSize(d: PageSize, scope: string): void;
|
|
195
|
+
setPageSize(d: PageSize): void;
|
|
196
|
+
getPageSize(pageNum: number | JavaFloat): PageSize;
|
|
197
|
+
setPageMargins(margins: PageMargins): void;
|
|
198
|
+
setPageMargins(margins: PageMargins, scope: string): void;
|
|
199
|
+
getPageMargins(pageNum: number | JavaFloat, imageGeneration: boolean): PageMargins;
|
|
200
|
+
setHtmlWidth(width: number | JavaFloat): void;
|
|
201
|
+
adjustHtmlWidth(adjust: boolean): void;
|
|
202
|
+
fitPageVertically(align: number | JavaFloat): void;
|
|
203
|
+
getFitPageVertically(): number;
|
|
204
|
+
setAuthorName(name: string): void;
|
|
205
|
+
setDocumentTitle(title: string): void;
|
|
206
|
+
setInitialPageNumber(initialPageNumber: number | JavaFloat): void;
|
|
207
|
+
addStyle(stylesheet: string | URL | JavaObject, overrideDocumentStyles: boolean): void;
|
|
208
|
+
addStyle(stylesheet: string, overrideDocumentStyles: boolean): void;
|
|
209
|
+
injectHtml(htmlSnippet: string, prependBodyContent: boolean): void;
|
|
210
|
+
isKeepTrailingBlankPages(): boolean;
|
|
211
|
+
testTermination(): void;
|
|
212
|
+
getHeight(width: number | JavaFloat): number;
|
|
213
|
+
getDocumentTitle(): string;
|
|
214
|
+
setRenderingHints(hints: Record<string, string>): void;
|
|
215
|
+
dump(mode: number | JavaFloat): string;
|
|
216
|
+
protectPhysicalUnitDimensions(keepPhysicalUnitDimensions: boolean): void;
|
|
217
|
+
setDynamicData(map: Record<string, string>): void;
|
|
218
|
+
setParam(key: string, value: string): void;
|
|
219
|
+
getLastRenderInfo(key: string): unknown;
|
|
220
|
+
outputRange(description: string): void;
|
|
221
|
+
addMetadata(key: string, value: string, hide: boolean): void;
|
|
222
|
+
applyKerning(enable: boolean): void;
|
|
223
|
+
enableLigatures(enable: boolean): void;
|
|
224
|
+
getCache(): unknown;
|
|
225
|
+
setCache(fontCache: unknown): void;
|
|
226
|
+
asyncResourceLoader(threadPoolSize: number | JavaFloat): void;
|
|
227
|
+
}
|
|
228
|
+
export interface PD4MLStatics {
|
|
229
|
+
disableBatik: boolean;
|
|
230
|
+
disableMathML: boolean;
|
|
231
|
+
getVersion(): string;
|
|
232
|
+
getVersionBuildDate(): JavaObject;
|
|
233
|
+
translateToPt(mm: number | JavaFloat): number;
|
|
234
|
+
predictScale(pageMargins: PageMargins, pageSize: PageSize, userSpace: number | JavaFloat): number;
|
|
235
|
+
predictPageHeight(pageMargins: PageMargins, pageSize: PageSize, userSpace: number | JavaFloat): number;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** The Java class `com.pd4ml.Constants`. */
|
|
239
|
+
export interface Constants extends JavaObject {
|
|
240
|
+
}
|
|
241
|
+
export interface ConstantsClass extends JavaClass {
|
|
242
|
+
new (): Constants;
|
|
243
|
+
readonly TRANSLATE_FACTOR: number;
|
|
244
|
+
readonly DefaultPermissions: number;
|
|
245
|
+
readonly AllowDegradedPrint: number;
|
|
246
|
+
readonly AllowModify: number;
|
|
247
|
+
readonly AllowCopy: number;
|
|
248
|
+
readonly AllowAnnotate: number;
|
|
249
|
+
readonly AllowFillingForms: number;
|
|
250
|
+
readonly AllowContentExtraction: number;
|
|
251
|
+
readonly AllowAssembly: number;
|
|
252
|
+
readonly AllowPrint: number;
|
|
253
|
+
readonly PD4ML_MAX_CACHE_ENTRIES: string;
|
|
254
|
+
readonly PD4ML_MAX_CACHE_SIZE: string;
|
|
255
|
+
readonly PD4ML_MAX_CACHE_VOLUME: string;
|
|
256
|
+
readonly PD4ML_IDS_AS_DESTINATIONS: string;
|
|
257
|
+
readonly PD4ML_EXTRA_RESOURCE_LOADERS: string;
|
|
258
|
+
readonly PD4ML_DOCUMENT_VIEW_MODE: string;
|
|
259
|
+
readonly PD4ML_DOCUMENT_DATE: string;
|
|
260
|
+
readonly PD4ML_WORD_EDITABLE: string;
|
|
261
|
+
readonly PD4ML_DOCUMENT_XMP_DATE: string;
|
|
262
|
+
readonly PD4ML_FAKE_BROWSER: string;
|
|
263
|
+
readonly PD4ML_CACHE_ENABLE: string;
|
|
264
|
+
readonly PD4ML_SESSIONID_APPEND: string;
|
|
265
|
+
readonly PD4ML_SOCKET_TIMEOUT: string;
|
|
266
|
+
readonly PD4ML_PRINT_DIALOG_POPUP: string;
|
|
267
|
+
readonly PD4ML_MEDIA_TYPE_PRINT: string;
|
|
268
|
+
readonly PD4ML_CSS_IMPORT_DIRECTIVE: string;
|
|
269
|
+
readonly PD4ML_SESSIONID_VARNAME: string;
|
|
270
|
+
readonly PD4ML_INITIAL_PAGE_NUMBER: string;
|
|
271
|
+
readonly PD4ML_HTML_IN_DYNAMIC_DATA: string;
|
|
272
|
+
readonly PD4ML_ALLOWED_RESOURCE_LOCATION: string;
|
|
273
|
+
readonly PD4ML_DISABLE_EXTERNAL_ATTACHMENTS: string;
|
|
274
|
+
readonly PD4ML_GENERATE_TOOLTIPS: string;
|
|
275
|
+
readonly PD4ML_CACHE_IMAGES_IN_TMP_DIR: string;
|
|
276
|
+
readonly PD4ML_HTTP_REQUEST_DISPATCHER: string;
|
|
277
|
+
readonly PD4ML_PDFA_STATUS: string;
|
|
278
|
+
readonly PD4ML_DOCUMENT_HEIGHT_PX: string;
|
|
279
|
+
readonly PD4ML_RIGHT_EDGE_PX: string;
|
|
280
|
+
readonly PD4ML_TOTAL_PAGES: string;
|
|
281
|
+
readonly PD4ML_INFO_AUTHOR: string;
|
|
282
|
+
readonly PD4ML_INFO_TITLE: string;
|
|
283
|
+
readonly PD4ML_FORCE_RTL: string;
|
|
284
|
+
readonly PD4ML_BACKGROUND_AS_PATTERNS: string;
|
|
285
|
+
readonly PD4ML_CONFIG_FILE: string;
|
|
286
|
+
readonly PD4ML_CONFIG_HANDLER_CLASS: string;
|
|
287
|
+
readonly PD4ML_IMAGE_REPOSITORY: string;
|
|
288
|
+
readonly PD4ML_FIX20130116: string;
|
|
289
|
+
readonly PD4ML_STYLESHEETS_TO_OMIT: string;
|
|
290
|
+
readonly PD4ML_ENABLE_HTTP_ERRORS: string;
|
|
291
|
+
readonly PD4ML_OMIT_DEFAULT_STYLE: string;
|
|
292
|
+
readonly PD4ML_DUMP_DEFAULT_STYLE: string;
|
|
293
|
+
readonly PD4ML_HEADER_HEIGHT_LIMIT: string;
|
|
294
|
+
readonly PD4ML_KEEP_TRAILING_BLANK_PAGES: string;
|
|
295
|
+
readonly PD4ML_DISABLE_WOFF: string;
|
|
296
|
+
readonly PD4ML_DISABLE_WOFF2: string;
|
|
297
|
+
readonly PD4ML_PDF_BROTLI: string;
|
|
298
|
+
readonly PDF: string;
|
|
299
|
+
readonly PDFA: string;
|
|
300
|
+
readonly PDFUA: string;
|
|
301
|
+
readonly DOCX: string;
|
|
302
|
+
readonly RTF: string;
|
|
303
|
+
readonly RTF_WMF: string;
|
|
304
|
+
readonly PNG8: string;
|
|
305
|
+
readonly PNG24: string;
|
|
306
|
+
readonly TIFF: string;
|
|
307
|
+
readonly TIFF_COMPRESSED: string;
|
|
308
|
+
readonly MULTIPAGE_TIFF: string;
|
|
309
|
+
readonly MULTIPAGE_TIFF_COMPRESSED: string;
|
|
310
|
+
readonly LEFT_ALIGN: number;
|
|
311
|
+
readonly CENTER_ALIGN: number;
|
|
312
|
+
readonly RIGHT_ALIGN: number;
|
|
313
|
+
readonly RC4_40BIT: number;
|
|
314
|
+
readonly RC4_128BIT: number;
|
|
315
|
+
readonly AES_128BIT: number;
|
|
316
|
+
readonly AES_256BIT: number;
|
|
317
|
+
readonly ISO8859_1: string;
|
|
318
|
+
readonly WINDOWS_1252: string;
|
|
319
|
+
readonly UTF8: string;
|
|
320
|
+
}
|
|
321
|
+
export const Constants: ConstantsClass;
|
|
322
|
+
|
|
323
|
+
/** The Java class `com.pd4ml.Constants.LayoutEngine`. */
|
|
324
|
+
export interface LayoutEngine extends JavaObject {
|
|
325
|
+
}
|
|
326
|
+
export interface LayoutEngineClass extends JavaClass {
|
|
327
|
+
readonly v40: LayoutEngine;
|
|
328
|
+
readonly v42: LayoutEngine;
|
|
329
|
+
values(): LayoutEngine[];
|
|
330
|
+
valueOf(name: string): LayoutEngine;
|
|
331
|
+
}
|
|
332
|
+
export const LayoutEngine: LayoutEngineClass;
|
|
333
|
+
|
|
334
|
+
/** The Java class `com.pd4ml.Constants.ErrorPolicy`. */
|
|
335
|
+
export interface ErrorPolicy extends JavaObject {
|
|
336
|
+
}
|
|
337
|
+
export interface ErrorPolicyClass extends JavaClass {
|
|
338
|
+
readonly NONE: ErrorPolicy;
|
|
339
|
+
readonly RELAXED: ErrorPolicy;
|
|
340
|
+
readonly NORMAL: ErrorPolicy;
|
|
341
|
+
readonly PEDANTIC: ErrorPolicy;
|
|
342
|
+
readonly STRICT: ErrorPolicy;
|
|
343
|
+
values(): ErrorPolicy[];
|
|
344
|
+
valueOf(name: string): ErrorPolicy;
|
|
345
|
+
}
|
|
346
|
+
export const ErrorPolicy: ErrorPolicyClass;
|
|
347
|
+
|
|
348
|
+
/** The Java class `com.pd4ml.PageSize`. */
|
|
349
|
+
export interface PageSize extends JavaObject {
|
|
350
|
+
/** `width` (a public field: `obj.$get('width')`) */
|
|
351
|
+
/** `height` (a public field: `obj.$get('height')`) */
|
|
352
|
+
/** `rotated` (a public field: `obj.$get('rotated')`) */
|
|
353
|
+
rotate(): PageSize;
|
|
354
|
+
mmWidth(): number;
|
|
355
|
+
mmHeight(): number;
|
|
356
|
+
}
|
|
357
|
+
export interface PageSizeClass extends JavaClass {
|
|
358
|
+
new (width: number | JavaFloat, height: number | JavaFloat, units: Units): PageSize;
|
|
359
|
+
new (width: number | JavaFloat, height: number | JavaFloat): PageSize;
|
|
360
|
+
readonly B5: PageSize;
|
|
361
|
+
readonly B4: PageSize;
|
|
362
|
+
readonly JIS_B5: PageSize;
|
|
363
|
+
readonly JIS_B4: PageSize;
|
|
364
|
+
readonly A10: PageSize;
|
|
365
|
+
readonly A9: PageSize;
|
|
366
|
+
readonly A8: PageSize;
|
|
367
|
+
readonly A7: PageSize;
|
|
368
|
+
readonly A6: PageSize;
|
|
369
|
+
readonly A5: PageSize;
|
|
370
|
+
readonly A4: PageSize;
|
|
371
|
+
readonly A3: PageSize;
|
|
372
|
+
readonly A2: PageSize;
|
|
373
|
+
readonly A1: PageSize;
|
|
374
|
+
readonly A0: PageSize;
|
|
375
|
+
readonly ISOB5: PageSize;
|
|
376
|
+
readonly ISOB4: PageSize;
|
|
377
|
+
readonly ISOB3: PageSize;
|
|
378
|
+
readonly ISOB2: PageSize;
|
|
379
|
+
readonly ISOB1: PageSize;
|
|
380
|
+
readonly ISOB0: PageSize;
|
|
381
|
+
readonly HALFLETTER: PageSize;
|
|
382
|
+
readonly LETTER: PageSize;
|
|
383
|
+
readonly TABLOID: PageSize;
|
|
384
|
+
readonly LEDGER: PageSize;
|
|
385
|
+
readonly NOTE: PageSize;
|
|
386
|
+
readonly LEGAL: PageSize;
|
|
387
|
+
readonly ArchA: PageSize;
|
|
388
|
+
readonly ArchB: PageSize;
|
|
389
|
+
readonly ArchC: PageSize;
|
|
390
|
+
readonly ArchD: PageSize;
|
|
391
|
+
readonly ArchE: PageSize;
|
|
392
|
+
readonly ArchE1: PageSize;
|
|
393
|
+
getInstance(name: string): PageSize;
|
|
394
|
+
}
|
|
395
|
+
export const PageSize: PageSizeClass;
|
|
396
|
+
|
|
397
|
+
/** The Java class `com.pd4ml.PageMargins`. */
|
|
398
|
+
export interface PageMargins extends JavaObject {
|
|
399
|
+
/** `left` (a public field: `obj.$get('left')`) */
|
|
400
|
+
/** `top` (a public field: `obj.$get('top')`) */
|
|
401
|
+
/** `right` (a public field: `obj.$get('right')`) */
|
|
402
|
+
/** `bottom` (a public field: `obj.$get('bottom')`) */
|
|
403
|
+
flipHorizontal(): PageMargins;
|
|
404
|
+
flipVertical(): PageMargins;
|
|
405
|
+
rotate(): PageMargins;
|
|
406
|
+
}
|
|
407
|
+
export interface PageMarginsClass extends JavaClass {
|
|
408
|
+
new (left: number | JavaFloat, top: number | JavaFloat, right: number | JavaFloat, bottom: number | JavaFloat): PageMargins;
|
|
409
|
+
new (left: number | JavaFloat, top: number | JavaFloat, right: number | JavaFloat, bottom: number | JavaFloat, units: Units): PageMargins;
|
|
410
|
+
readonly DEFAULT_PAGE_MARGINS: PageMargins;
|
|
411
|
+
}
|
|
412
|
+
export const PageMargins: PageMarginsClass;
|
|
413
|
+
|
|
414
|
+
/** The Java interface `com.pd4ml.Dimensions`. */
|
|
415
|
+
export interface Dimensions extends JavaObject {
|
|
416
|
+
}
|
|
417
|
+
export interface DimensionsClass extends JavaClass {
|
|
418
|
+
readonly MM_PER_INCH: number;
|
|
419
|
+
readonly POINTS_PER_MM: number;
|
|
420
|
+
readonly POINTS_PER_INCH: number;
|
|
421
|
+
readonly PIXELS_PER_POINT: number;
|
|
422
|
+
}
|
|
423
|
+
export const Dimensions: DimensionsClass;
|
|
424
|
+
|
|
425
|
+
/** The Java class `com.pd4ml.Dimensions.Units`. */
|
|
426
|
+
export interface Units extends JavaObject {
|
|
427
|
+
}
|
|
428
|
+
export interface UnitsClass extends JavaClass {
|
|
429
|
+
readonly MM: Units;
|
|
430
|
+
readonly PT: Units;
|
|
431
|
+
readonly PX: Units;
|
|
432
|
+
values(): Units[];
|
|
433
|
+
valueOf(name: string): Units;
|
|
434
|
+
}
|
|
435
|
+
export const Units: UnitsClass;
|
|
436
|
+
|
|
437
|
+
/** The Java class `com.pd4ml.PdfSpec`. */
|
|
438
|
+
export interface PdfSpec extends JavaObject {
|
|
439
|
+
/** `name` (a public field: `obj.$get('name')`) */
|
|
440
|
+
/** `id` (a public field: `obj.$get('id')`) */
|
|
441
|
+
/** `xid` (a public field: `obj.$get('xid')`) */
|
|
442
|
+
combine(spec: PdfSpec): PdfSpec;
|
|
443
|
+
withMinimumVersion(version: PdfSpec): PdfSpec;
|
|
444
|
+
isPdfa(): boolean;
|
|
445
|
+
isPdfa1(): boolean;
|
|
446
|
+
isPdfa1a(): boolean;
|
|
447
|
+
isPdfa1b(): boolean;
|
|
448
|
+
isPdfa2(): boolean;
|
|
449
|
+
isPdfa3(): boolean;
|
|
450
|
+
isPdfa12(): boolean;
|
|
451
|
+
isPdfa12a(): boolean;
|
|
452
|
+
isPdfa2u(): boolean;
|
|
453
|
+
isPdfa123(): boolean;
|
|
454
|
+
isPdfa123a(): boolean;
|
|
455
|
+
isPdfa23(): boolean;
|
|
456
|
+
isPdfa23a(): boolean;
|
|
457
|
+
isPdfa23b(): boolean;
|
|
458
|
+
isPdfa23u(): boolean;
|
|
459
|
+
isPdfa123b(): boolean;
|
|
460
|
+
isPdfa4e(): boolean;
|
|
461
|
+
isPdfa4f(): boolean;
|
|
462
|
+
isPdfa4(): boolean;
|
|
463
|
+
isPdfa1234(): boolean;
|
|
464
|
+
isPdfa234(): boolean;
|
|
465
|
+
isPdfua(): boolean;
|
|
466
|
+
isPdfua1(): boolean;
|
|
467
|
+
isPdfua2(): boolean;
|
|
468
|
+
allowsTransparency(): boolean;
|
|
469
|
+
allowsAttachments(): boolean;
|
|
470
|
+
allowsDocLevelAttachments(): boolean;
|
|
471
|
+
allowsEncryption(): boolean;
|
|
472
|
+
allowsPdfForms(): boolean;
|
|
473
|
+
requiresTagging(): boolean;
|
|
474
|
+
requiresColorspace(): boolean;
|
|
475
|
+
requiresMetadata(): boolean;
|
|
476
|
+
requiresOutputInternet(): boolean;
|
|
477
|
+
allowsExternalHyperlinking(): boolean;
|
|
478
|
+
requiresReliableUnicodeSemantics(): boolean;
|
|
479
|
+
getPdfVersionLabel(): string;
|
|
480
|
+
getPdfExtLevel(): number;
|
|
481
|
+
getPdfaVersion(): number;
|
|
482
|
+
getPdfuaVersion(): number;
|
|
483
|
+
}
|
|
484
|
+
export interface PdfSpecClass extends JavaClass {
|
|
485
|
+
new (spec: PdfSpec): PdfSpec;
|
|
486
|
+
readonly PDF_1_0: PdfSpec;
|
|
487
|
+
readonly PDF_1_1: PdfSpec;
|
|
488
|
+
readonly PDF_1_2: PdfSpec;
|
|
489
|
+
readonly PDF_1_3: PdfSpec;
|
|
490
|
+
readonly PDF_1_4: PdfSpec;
|
|
491
|
+
readonly PDF_1_5: PdfSpec;
|
|
492
|
+
readonly PDF_1_6: PdfSpec;
|
|
493
|
+
readonly PDF_1_7: PdfSpec;
|
|
494
|
+
readonly PDF_1_7_1: PdfSpec;
|
|
495
|
+
readonly PDF_1_7_2: PdfSpec;
|
|
496
|
+
readonly PDF_1_7_3: PdfSpec;
|
|
497
|
+
readonly PDF_1_7_4: PdfSpec;
|
|
498
|
+
readonly PDF_1_7_5: PdfSpec;
|
|
499
|
+
readonly PDF_1_7_6: PdfSpec;
|
|
500
|
+
readonly PDF_1_7_7: PdfSpec;
|
|
501
|
+
readonly PDF_1_7_8: PdfSpec;
|
|
502
|
+
readonly PDF_1_7_9: PdfSpec;
|
|
503
|
+
readonly PDF_1_7_10: PdfSpec;
|
|
504
|
+
readonly PDF_1_7_11: PdfSpec;
|
|
505
|
+
readonly PDF_2_0: PdfSpec;
|
|
506
|
+
readonly PDFA_1A: PdfSpec;
|
|
507
|
+
readonly PDFA_1B: PdfSpec;
|
|
508
|
+
readonly PDFA_2A: PdfSpec;
|
|
509
|
+
readonly PDFA_2B: PdfSpec;
|
|
510
|
+
readonly PDFA_2U: PdfSpec;
|
|
511
|
+
readonly PDFA_3A: PdfSpec;
|
|
512
|
+
readonly PDFA_3B: PdfSpec;
|
|
513
|
+
readonly PDFA_3U: PdfSpec;
|
|
514
|
+
readonly PDFA_4: PdfSpec;
|
|
515
|
+
readonly PDFA_4E: PdfSpec;
|
|
516
|
+
readonly PDFUA_1: PdfSpec;
|
|
517
|
+
readonly PDFUA_2: PdfSpec;
|
|
518
|
+
readonly ZUGFeRD: PdfSpec;
|
|
519
|
+
readonly ZUGFeRD_a: PdfSpec;
|
|
520
|
+
readonly FacturX: PdfSpec;
|
|
521
|
+
readonly FacturX_a: PdfSpec;
|
|
522
|
+
areCompatible(pdf: PdfSpec, pdfa1: PdfSpec, pdfa2: PdfSpec): boolean;
|
|
523
|
+
getByLabel(label: string): PdfSpec;
|
|
524
|
+
getInstance(label: string): PdfSpec;
|
|
525
|
+
getByID(id: number | JavaFloat): PdfSpec;
|
|
526
|
+
listKeywords(): string;
|
|
527
|
+
}
|
|
528
|
+
export const PdfSpec: PdfSpecClass;
|
|
529
|
+
|
|
530
|
+
/** The Java class `com.pd4ml.pdf.PdfDocumentBase`. */
|
|
531
|
+
export interface PdfDocumentBase extends JavaObject {
|
|
532
|
+
write(out: JavaObject): void;
|
|
533
|
+
write(out: JavaObject, password: string, permissions: number | JavaFloat): void;
|
|
534
|
+
append(toMerge: PdfDocumentBase): void;
|
|
535
|
+
overlay(anotherDoc: PdfDocumentBase, opacity: number | JavaFloat): void;
|
|
536
|
+
overlay(anotherDoc: PdfDocumentBase, srcScope: string, destScope: string, opacity: number | JavaFloat): void;
|
|
537
|
+
underlay(anotherDoc: PdfDocumentBase, opacity: number | JavaFloat): void;
|
|
538
|
+
underlay(anotherDoc: PdfDocumentBase, srcScope: string, destScope: string, opacity: number | JavaFloat): void;
|
|
539
|
+
getNumberOfPages(): number;
|
|
540
|
+
getPermissions(): number;
|
|
541
|
+
getTitle(): string;
|
|
542
|
+
setTitle(title: string): void;
|
|
543
|
+
getAuthor(): string;
|
|
544
|
+
setAuthor(author: string): void;
|
|
545
|
+
getPdfFormatVersion(): string;
|
|
546
|
+
getMetadata(): string;
|
|
547
|
+
getCreationDate(): string;
|
|
548
|
+
dumpOutlines(): string;
|
|
549
|
+
getKeywords(): string;
|
|
550
|
+
setKeywords(keywords: string): void;
|
|
551
|
+
getCreator(): string;
|
|
552
|
+
setCreator(creator: string): void;
|
|
553
|
+
getProducer(): string;
|
|
554
|
+
getSubject(): string;
|
|
555
|
+
setSubject(subject: string): void;
|
|
556
|
+
setModDate(): void;
|
|
557
|
+
getModDate(): string;
|
|
558
|
+
getPageSize(pageIndex: number | JavaFloat): PageSize;
|
|
559
|
+
getPageBox(pageIndex: number | JavaFloat, boxName: string): number[];
|
|
560
|
+
read(): void;
|
|
561
|
+
getPageContent(pageIndex: number | JavaFloat): string;
|
|
562
|
+
deletePage(pageNumber: number | JavaFloat): number;
|
|
563
|
+
}
|
|
564
|
+
export interface PdfDocumentBaseClass extends JavaClass {
|
|
565
|
+
computeScope(scope: string, pageNum: number | JavaFloat): boolean[];
|
|
566
|
+
}
|
|
567
|
+
export const PdfDocumentBase: PdfDocumentBaseClass;
|
|
568
|
+
|
|
569
|
+
/** The Java class `com.pd4ml.PdfDocument`. */
|
|
570
|
+
export interface PdfDocument extends PdfDocumentBase {
|
|
571
|
+
}
|
|
572
|
+
export interface PdfDocumentClass extends JavaClass {
|
|
573
|
+
new (bytes: Buffer | Uint8Array, password: string): PdfDocument;
|
|
574
|
+
new (stream: Buffer | Uint8Array | JavaObject, password: string): PdfDocument;
|
|
575
|
+
new (url: string | URL | JavaObject, password: string): PdfDocument;
|
|
576
|
+
new (writer: JavaObject): PdfDocument;
|
|
577
|
+
mergePDFs(pdf1: Buffer | Uint8Array | JavaObject, pdf2: Buffer | Uint8Array | JavaObject, result: JavaObject): void;
|
|
578
|
+
}
|
|
579
|
+
export const PdfDocument: PdfDocumentClass;
|
|
580
|
+
|
|
581
|
+
/** The Java interface `com.pd4ml.ProgressListener`. */
|
|
582
|
+
export interface ProgressListener extends JavaObject {
|
|
583
|
+
progressUpdate(arg0: number | JavaFloat, arg1: number | JavaFloat, arg2: string, arg3: number | JavaFloat): void;
|
|
584
|
+
}
|
|
585
|
+
export interface ProgressListenerClass extends JavaClass {
|
|
586
|
+
readonly CONVERSION_BEGIN: number;
|
|
587
|
+
readonly MAIN_DOC_READ: number;
|
|
588
|
+
readonly HTML_PARSED: number;
|
|
589
|
+
readonly RENDERER_TREE_BUILT: number;
|
|
590
|
+
readonly HTML_LAYOUT_IN_PROGRESS: number;
|
|
591
|
+
readonly HTML_LAYOUT_DONE: number;
|
|
592
|
+
readonly PAGEBREAKS_ALIGNED: number;
|
|
593
|
+
readonly TOC_GENERATED: number;
|
|
594
|
+
readonly DOC_RENDER_IN_PROGRESS: number;
|
|
595
|
+
readonly DOC_WRITE_BEGIN: number;
|
|
596
|
+
readonly CONVERSION_END: number;
|
|
597
|
+
readonly RTF_PRE_RENDER_DONE: number;
|
|
598
|
+
readonly DOCX_PRE_RENDER_DONE: number;
|
|
599
|
+
}
|
|
600
|
+
export const ProgressListener: ProgressListenerClass;
|
|
601
|
+
|
|
602
|
+
/** The Java class `com.pd4ml.ResourceProvider`. */
|
|
603
|
+
export interface ResourceProvider extends JavaObject {
|
|
604
|
+
/** `mime` (a public field: `obj.$get('mime')`) */
|
|
605
|
+
/** `redirected` (a public field: `obj.$get('redirected')`) */
|
|
606
|
+
getResourceAsStream(arg0: string, arg1: JavaObject): JavaObject;
|
|
607
|
+
canLoad(arg0: string, arg1: JavaObject): boolean;
|
|
608
|
+
dontCache(): boolean;
|
|
609
|
+
localFile(): JavaObject;
|
|
610
|
+
closeResourceStream(): void;
|
|
611
|
+
getResourceAsBytes(resource: string, cache: JavaObject): Buffer;
|
|
612
|
+
getMime(): string;
|
|
613
|
+
getEncoding(): string;
|
|
614
|
+
isDirectory(): boolean;
|
|
615
|
+
}
|
|
616
|
+
export interface ResourceProviderClass extends JavaClass {
|
|
617
|
+
}
|
|
618
|
+
export const ResourceProvider: ResourceProviderClass;
|
|
619
|
+
|
|
620
|
+
/** The Java class `com.pd4ml.CustomTag`. */
|
|
621
|
+
export interface CustomTag extends JavaObject {
|
|
622
|
+
getInstance(code: string, fontCache: JavaObject): CustomTag;
|
|
623
|
+
setElement(element: JavaObject): void;
|
|
624
|
+
getInnerCode(): string;
|
|
625
|
+
setInnerCode(code: string): void;
|
|
626
|
+
getWidth(base: number | JavaFloat): number;
|
|
627
|
+
getHeight(base: number | JavaFloat): number;
|
|
628
|
+
setWidth(width: number | JavaFloat): void;
|
|
629
|
+
setHeight(height: number | JavaFloat): void;
|
|
630
|
+
paint(x: number | JavaFloat, y: number | JavaFloat, width: number | JavaFloat, height: number | JavaFloat, containerWidth: number | JavaFloat, containerHeight: number | JavaFloat, g: JavaObject): void;
|
|
631
|
+
paint(x: number | JavaFloat, y: number | JavaFloat, g: JavaObject): void;
|
|
632
|
+
isEmptyTag(): boolean;
|
|
633
|
+
}
|
|
634
|
+
export interface CustomTagClass extends JavaClass {
|
|
635
|
+
new (): CustomTag;
|
|
636
|
+
new (code: string, fontCache: JavaObject, prime: CustomTag): CustomTag;
|
|
637
|
+
}
|
|
638
|
+
export const CustomTag: CustomTagClass;
|
|
639
|
+
|
|
640
|
+
/** The Java class `com.pd4ml.StatusMessage`. */
|
|
641
|
+
export interface StatusMessage extends JavaObject {
|
|
642
|
+
getDetails(): string;
|
|
643
|
+
setDetails(details: string): void;
|
|
644
|
+
isError(): boolean;
|
|
645
|
+
isWarning(): boolean;
|
|
646
|
+
getMessage(): string;
|
|
647
|
+
}
|
|
648
|
+
export interface StatusMessageClass extends JavaClass {
|
|
649
|
+
new (type: number | JavaFloat, id: number | JavaFloat, message: string): StatusMessage;
|
|
650
|
+
readonly WARNING: number;
|
|
651
|
+
readonly ERROR: number;
|
|
652
|
+
getMessage(id: number | JavaFloat, details: string): StatusMessage;
|
|
653
|
+
addUniqueMessage(statusMessages: JavaObject, message: StatusMessage): boolean;
|
|
654
|
+
}
|
|
655
|
+
export const StatusMessage: StatusMessageClass;
|