@ironsoftware/ironpdf 2026.3.1 → 2026.5.1
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/package.json +3 -3
- package/src/index.d.ts +3 -0
- package/src/index.d.ts.map +1 -1
- package/src/index.js +6 -2
- package/src/index.js.map +1 -1
- package/src/index.ts +4 -2
- package/src/internal/IronPdfEngine.ProtoFiles/chrome_render.proto +6 -0
- package/src/internal/IronPdfEngine.ProtoFiles/iron_pdf_service.proto +2 -1
- package/src/internal/IronPdfEngine.ProtoFiles/qpdf.proto +16 -0
- package/src/internal/generated_proto/iron_pdf_service.d.ts +614 -305
- package/src/internal/generated_proto/iron_pdf_service.d.ts.map +1 -1
- package/src/internal/generated_proto/iron_pdf_service.ts +614 -305
- package/src/internal/generated_proto/ironpdfengineproto/ChromePdfRenderOptionsP.d.ts +15 -0
- package/src/internal/generated_proto/ironpdfengineproto/ChromePdfRenderOptionsP.d.ts.map +1 -1
- package/src/internal/generated_proto/ironpdfengineproto/ChromePdfRenderOptionsP.ts +15 -0
- package/src/internal/generated_proto/ironpdfengineproto/IronPdfService.d.ts +14 -0
- package/src/internal/generated_proto/ironpdfengineproto/IronPdfService.d.ts.map +1 -1
- package/src/internal/generated_proto/ironpdfengineproto/IronPdfService.ts +18 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestIdP.d.ts +10 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestIdP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestIdP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestIdP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestIdP.ts +13 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestStreamP.d.ts +18 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestStreamP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestStreamP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestStreamP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestStreamP.ts +21 -0
- package/src/internal/grpc_layer/chrome/converter.d.ts +10 -0
- package/src/internal/grpc_layer/chrome/converter.d.ts.map +1 -1
- package/src/internal/grpc_layer/chrome/converter.js +61 -2
- package/src/internal/grpc_layer/chrome/converter.js.map +1 -1
- package/src/internal/grpc_layer/chrome/converter.ts +67 -0
- package/src/internal/grpc_layer/pdfium/annotations.d.ts +30 -0
- package/src/internal/grpc_layer/pdfium/annotations.d.ts.map +1 -0
- package/src/internal/grpc_layer/pdfium/annotations.js +161 -0
- package/src/internal/grpc_layer/pdfium/annotations.js.map +1 -0
- package/src/internal/grpc_layer/pdfium/annotations.ts +190 -0
- package/src/internal/grpc_layer/pdfium/bookmarks.d.ts +7 -0
- package/src/internal/grpc_layer/pdfium/bookmarks.d.ts.map +1 -0
- package/src/internal/grpc_layer/pdfium/bookmarks.js +53 -0
- package/src/internal/grpc_layer/pdfium/bookmarks.js.map +1 -0
- package/src/internal/grpc_layer/pdfium/bookmarks.ts +50 -0
- package/src/internal/grpc_layer/pdfium/compress.d.ts +1 -0
- package/src/internal/grpc_layer/pdfium/compress.d.ts.map +1 -1
- package/src/internal/grpc_layer/pdfium/compress.js +31 -1
- package/src/internal/grpc_layer/pdfium/compress.js.map +1 -1
- package/src/internal/grpc_layer/pdfium/compress.ts +42 -0
- package/src/internal/grpc_layer/pdfium/linearize.d.ts +48 -0
- package/src/internal/grpc_layer/pdfium/linearize.d.ts.map +1 -0
- package/src/internal/grpc_layer/pdfium/linearize.js +309 -0
- package/src/internal/grpc_layer/pdfium/linearize.js.map +1 -0
- package/src/internal/grpc_layer/pdfium/linearize.ts +338 -0
- package/src/internal/grpc_layer/pdfium/pdfa.d.ts +1 -0
- package/src/internal/grpc_layer/pdfium/pdfa.d.ts.map +1 -1
- package/src/internal/grpc_layer/pdfium/pdfa.js +22 -1
- package/src/internal/grpc_layer/pdfium/pdfa.js.map +1 -1
- package/src/internal/grpc_layer/pdfium/pdfa.ts +26 -0
- package/src/internal/grpc_layer/pdfium/signing.d.ts +2 -1
- package/src/internal/grpc_layer/pdfium/signing.d.ts.map +1 -1
- package/src/internal/grpc_layer/pdfium/signing.js +38 -1
- package/src/internal/grpc_layer/pdfium/signing.js.map +1 -1
- package/src/internal/grpc_layer/pdfium/signing.ts +44 -1
- package/src/internal/zod/renderSchema.d.ts.map +1 -1
- package/src/internal/zod/renderSchema.js +6 -1
- package/src/internal/zod/renderSchema.js.map +1 -1
- package/src/internal/zod/renderSchema.ts +6 -1
- package/src/public/annotation.d.ts +166 -0
- package/src/public/annotation.d.ts.map +1 -0
- package/src/public/annotation.js +61 -0
- package/src/public/annotation.js.map +1 -0
- package/src/public/annotation.ts +166 -0
- package/src/public/bookmark.d.ts +25 -0
- package/src/public/bookmark.d.ts.map +1 -0
- package/src/public/bookmark.js +3 -0
- package/src/public/bookmark.js.map +1 -0
- package/src/public/bookmark.ts +28 -0
- package/src/public/pdfDocument.d.ts +194 -2
- package/src/public/pdfDocument.d.ts.map +1 -1
- package/src/public/pdfDocument.js +388 -1
- package/src/public/pdfDocument.js.map +1 -1
- package/src/public/pdfDocument.ts +427 -4
- package/src/public/render.d.ts +104 -0
- package/src/public/render.d.ts.map +1 -1
- package/src/public/render.js +35 -1
- package/src/public/render.js.map +1 -1
- package/src/public/render.ts +101 -0
- package/src/public/signature.d.ts +33 -0
- package/src/public/signature.d.ts.map +1 -1
- package/src/public/signature.ts +34 -0
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
BarcodeType, ChangeTrackingModes,
|
|
5
5
|
ChromePdfRenderOptions,
|
|
6
6
|
DigitalSignature,
|
|
7
|
+
VerifiedSignature,
|
|
7
8
|
HtmlAffix,
|
|
8
9
|
HtmlFilePath,
|
|
9
10
|
HtmlStampOptions,
|
|
@@ -14,12 +15,14 @@ import {
|
|
|
14
15
|
ImageStampOptions,
|
|
15
16
|
ImageToPdfOptions,
|
|
16
17
|
ImageType,
|
|
18
|
+
LinearizationMode,
|
|
17
19
|
PageInfo,
|
|
18
20
|
PageRotation,
|
|
19
21
|
PdfInput,
|
|
20
22
|
PdfPageSelection,
|
|
21
23
|
PdfPaperSize,
|
|
22
24
|
PdfPassword, PdfPermission,
|
|
25
|
+
RenderedElementLocation,
|
|
23
26
|
SaveOptions,
|
|
24
27
|
TextAffix,
|
|
25
28
|
TextStampOptions,
|
|
@@ -64,7 +67,17 @@ import {mergePdfs, renderHtmlToPdf, renderHtmlZipToPdf, renderUrlToPdf, renderHt
|
|
|
64
67
|
import {disposePdf, getBinaryData, openPdfFileBuffer} from "../internal/grpc_layer/pdfium/io";
|
|
65
68
|
import {Access} from "../internal/access";
|
|
66
69
|
import {renderImagesBufferToPdf, renderImagesFilesToPdf} from "../internal/grpc_layer/chrome/image";
|
|
67
|
-
import {compressImage, compressInMemory, compressInMemoryStream, compressStructTree} from "../internal/grpc_layer/pdfium/compress";
|
|
70
|
+
import {compressAndSaveAs, compressImage, compressInMemory, compressInMemoryStream, compressStructTree} from "../internal/grpc_layer/pdfium/compress";
|
|
71
|
+
import {
|
|
72
|
+
isLinearizedFromBytes,
|
|
73
|
+
linearizeCoreFromBytes,
|
|
74
|
+
linearizeCoreFromId,
|
|
75
|
+
linearizeInMemoryFromIdStream
|
|
76
|
+
} from "../internal/grpc_layer/pdfium/linearize";
|
|
77
|
+
import {addLinkAnnotation, getAnnotationCount, getAnnotations} from "../internal/grpc_layer/pdfium/annotations";
|
|
78
|
+
import {LinkAnnotation} from "./annotation";
|
|
79
|
+
import {getBookmarks} from "../internal/grpc_layer/pdfium/bookmarks";
|
|
80
|
+
import {Bookmark} from "./bookmark";
|
|
68
81
|
import {Readable} from "stream";
|
|
69
82
|
import {
|
|
70
83
|
duplicate,
|
|
@@ -77,9 +90,9 @@ import {
|
|
|
77
90
|
import {extractRawImages, rasterizeToImageBuffers} from "../internal/grpc_layer/pdfium/image";
|
|
78
91
|
import Jimp from "jimp";
|
|
79
92
|
import {extractAllText, replaceText} from "../internal/grpc_layer/pdfium/text";
|
|
80
|
-
import {PdfAVersions, PdfUAVersions, toPdfA, toPdfUA} from "../internal/grpc_layer/pdfium/pdfa";
|
|
93
|
+
import {PdfAVersions, PdfUAVersions, toPdfA, toPdfUA, toPdfUAForScreenReader} from "../internal/grpc_layer/pdfium/pdfa";
|
|
81
94
|
import {getMetadataDict, removeMetadata, setMetadata, setMetadataDict} from "../internal/grpc_layer/pdfium/metadata";
|
|
82
|
-
import {getSignatureCount, signPdf} from "../internal/grpc_layer/pdfium/signing";
|
|
95
|
+
import {getSignatureCount, getVerifiedSignatures, signPdf} from "../internal/grpc_layer/pdfium/signing";
|
|
83
96
|
import {addHtmlAffix, addTextAffix} from "../internal/grpc_layer/pdfium/headerFooter";
|
|
84
97
|
import {stampBarcode, stampHtml, stampImage, stampText} from "../internal/grpc_layer/chrome/stamp";
|
|
85
98
|
import {addBackgroundForeground} from "../internal/grpc_layer/pdfium/BackgroundForeground";
|
|
@@ -373,7 +386,8 @@ export class PdfDocument{
|
|
|
373
386
|
|
|
374
387
|
//#region compress
|
|
375
388
|
/**
|
|
376
|
-
* Compress existing PDF images using JPG encoding and the specified settings
|
|
389
|
+
* Compress existing PDF images using JPG encoding and the specified settings.
|
|
390
|
+
* @deprecated Use {@link compressAndSaveAs}, {@link compressPdfToBytes}, or {@link compressPdfToStream} instead for better compression results.
|
|
377
391
|
* @param imageQuality Quality (1 - 100) to use during compression
|
|
378
392
|
* @param scaleToVisibleSize Scale down the image resolution according to its visible size in the PDF document
|
|
379
393
|
*/
|
|
@@ -437,6 +451,233 @@ export class PdfDocument{
|
|
|
437
451
|
(imageQuality);
|
|
438
452
|
}
|
|
439
453
|
|
|
454
|
+
/**
|
|
455
|
+
* Compress the PDF and save the result directly to a file.
|
|
456
|
+
* Uses QPdf compression which can significantly reduce file size.
|
|
457
|
+
* @param filePath The output file path to save the compressed PDF.
|
|
458
|
+
* @param imageQuality Optional JPEG quality (1-100) for image compression. If omitted, default compression is applied.
|
|
459
|
+
*/
|
|
460
|
+
public async compressAndSaveAs(
|
|
461
|
+
filePath: string,
|
|
462
|
+
imageQuality?: number
|
|
463
|
+
): Promise<void> {
|
|
464
|
+
return await z.function()
|
|
465
|
+
.args(
|
|
466
|
+
stringSchema,
|
|
467
|
+
numberSchema.optional()
|
|
468
|
+
)
|
|
469
|
+
.returns(z.promise(z.void()))
|
|
470
|
+
.implement(this.internal_compressAndSaveAs.bind(this))
|
|
471
|
+
(filePath, imageQuality);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
//#endregion
|
|
475
|
+
|
|
476
|
+
//#region linearize
|
|
477
|
+
/**
|
|
478
|
+
* Linearize the current PDF document and return the result as a {@link Buffer} (byte array).
|
|
479
|
+
* Produces a web-optimized PDF that can be viewed incrementally in a browser.
|
|
480
|
+
*
|
|
481
|
+
* @param mode Linearization strategy. Defaults to {@link LinearizationMode.Automatic}.
|
|
482
|
+
* @returns A Promise resolving to a Buffer containing the linearized PDF bytes.
|
|
483
|
+
*/
|
|
484
|
+
public async linearizePdfToBytes(
|
|
485
|
+
mode: LinearizationMode = LinearizationMode.Automatic
|
|
486
|
+
): Promise<Buffer> {
|
|
487
|
+
return this.internal_linearizePdfToBytes(mode);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Linearize the current PDF document and return the result as a {@link Readable} stream.
|
|
492
|
+
* Useful for piping directly to file streams or HTTP responses without buffering the
|
|
493
|
+
* entire PDF in memory.
|
|
494
|
+
*
|
|
495
|
+
* <b>Note:</b> Stream output is only supported with {@link LinearizationMode.InMemory}
|
|
496
|
+
* (or {@link LinearizationMode.Automatic} when memory mode is selected). For
|
|
497
|
+
* {@link LinearizationMode.FileBased} use {@link linearizePdfToBytes} or
|
|
498
|
+
* {@link saveAsLinearized}.
|
|
499
|
+
*
|
|
500
|
+
* @returns A Promise resolving to a Readable stream of the linearized PDF bytes.
|
|
501
|
+
*/
|
|
502
|
+
public async linearizePdfToStream(): Promise<Readable> {
|
|
503
|
+
return this.internal_linearizePdfToStream();
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Linearize the current PDF document and save the result to the given output file path.
|
|
508
|
+
*
|
|
509
|
+
* @param outputFilePath The file path to save the linearized PDF.
|
|
510
|
+
* @param mode Linearization strategy. Defaults to {@link LinearizationMode.Automatic}.
|
|
511
|
+
*/
|
|
512
|
+
public async saveAsLinearized(
|
|
513
|
+
outputFilePath: string,
|
|
514
|
+
mode: LinearizationMode = LinearizationMode.Automatic
|
|
515
|
+
): Promise<void> {
|
|
516
|
+
return await z.function()
|
|
517
|
+
.args(filePathSchema, z.nativeEnum(LinearizationMode).optional())
|
|
518
|
+
.returns(z.promise(z.void()))
|
|
519
|
+
.implement(async (filePath: string, m?: LinearizationMode): Promise<void> => {
|
|
520
|
+
return this.internal_saveAsLinearized(filePath, m ?? LinearizationMode.Automatic);
|
|
521
|
+
})
|
|
522
|
+
(outputFilePath, mode);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Check whether the PDF file at the given path is linearized ("Fast Web View").
|
|
527
|
+
*
|
|
528
|
+
* @param pdfFilePath Path to a PDF file on disk.
|
|
529
|
+
* @param password Optional password for encrypted PDFs.
|
|
530
|
+
* @returns A Promise resolving to true if the file is linearized, false otherwise.
|
|
531
|
+
*/
|
|
532
|
+
public static async isLinearized(
|
|
533
|
+
pdfFilePath: string,
|
|
534
|
+
password = ""
|
|
535
|
+
): Promise<boolean> {
|
|
536
|
+
return await z.function()
|
|
537
|
+
.args(pdfFilePathSchema, stringSchema.optional())
|
|
538
|
+
.returns(z.promise(booleanSchema))
|
|
539
|
+
.implement(async (filePath: string, pwd?: string): Promise<boolean> => {
|
|
540
|
+
const bytes = fs.readFileSync(filePath);
|
|
541
|
+
return await isLinearizedFromBytes(bytes, pwd ?? "");
|
|
542
|
+
})
|
|
543
|
+
(pdfFilePath, password);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Linearize the given PDF bytes and return the linearized bytes.
|
|
548
|
+
* Static helper for linearizing PDFs without creating a PdfDocument instance.
|
|
549
|
+
*
|
|
550
|
+
* @param pdfBytes Buffer containing the PDF data.
|
|
551
|
+
* @param password Optional password to decrypt the PDF if encrypted.
|
|
552
|
+
* @param mode Linearization strategy. Defaults to {@link LinearizationMode.Automatic}.
|
|
553
|
+
*/
|
|
554
|
+
public static async linearizePdfBytesToBytes(
|
|
555
|
+
pdfBytes: Buffer,
|
|
556
|
+
password = "",
|
|
557
|
+
mode: LinearizationMode = LinearizationMode.Automatic
|
|
558
|
+
): Promise<Buffer> {
|
|
559
|
+
return await z.function()
|
|
560
|
+
.args(bufferSchema, stringSchema.optional(), z.nativeEnum(LinearizationMode).optional())
|
|
561
|
+
.returns(z.promise(z.instanceof(Buffer)))
|
|
562
|
+
.implement(async (bytes: Buffer, pwd?: string, m?: LinearizationMode): Promise<Buffer> => {
|
|
563
|
+
return await linearizeCoreFromBytes(bytes, pwd ?? "", m ?? LinearizationMode.Automatic);
|
|
564
|
+
})
|
|
565
|
+
(pdfBytes, password, mode);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Linearize the given PDF bytes and save the result to the given output file path.
|
|
570
|
+
* Static helper for linearizing PDFs without creating a PdfDocument instance.
|
|
571
|
+
*
|
|
572
|
+
* @param pdfBytes Buffer containing the PDF data.
|
|
573
|
+
* @param outputFilePath The file path to save the linearized PDF.
|
|
574
|
+
* @param password Optional password to decrypt the PDF if encrypted.
|
|
575
|
+
* @param mode Linearization strategy. Defaults to {@link LinearizationMode.Automatic}.
|
|
576
|
+
*/
|
|
577
|
+
public static async saveAsLinearizedFromBytes(
|
|
578
|
+
pdfBytes: Buffer,
|
|
579
|
+
outputFilePath: string,
|
|
580
|
+
password = "",
|
|
581
|
+
mode: LinearizationMode = LinearizationMode.Automatic
|
|
582
|
+
): Promise<void> {
|
|
583
|
+
return await z.function()
|
|
584
|
+
.args(bufferSchema, filePathSchema, stringSchema.optional(), z.nativeEnum(LinearizationMode).optional())
|
|
585
|
+
.returns(z.promise(z.void()))
|
|
586
|
+
.implement(async (bytes: Buffer, filePath: string, pwd?: string, m?: LinearizationMode): Promise<void> => {
|
|
587
|
+
const linearized = await linearizeCoreFromBytes(bytes, pwd ?? "", m ?? LinearizationMode.Automatic);
|
|
588
|
+
fs.writeFileSync(filePath, linearized);
|
|
589
|
+
})
|
|
590
|
+
(pdfBytes, outputFilePath, password, mode);
|
|
591
|
+
}
|
|
592
|
+
//#endregion
|
|
593
|
+
|
|
594
|
+
//#region elementLocations
|
|
595
|
+
/**
|
|
596
|
+
* Retrieves the rendered page locations of HTML elements that were tracked during rendering.
|
|
597
|
+
*
|
|
598
|
+
* To use this feature, set {@link ChromePdfRenderOptions.elementQuerySelectors} with CSS
|
|
599
|
+
* selectors before rendering. After rendering, call this method to retrieve the page index
|
|
600
|
+
* and coordinates of each matched element.
|
|
601
|
+
*
|
|
602
|
+
* Results are cached on first call and reused on subsequent calls. If you modify the
|
|
603
|
+
* document's annotations after rendering, call {@link resetElementLocationCache} to force
|
|
604
|
+
* the cache to be rebuilt on next access.
|
|
605
|
+
*
|
|
606
|
+
* Mirrors {@code IronPdf.PdfDocument.GetElementLocations()} on the C# side.
|
|
607
|
+
*
|
|
608
|
+
* @returns A list of {@link RenderedElementLocation} objects, one per matched element,
|
|
609
|
+
* sorted in document order. Returns an empty list if no element query selectors were
|
|
610
|
+
* configured or no elements matched.
|
|
611
|
+
*/
|
|
612
|
+
public async getElementLocations(): Promise<RenderedElementLocation[]> {
|
|
613
|
+
return this.internal_getElementLocations();
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Clears the cached result of {@link getElementLocations}, forcing a fresh scan of the
|
|
618
|
+
* document's annotations on the next call. Call this if you've modified the document's
|
|
619
|
+
* annotations or structure after rendering.
|
|
620
|
+
*/
|
|
621
|
+
public resetElementLocationCache(): void {
|
|
622
|
+
this.cachedElementLocations = null;
|
|
623
|
+
}
|
|
624
|
+
//#endregion
|
|
625
|
+
|
|
626
|
+
//#region bookmarks
|
|
627
|
+
/**
|
|
628
|
+
* Retrieves all outline bookmarks (table-of-contents entries) in this PDF document.
|
|
629
|
+
*
|
|
630
|
+
* <p>Bookmarks are returned as a flat list with parent linkage via
|
|
631
|
+
* {@link Bookmark.parentItemId}. Roots have an empty {@code parentItemId}.
|
|
632
|
+
* Use {@link Bookmark.hierarchy} for depth information.</p>
|
|
633
|
+
*
|
|
634
|
+
* <p>Auto-bookmarks generated from HTML headings (via
|
|
635
|
+
* {@link ChromePdfRenderOptions.autoBookmarksFromHeadings}) are included.</p>
|
|
636
|
+
*
|
|
637
|
+
* <p>Mirrors {@code IronPdf.PdfDocument.Bookmarks} on the C# side.</p>
|
|
638
|
+
*
|
|
639
|
+
* @returns A list of {@link Bookmark} objects, sorted in document order.
|
|
640
|
+
* Returns an empty list if the document has no bookmarks.
|
|
641
|
+
*/
|
|
642
|
+
public async getBookmarks(): Promise<Bookmark[]> {
|
|
643
|
+
return this.internal_getBookmarks();
|
|
644
|
+
}
|
|
645
|
+
//#endregion
|
|
646
|
+
|
|
647
|
+
//#region annotation
|
|
648
|
+
/**
|
|
649
|
+
* Adds a clickable internal hyperlink annotation that navigates to another page within
|
|
650
|
+
* the same PDF document. Useful for building custom tables of contents, cross-references,
|
|
651
|
+
* and in-document navigation.
|
|
652
|
+
*
|
|
653
|
+
* The target page and display options are configured via the {@link LinkAnnotation}
|
|
654
|
+
* fields ({@code destinationPageIndex}, {@code destinationType}, etc.).
|
|
655
|
+
*
|
|
656
|
+
* Mirrors {@code IronPdf.Annotations.LinkAnnotation} on the C# side.
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```ts
|
|
660
|
+
* await pdf.addLinkAnnotation({
|
|
661
|
+
* pageIndex: 0,
|
|
662
|
+
* destinationPageIndex: 3,
|
|
663
|
+
* x: 72, y: 700,
|
|
664
|
+
* width: 300, height: 18,
|
|
665
|
+
* contents: "Chapter 1",
|
|
666
|
+
* });
|
|
667
|
+
* ```
|
|
668
|
+
*/
|
|
669
|
+
public async addLinkAnnotation(link: LinkAnnotation): Promise<void> {
|
|
670
|
+
return this.internal_addLinkAnnotation(link);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Retrieves the number of annotations contained on the specified page.
|
|
675
|
+
*
|
|
676
|
+
* @param pageIndex Zero-based page index. The first page has a page index of 0.
|
|
677
|
+
*/
|
|
678
|
+
public async getAnnotationCount(pageIndex: number): Promise<number> {
|
|
679
|
+
return this.internal_getAnnotationCount(pageIndex);
|
|
680
|
+
}
|
|
440
681
|
//#endregion
|
|
441
682
|
|
|
442
683
|
//#region page
|
|
@@ -713,6 +954,25 @@ export class PdfDocument{
|
|
|
713
954
|
(pdfaVersion, customICC);
|
|
714
955
|
}
|
|
715
956
|
|
|
957
|
+
/**
|
|
958
|
+
* Render HTML to PDF and convert to PDF/UA format with screen reader support.
|
|
959
|
+
* Produces a proper semantic structure tree (Sect → H1, P, etc.) for accessibility.
|
|
960
|
+
* @param html The HTML string to render
|
|
961
|
+
* @param naturalLanguages Document language for screen readers (default: English)
|
|
962
|
+
* @param options Optional render options
|
|
963
|
+
*/
|
|
964
|
+
public static async fromHtmlAsPdfUA(
|
|
965
|
+
html: string,
|
|
966
|
+
naturalLanguages: NaturalLanguages = NaturalLanguages.English,
|
|
967
|
+
options?: {
|
|
968
|
+
renderOptions?: ChromePdfRenderOptions | undefined;
|
|
969
|
+
} | undefined
|
|
970
|
+
): Promise<PdfDocument> {
|
|
971
|
+
const pdf = await PdfDocument.fromHtml(html, options);
|
|
972
|
+
await toPdfUAForScreenReader(await pdf.internal_getId(), html, naturalLanguages);
|
|
973
|
+
return pdf;
|
|
974
|
+
}
|
|
975
|
+
|
|
716
976
|
/**
|
|
717
977
|
* Convert the current document into the specified PDF/UA standard format
|
|
718
978
|
*/
|
|
@@ -805,6 +1065,15 @@ export class PdfDocument{
|
|
|
805
1065
|
return this.internal_signatureCount()
|
|
806
1066
|
}
|
|
807
1067
|
|
|
1068
|
+
/**
|
|
1069
|
+
* Get all verified digital signatures from this PdfDocument.
|
|
1070
|
+
* Returns details including signature name, signer contact, reason, location, date, and validity.
|
|
1071
|
+
* @returns A Promise resolving to an array of {@link VerifiedSignature} objects.
|
|
1072
|
+
*/
|
|
1073
|
+
public async getVerifiedSignatures(): Promise<VerifiedSignature[]> {
|
|
1074
|
+
return this.internal_getVerifiedSignatures()
|
|
1075
|
+
}
|
|
1076
|
+
|
|
808
1077
|
//#endregion
|
|
809
1078
|
|
|
810
1079
|
//#region header/footer (affix)
|
|
@@ -1549,6 +1818,153 @@ export class PdfDocument{
|
|
|
1549
1818
|
);
|
|
1550
1819
|
}
|
|
1551
1820
|
|
|
1821
|
+
/**
|
|
1822
|
+
* Compress the PDF and save the result directly to a file.
|
|
1823
|
+
* Uses QPdf compression which can significantly reduce file size.
|
|
1824
|
+
* @param filePath The output file path to save the compressed PDF.
|
|
1825
|
+
* @param imageQuality Optional JPEG quality (1-100) for image compression. If omitted, default compression is applied.
|
|
1826
|
+
*/
|
|
1827
|
+
private async internal_compressAndSaveAs(
|
|
1828
|
+
filePath: string,
|
|
1829
|
+
imageQuality?: number
|
|
1830
|
+
): Promise<void> {
|
|
1831
|
+
if (imageQuality !== undefined && (imageQuality < 1 || imageQuality > 100))
|
|
1832
|
+
throw new Error(
|
|
1833
|
+
`Invalid quality specifier (${imageQuality}) when compressing PDF. Quality must be between 1 and 100.`
|
|
1834
|
+
);
|
|
1835
|
+
return await compressAndSaveAs(
|
|
1836
|
+
await this.internal_getId(),
|
|
1837
|
+
filePath,
|
|
1838
|
+
imageQuality
|
|
1839
|
+
);
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
//#endregion
|
|
1843
|
+
|
|
1844
|
+
//#region linearize
|
|
1845
|
+
/**
|
|
1846
|
+
* Linearize the current PDF document and return the result as a Buffer.
|
|
1847
|
+
*/
|
|
1848
|
+
private async internal_linearizePdfToBytes(mode: LinearizationMode): Promise<Buffer> {
|
|
1849
|
+
const id = await this.internal_getId();
|
|
1850
|
+
return await linearizeCoreFromId(id, () => this.internal_saveAsBuffer(), "", mode);
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
/**
|
|
1854
|
+
* Linearize the current PDF document and return the result as a Readable stream.
|
|
1855
|
+
* Always uses the in-memory streaming RPC.
|
|
1856
|
+
*/
|
|
1857
|
+
private async internal_linearizePdfToStream(): Promise<Readable> {
|
|
1858
|
+
return await linearizeInMemoryFromIdStream(await this.internal_getId());
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
/**
|
|
1862
|
+
* Linearize the current PDF document and save the result to the given output file path.
|
|
1863
|
+
*/
|
|
1864
|
+
private async internal_saveAsLinearized(outputFilePath: string, mode: LinearizationMode): Promise<void> {
|
|
1865
|
+
const id = await this.internal_getId();
|
|
1866
|
+
const linearized = await linearizeCoreFromId(id, () => this.internal_saveAsBuffer(), "", mode);
|
|
1867
|
+
fs.writeFileSync(outputFilePath, linearized);
|
|
1868
|
+
}
|
|
1869
|
+
//#endregion
|
|
1870
|
+
|
|
1871
|
+
//#region elementLocations
|
|
1872
|
+
/**
|
|
1873
|
+
* Prefix used by the engine-side element query JavaScript extension when injecting anchor
|
|
1874
|
+
* markers. Must match {@code IronPdf.TableOfContents.ElementQueryJavascriptExtension.ELEMENT_QUERY_PREFIX}
|
|
1875
|
+
* on the C# side.
|
|
1876
|
+
*/
|
|
1877
|
+
private static readonly ELEMENT_QUERY_PREFIX = "ironpdf-elq-";
|
|
1878
|
+
|
|
1879
|
+
/**
|
|
1880
|
+
* Cache for {@link getElementLocations}. Built lazily on first call.
|
|
1881
|
+
*
|
|
1882
|
+
* The underlying element-query anchor annotations are written during rendering and are
|
|
1883
|
+
* not expected to be mutated afterwards, so a simple populate-once cache is appropriate.
|
|
1884
|
+
* Callers who modify the document's annotations after rendering should call
|
|
1885
|
+
* {@link resetElementLocationCache} to force a rebuild.
|
|
1886
|
+
*/
|
|
1887
|
+
private cachedElementLocations: RenderedElementLocation[] | null = null;
|
|
1888
|
+
|
|
1889
|
+
private async internal_getElementLocations(): Promise<RenderedElementLocation[]> {
|
|
1890
|
+
if (this.cachedElementLocations !== null) {
|
|
1891
|
+
return this.cachedElementLocations;
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
const id = await this.internal_getId();
|
|
1895
|
+
const pageInfos = await getPageInfo(id);
|
|
1896
|
+
const locations: RenderedElementLocation[] = [];
|
|
1897
|
+
|
|
1898
|
+
for (let pageIdx = 0; pageIdx < pageInfos.length; pageIdx++) {
|
|
1899
|
+
const annotations = await getAnnotations(id, pageIdx);
|
|
1900
|
+
|
|
1901
|
+
for (const wrapped of annotations) {
|
|
1902
|
+
if (!wrapped.link) continue;
|
|
1903
|
+
const dest = wrapped.link.dest;
|
|
1904
|
+
if (!dest || !dest.startsWith(PdfDocument.ELEMENT_QUERY_PREFIX)) continue;
|
|
1905
|
+
|
|
1906
|
+
const remainder = dest.substring(PdfDocument.ELEMENT_QUERY_PREFIX.length);
|
|
1907
|
+
const dashIdx = remainder.indexOf("-");
|
|
1908
|
+
if (dashIdx <= 0) continue;
|
|
1909
|
+
|
|
1910
|
+
const indexStr = remainder.substring(0, dashIdx);
|
|
1911
|
+
const elementIndex = parseInt(indexStr, 10);
|
|
1912
|
+
if (isNaN(elementIndex)) continue;
|
|
1913
|
+
|
|
1914
|
+
const encodedText = remainder.substring(dashIdx + 1);
|
|
1915
|
+
let text: string;
|
|
1916
|
+
try {
|
|
1917
|
+
text = decodeURIComponent(encodedText);
|
|
1918
|
+
} catch {
|
|
1919
|
+
text = encodedText;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
const innerRect = wrapped.link.annotation?.rectangle;
|
|
1923
|
+
const rectangle = innerRect
|
|
1924
|
+
? {
|
|
1925
|
+
x: innerRect.x ?? 0,
|
|
1926
|
+
y: innerRect.y ?? 0,
|
|
1927
|
+
width: innerRect.width ?? 0,
|
|
1928
|
+
height: innerRect.height ?? 0,
|
|
1929
|
+
}
|
|
1930
|
+
: {x: 0, y: 0, width: 0, height: 0};
|
|
1931
|
+
|
|
1932
|
+
locations.push({text, pageIndex: pageIdx, rectangle, elementIndex});
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
locations.sort((a, b) => a.elementIndex - b.elementIndex);
|
|
1937
|
+
this.cachedElementLocations = locations;
|
|
1938
|
+
return this.cachedElementLocations;
|
|
1939
|
+
}
|
|
1940
|
+
//#endregion
|
|
1941
|
+
|
|
1942
|
+
//#region annotation
|
|
1943
|
+
private async internal_addLinkAnnotation(link: LinkAnnotation): Promise<void> {
|
|
1944
|
+
if (!link) {
|
|
1945
|
+
throw new Error("link annotation cannot be null or undefined");
|
|
1946
|
+
}
|
|
1947
|
+
if (link.pageIndex < 0) {
|
|
1948
|
+
throw new Error("Invalid page index when adding link annotation");
|
|
1949
|
+
}
|
|
1950
|
+
if (link.destinationPageIndex < 0) {
|
|
1951
|
+
throw new Error("Invalid destination page index when adding link annotation");
|
|
1952
|
+
}
|
|
1953
|
+
await addLinkAnnotation(await this.internal_getId(), link);
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
private async internal_getAnnotationCount(pageIndex: number): Promise<number> {
|
|
1957
|
+
if (pageIndex < 0) {
|
|
1958
|
+
throw new Error("Invalid page index when getting annotation count");
|
|
1959
|
+
}
|
|
1960
|
+
return await getAnnotationCount(await this.internal_getId(), pageIndex);
|
|
1961
|
+
}
|
|
1962
|
+
//#endregion
|
|
1963
|
+
|
|
1964
|
+
//#region bookmarks
|
|
1965
|
+
private async internal_getBookmarks(): Promise<Bookmark[]> {
|
|
1966
|
+
return await getBookmarks(await this.internal_getId());
|
|
1967
|
+
}
|
|
1552
1968
|
//#endregion
|
|
1553
1969
|
|
|
1554
1970
|
//#region page
|
|
@@ -1875,6 +2291,13 @@ export class PdfDocument{
|
|
|
1875
2291
|
return await getSignatureCount(await this.internal_getId());
|
|
1876
2292
|
}
|
|
1877
2293
|
|
|
2294
|
+
/**
|
|
2295
|
+
* Get all verified digital signatures from this PdfDocument.
|
|
2296
|
+
*/
|
|
2297
|
+
private async internal_getVerifiedSignatures(): Promise<VerifiedSignature[]> {
|
|
2298
|
+
return await getVerifiedSignatures(await this.internal_getId());
|
|
2299
|
+
}
|
|
2300
|
+
|
|
1878
2301
|
//#endregion
|
|
1879
2302
|
|
|
1880
2303
|
//#region header/footer (affix)
|
package/src/public/render.d.ts
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
import { PdfPaperOrientation, PdfPaperSize } from "./paper";
|
|
2
2
|
import { HtmlAffix, TextAffix } from "./affix";
|
|
3
3
|
import { CssMediaType, FitToPaperModes, MarginConfig, UseMargins, TableOfContentsTypes } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Represents the rendered location of an HTML element within a PDF document.
|
|
6
|
+
*
|
|
7
|
+
* Returned by {@code PdfDocument.getElementLocations()} after rendering HTML with
|
|
8
|
+
* {@link ChromePdfRenderOptions.elementQuerySelectors} configured.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors {@code IronPdf.RenderedElementLocation} on the C# side.
|
|
11
|
+
*/
|
|
12
|
+
export interface RenderedElementLocation {
|
|
13
|
+
/**
|
|
14
|
+
* The text content of the matched element.
|
|
15
|
+
*/
|
|
16
|
+
text: string;
|
|
17
|
+
/**
|
|
18
|
+
* The zero-based page index where the element was rendered.
|
|
19
|
+
*/
|
|
20
|
+
pageIndex: number;
|
|
21
|
+
/**
|
|
22
|
+
* The bounding rectangle of the annotation marker on the page, in PDF points (1/72 inch).
|
|
23
|
+
* Coordinate origin is the bottom-left corner of the page. The rectangle corresponds to
|
|
24
|
+
* the injected anchor marker placed at the start of the matched element.
|
|
25
|
+
*/
|
|
26
|
+
rectangle: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The original index of the element in document order among all matched elements.
|
|
34
|
+
*/
|
|
35
|
+
elementIndex: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the linearization strategy to use when producing a linearized
|
|
39
|
+
* (web-optimized) PDF.
|
|
40
|
+
*
|
|
41
|
+
* Mirrors {@code IronPdf.LinearizationMode} on the C# side.
|
|
42
|
+
*/
|
|
43
|
+
export declare enum LinearizationMode {
|
|
44
|
+
/**
|
|
45
|
+
* Automatically selects the optimal linearization method based on system capabilities.
|
|
46
|
+
*
|
|
47
|
+
* Behavior:
|
|
48
|
+
* 1. First attempts {@link FileBased} linearization.
|
|
49
|
+
* 2. If disk access is restricted (e.g. limited permissions, sandboxed environment),
|
|
50
|
+
* automatically falls back to {@link InMemory}.
|
|
51
|
+
*
|
|
52
|
+
* Recommended default for most applications.
|
|
53
|
+
*/
|
|
54
|
+
Automatic = 0,
|
|
55
|
+
/**
|
|
56
|
+
* Performs linearization entirely in memory without any disk I/O operations.
|
|
57
|
+
*
|
|
58
|
+
* Use when:
|
|
59
|
+
* - Compliance requirements mandate zero disk I/O (e.g. HIPAA, PCI-DSS)
|
|
60
|
+
* - Sandboxed or restricted environments without disk write permissions
|
|
61
|
+
* - Cloud-based environments where disk I/O introduces latency
|
|
62
|
+
*/
|
|
63
|
+
InMemory = 1,
|
|
64
|
+
/**
|
|
65
|
+
* Performs linearization using temporary file operations on disk.
|
|
66
|
+
* Requires write permissions to the system temporary directory.
|
|
67
|
+
*/
|
|
68
|
+
FileBased = 2
|
|
69
|
+
}
|
|
4
70
|
/**
|
|
5
71
|
* Html or Url To PDF output options for {@link PdfGenerator} and {@link PdfDocument} static method.
|
|
6
72
|
* Specify options such as Paper-Size, DPI and other Chromium specific browser setup options.
|
|
@@ -101,6 +167,44 @@ export interface ChromePdfRenderOptions {
|
|
|
101
167
|
* @default {@link UseMargins.LeftAndRight}
|
|
102
168
|
*/
|
|
103
169
|
useMarginsOnHeaderAndFooter?: UseMargins | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* If true, auto-generate PDF outline (bookmarks) from the HTML heading structure.
|
|
172
|
+
* Use {@link autoBookmarkMinHeadingLevel} / {@link autoBookmarkMaxHeadingLevel} to control
|
|
173
|
+
* which heading levels are included (1 = h1, 6 = h6). Use {@link autoBookmarkCssSelectors}
|
|
174
|
+
* to include additional non-heading elements (e.g. {@code ".chapter-title"}).
|
|
175
|
+
*
|
|
176
|
+
* @default false
|
|
177
|
+
*/
|
|
178
|
+
autoBookmarksFromHeadings?: boolean | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Minimum heading level (inclusive) to include in auto-generated bookmarks.
|
|
181
|
+
* Only used when {@link autoBookmarksFromHeadings} is true.
|
|
182
|
+
*
|
|
183
|
+
* @default 1
|
|
184
|
+
*/
|
|
185
|
+
autoBookmarkMinHeadingLevel?: number | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Maximum heading level (inclusive) to include in auto-generated bookmarks.
|
|
188
|
+
* Only used when {@link autoBookmarksFromHeadings} is true.
|
|
189
|
+
*
|
|
190
|
+
* @default 6
|
|
191
|
+
*/
|
|
192
|
+
autoBookmarkMaxHeadingLevel?: number | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Additional CSS selectors whose matching elements will be included as auto-bookmarks
|
|
195
|
+
* (in addition to the heading range). Only used when {@link autoBookmarksFromHeadings} is true.
|
|
196
|
+
* Example: {@code [".chapter-title", "[data-bookmark]"]}.
|
|
197
|
+
*/
|
|
198
|
+
autoBookmarkCssSelectors?: string[] | undefined;
|
|
199
|
+
/**
|
|
200
|
+
* CSS selectors whose matching HTML elements should be tracked during rendering so their
|
|
201
|
+
* rendered page positions can later be retrieved by the engine.
|
|
202
|
+
*
|
|
203
|
+
* <b>Note:</b> retrieval of the per-element locations from the Node client is not yet
|
|
204
|
+
* supported. Setting this option still enables engine-side tracking (and any downstream
|
|
205
|
+
* effects such as auto-bookmarks for those selectors).
|
|
206
|
+
*/
|
|
207
|
+
elementQuerySelectors?: string[] | undefined;
|
|
104
208
|
}
|
|
105
209
|
/**
|
|
106
210
|
* A managed wrapper of wait-for configurations. see {@link ChromePdfRenderOptions.waitFor}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EACC,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,UAAU,EACV,oBAAoB,EAC3B,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IAEtC;;;;OAIG;IACH,sBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9C;;;;;;OAMG;IACI,YAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C;;;;;;OAMG;IACH,gBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAC7C;;;;OAIG;IACH,SAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAClC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACnD;;;;;OAKG;IACH,SAAS,CAAC,EAAE,YAAY,GAAG,SAAS,CA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G,SAAS,CAAC;IACtC;;OAEG;IACH,gBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC;;OAEG;IACH,gBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC"}
|
package/src/public/render.js
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultChromePdfRenderOptions = exports.WaitForType = void 0;
|
|
3
|
+
exports.defaultChromePdfRenderOptions = exports.WaitForType = exports.LinearizationMode = void 0;
|
|
4
4
|
const paper_1 = require("./paper");
|
|
5
5
|
const types_1 = require("./types");
|
|
6
|
+
/**
|
|
7
|
+
* Specifies the linearization strategy to use when producing a linearized
|
|
8
|
+
* (web-optimized) PDF.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors {@code IronPdf.LinearizationMode} on the C# side.
|
|
11
|
+
*/
|
|
12
|
+
var LinearizationMode;
|
|
13
|
+
(function (LinearizationMode) {
|
|
14
|
+
/**
|
|
15
|
+
* Automatically selects the optimal linearization method based on system capabilities.
|
|
16
|
+
*
|
|
17
|
+
* Behavior:
|
|
18
|
+
* 1. First attempts {@link FileBased} linearization.
|
|
19
|
+
* 2. If disk access is restricted (e.g. limited permissions, sandboxed environment),
|
|
20
|
+
* automatically falls back to {@link InMemory}.
|
|
21
|
+
*
|
|
22
|
+
* Recommended default for most applications.
|
|
23
|
+
*/
|
|
24
|
+
LinearizationMode[LinearizationMode["Automatic"] = 0] = "Automatic";
|
|
25
|
+
/**
|
|
26
|
+
* Performs linearization entirely in memory without any disk I/O operations.
|
|
27
|
+
*
|
|
28
|
+
* Use when:
|
|
29
|
+
* - Compliance requirements mandate zero disk I/O (e.g. HIPAA, PCI-DSS)
|
|
30
|
+
* - Sandboxed or restricted environments without disk write permissions
|
|
31
|
+
* - Cloud-based environments where disk I/O introduces latency
|
|
32
|
+
*/
|
|
33
|
+
LinearizationMode[LinearizationMode["InMemory"] = 1] = "InMemory";
|
|
34
|
+
/**
|
|
35
|
+
* Performs linearization using temporary file operations on disk.
|
|
36
|
+
* Requires write permissions to the system temporary directory.
|
|
37
|
+
*/
|
|
38
|
+
LinearizationMode[LinearizationMode["FileBased"] = 2] = "FileBased";
|
|
39
|
+
})(LinearizationMode = exports.LinearizationMode || (exports.LinearizationMode = {}));
|
|
6
40
|
/**
|
|
7
41
|
* A wait-for type. see {@link ChromePdfRenderOptions.waitFor} also {@link WaitFor}
|
|
8
42
|
*/
|
package/src/public/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["render.ts"],"names":[],"mappings":";;;AAAA,mCAAuE;AAEvE,mCAMiB;
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["render.ts"],"names":[],"mappings":";;;AAAA,mCAAuE;AAEvE,mCAMiB;AA+BjB;;;;;GAKG;AACH,IAAY,iBA0BX;AA1BD,WAAY,iBAAiB;IAC5B;;;;;;;;;OASG;IACH,mEAAa,CAAA;IACb;;;;;;;OAOG;IACH,iEAAY,CAAA;IACZ;;;OAGG;IACH,mEAAa,CAAA;AACd,CAAC,EA1BW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QA0B5B;AA8JD;;GAEG;AACH,IAAY,WAQX;AARD,WAAY,WAAW;IACtB,oCAAqB,CAAA;IACrB,wCAAyB,CAAA;IACzB,0CAA2B,CAAA;IAC3B,4CAA6B,CAAA;IAC7B,4CAA6B,CAAA;IAC7B,4CAA6B,CAAA;IAC7B,0CAA2B,CAAA;AAC5B,CAAC,EARW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAQtB;AAiGD,SAAgB,6BAA6B;IACrC,OAAO;QACC,YAAY,EAAE,oBAAY,CAAC,KAAK;QAChC,gBAAgB,EAAE,IAAI;QACtB,eAAe,EAAE,CAAC;QAClB,eAAe,EAAE,4BAAoB,CAAC,IAAI;QAC1C,cAAc,EAAE,uB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