@ironsoftware/ironpdf 2026.4.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 +2 -0
- package/src/index.d.ts.map +1 -1
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/index.ts +2 -0
- 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/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/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 +168 -1
- package/src/public/pdfDocument.d.ts.map +1 -1
- package/src/public/pdfDocument.js +341 -17
- package/src/public/pdfDocument.js.map +1 -1
- package/src/public/pdfDocument.ts +364 -18
- 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
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getAnnotationCount = exports.addLinkAnnotation = exports.getAnnotations = void 0;
|
|
13
|
+
const access_1 = require("../../access");
|
|
14
|
+
const annotation_1 = require("../../../public/annotation");
|
|
15
|
+
const util_1 = require("../util");
|
|
16
|
+
/**
|
|
17
|
+
* URL prefix used to encode an internal hyperlink (goto-page) target inside the
|
|
18
|
+
* existing {@code Pdfium_Annotation_AddLinkAnnotation} RPC. Must match the
|
|
19
|
+
* {@code InternalLinkPrefixes.InternalLinkPrefix} constant in the C#
|
|
20
|
+
* {@code IronPdf.GrpcLayer.InternalPrefixes} / {@code IronPdfServiceHandler}.
|
|
21
|
+
*
|
|
22
|
+
* <p>The {@code x-} prefix follows RFC 6648 conventions for experimental /
|
|
23
|
+
* private URL schemes and cannot collide with any real URL scheme a user would
|
|
24
|
+
* construct.</p>
|
|
25
|
+
*/
|
|
26
|
+
const INTERNAL_LINK_PREFIX = "x-ironpdf-goto-page:";
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve all heterogeneous annotations (text, free-text, link, ...) on a single page
|
|
29
|
+
* via the {@code Pdfium_Annotation_GetAnnotations} unary RPC.
|
|
30
|
+
*
|
|
31
|
+
* The returned wrapped annotations carry one of the proto sub-types ({@code text},
|
|
32
|
+
* {@code freetext}, {@code link}). Callers inspect the {@code annotations} oneof to
|
|
33
|
+
* dispatch by sub-type.
|
|
34
|
+
*/
|
|
35
|
+
function getAnnotations(id, pageIndex) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const client = yield access_1.Access.ensureConnection();
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
client.Pdfium_Annotation_GetAnnotationsRequestP({
|
|
40
|
+
document: { documentId: id },
|
|
41
|
+
pageIndex: pageIndex,
|
|
42
|
+
}, (err, value) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
if (err) {
|
|
45
|
+
reject(`${err.name}/n${err.message}`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (!value) {
|
|
49
|
+
reject("No response from IronPdfEngine for getAnnotations");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (value.exception) {
|
|
53
|
+
(0, util_1.handleRemoteException)(value.exception, reject);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
resolve((_b = (_a = value.result) === null || _a === void 0 ? void 0 : _a.annotations) !== null && _b !== void 0 ? _b : []);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.getAnnotations = getAnnotations;
|
|
62
|
+
/**
|
|
63
|
+
* Add an internal hyperlink annotation to the document. The link navigates to a
|
|
64
|
+
* destination page within the same PDF when clicked.
|
|
65
|
+
*
|
|
66
|
+
* <p>Reuses the existing {@code Pdfium_Annotation_AddLinkAnnotation} RPC by encoding
|
|
67
|
+
* the destination parameters into a special URL format:
|
|
68
|
+
* {@code x-ironpdf-goto-page:{destPage},{destType},{left},{right},{top},{bottom},{zoom},{showBorder}}.
|
|
69
|
+
* The engine detects this prefix and routes the request to its internal link handler.</p>
|
|
70
|
+
*
|
|
71
|
+
* <p>Mirrors {@code IronPdf.Engines.Pdfium.GrpcPdfClient.AddInternalLinkAnnotation}
|
|
72
|
+
* on the C# side.</p>
|
|
73
|
+
*/
|
|
74
|
+
function addLinkAnnotation(id, link) {
|
|
75
|
+
var _a, _b, _c, _d, _e, _f;
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
if (link.pageIndex < 0) {
|
|
78
|
+
throw new Error("Invalid page index when adding link annotation");
|
|
79
|
+
}
|
|
80
|
+
if (link.destinationPageIndex < 0) {
|
|
81
|
+
throw new Error("Invalid destination page index when adding link annotation");
|
|
82
|
+
}
|
|
83
|
+
const client = yield access_1.Access.ensureConnection();
|
|
84
|
+
const destType = (_a = link.destinationType) !== null && _a !== void 0 ? _a : annotation_1.BookmarkDestinations.Page;
|
|
85
|
+
const destLeft = (_b = link.destinationLeft) !== null && _b !== void 0 ? _b : 0;
|
|
86
|
+
const destRight = (_c = link.destinationRight) !== null && _c !== void 0 ? _c : 0;
|
|
87
|
+
const destTop = (_d = link.destinationTop) !== null && _d !== void 0 ? _d : 0;
|
|
88
|
+
const destBottom = (_e = link.destinationBottom) !== null && _e !== void 0 ? _e : 0;
|
|
89
|
+
const destZoom = (_f = link.destinationZoom) !== null && _f !== void 0 ? _f : 0;
|
|
90
|
+
const showBorderFlag = link.showBorder ? 1 : 0;
|
|
91
|
+
// Matches the 8-field encoding produced by C# AddInternalLinkAnnotation:
|
|
92
|
+
// {prefix}{destPageIndex},{destType},{destLeft},{destRight},{destTop},{destBottom},{destZoom},{showBorder}
|
|
93
|
+
const encodedUrl = `${INTERNAL_LINK_PREFIX}${link.destinationPageIndex},${destType},` +
|
|
94
|
+
`${destLeft},${destRight},${destTop},${destBottom},${destZoom},${showBorderFlag}`;
|
|
95
|
+
// Color fallback: the engine parses `color_code` into IronSoftware.Drawing.Color and
|
|
96
|
+
// throws on an empty string. Match the C# AddLinkAnnotation behavior by always
|
|
97
|
+
// sending a valid color — default to black when the caller hasn't specified one.
|
|
98
|
+
const colorCode = link.colorCode && link.colorCode.length > 0 ? link.colorCode : "#000000";
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
client.Pdfium_Annotation_AddLinkAnnotation({
|
|
102
|
+
document: { documentId: id },
|
|
103
|
+
name: (_a = link.title) !== null && _a !== void 0 ? _a : "",
|
|
104
|
+
url: encodedUrl,
|
|
105
|
+
pageIndex: link.pageIndex,
|
|
106
|
+
rectangle: {
|
|
107
|
+
x: link.x,
|
|
108
|
+
y: link.y,
|
|
109
|
+
width: link.width,
|
|
110
|
+
height: link.height,
|
|
111
|
+
},
|
|
112
|
+
colorCode: colorCode,
|
|
113
|
+
Hidden: (_b = link.hidden) !== null && _b !== void 0 ? _b : false,
|
|
114
|
+
}, (err, value) => {
|
|
115
|
+
if (err) {
|
|
116
|
+
reject(`${err.name}/n${err.message}`);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (!value) {
|
|
120
|
+
reject("No response from IronPdfEngine for addLinkAnnotation");
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
(0, util_1.handleEmptyResultP__Output)(value, reject);
|
|
124
|
+
resolve();
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
exports.addLinkAnnotation = addLinkAnnotation;
|
|
130
|
+
/**
|
|
131
|
+
* Retrieve the number of annotations contained on the specified page via the
|
|
132
|
+
* {@code Pdfium_Annotation_GetAnnotationCount} unary RPC.
|
|
133
|
+
*/
|
|
134
|
+
function getAnnotationCount(id, pageIndex) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
const client = yield access_1.Access.ensureConnection();
|
|
137
|
+
return new Promise((resolve, reject) => {
|
|
138
|
+
client.Pdfium_Annotation_GetAnnotationCountRequestP({
|
|
139
|
+
document: { documentId: id },
|
|
140
|
+
pageIndex: pageIndex,
|
|
141
|
+
}, (err, value) => {
|
|
142
|
+
var _a;
|
|
143
|
+
if (err) {
|
|
144
|
+
reject(`${err.name}/n${err.message}`);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (!value) {
|
|
148
|
+
reject("No response from IronPdfEngine for getAnnotationCount");
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (value.exception) {
|
|
152
|
+
(0, util_1.handleRemoteException)(value.exception, reject);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
resolve((_a = value.result) !== null && _a !== void 0 ? _a : 0);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
exports.getAnnotationCount = getAnnotationCount;
|
|
161
|
+
//# sourceMappingURL=annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["annotations.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yCAAoC;AAKpC,2DAAgF;AAChF,kCAA0E;AAE1E;;;;;;;;;GASG;AACH,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAEpD;;;;;;;GAOG;AACH,SAAsB,cAAc,CACnC,EAAU,EACV,SAAiB;;QAEjB,MAAM,MAAM,GAAyB,MAAM,eAAM,CAAC,gBAAgB,EAAE,CAAC;QAErE,OAAO,IAAI,OAAO,CACjB,CACC,OA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C;QACH,CAAC,CACD,CAAC;IACH,CAAC;CAAA;AApCD,gDAoCC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import {ServiceError} from "@grpc/grpc-js";
|
|
2
|
+
import {Access} from "../../access";
|
|
3
|
+
import {IronPdfServiceClient} from "../../generated_proto/ironpdfengineproto/IronPdfService";
|
|
4
|
+
import {EmptyResultP__Output} from "../../generated_proto/ironpdfengineproto/EmptyResultP";
|
|
5
|
+
import {PdfiumGetAnnotationsResultP__Output} from "../../generated_proto/ironpdfengineproto/PdfiumGetAnnotationsResultP";
|
|
6
|
+
import {PdfiumWrappedPdfAnnotationP__Output} from "../../generated_proto/ironpdfengineproto/PdfiumWrappedPdfAnnotationP";
|
|
7
|
+
import {BookmarkDestinations, LinkAnnotation} from "../../../public/annotation";
|
|
8
|
+
import {handleEmptyResultP__Output, handleRemoteException} from "../util";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* URL prefix used to encode an internal hyperlink (goto-page) target inside the
|
|
12
|
+
* existing {@code Pdfium_Annotation_AddLinkAnnotation} RPC. Must match the
|
|
13
|
+
* {@code InternalLinkPrefixes.InternalLinkPrefix} constant in the C#
|
|
14
|
+
* {@code IronPdf.GrpcLayer.InternalPrefixes} / {@code IronPdfServiceHandler}.
|
|
15
|
+
*
|
|
16
|
+
* <p>The {@code x-} prefix follows RFC 6648 conventions for experimental /
|
|
17
|
+
* private URL schemes and cannot collide with any real URL scheme a user would
|
|
18
|
+
* construct.</p>
|
|
19
|
+
*/
|
|
20
|
+
const INTERNAL_LINK_PREFIX = "x-ironpdf-goto-page:";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Retrieve all heterogeneous annotations (text, free-text, link, ...) on a single page
|
|
24
|
+
* via the {@code Pdfium_Annotation_GetAnnotations} unary RPC.
|
|
25
|
+
*
|
|
26
|
+
* The returned wrapped annotations carry one of the proto sub-types ({@code text},
|
|
27
|
+
* {@code freetext}, {@code link}). Callers inspect the {@code annotations} oneof to
|
|
28
|
+
* dispatch by sub-type.
|
|
29
|
+
*/
|
|
30
|
+
export async function getAnnotations(
|
|
31
|
+
id: string,
|
|
32
|
+
pageIndex: number
|
|
33
|
+
): Promise<PdfiumWrappedPdfAnnotationP__Output[]> {
|
|
34
|
+
const client: IronPdfServiceClient = await Access.ensureConnection();
|
|
35
|
+
|
|
36
|
+
return new Promise(
|
|
37
|
+
(
|
|
38
|
+
resolve: (_: PdfiumWrappedPdfAnnotationP__Output[]) => void,
|
|
39
|
+
reject: (errorMsg: string) => void
|
|
40
|
+
) => {
|
|
41
|
+
client.Pdfium_Annotation_GetAnnotationsRequestP(
|
|
42
|
+
{
|
|
43
|
+
document: {documentId: id},
|
|
44
|
+
pageIndex: pageIndex,
|
|
45
|
+
},
|
|
46
|
+
(
|
|
47
|
+
err: ServiceError | null,
|
|
48
|
+
value: PdfiumGetAnnotationsResultP__Output | undefined
|
|
49
|
+
) => {
|
|
50
|
+
if (err) {
|
|
51
|
+
reject(`${err.name}/n${err.message}`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!value) {
|
|
55
|
+
reject("No response from IronPdfEngine for getAnnotations");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (value.exception) {
|
|
59
|
+
handleRemoteException(value.exception, reject);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
resolve(value.result?.annotations ?? []);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Add an internal hyperlink annotation to the document. The link navigates to a
|
|
71
|
+
* destination page within the same PDF when clicked.
|
|
72
|
+
*
|
|
73
|
+
* <p>Reuses the existing {@code Pdfium_Annotation_AddLinkAnnotation} RPC by encoding
|
|
74
|
+
* the destination parameters into a special URL format:
|
|
75
|
+
* {@code x-ironpdf-goto-page:{destPage},{destType},{left},{right},{top},{bottom},{zoom},{showBorder}}.
|
|
76
|
+
* The engine detects this prefix and routes the request to its internal link handler.</p>
|
|
77
|
+
*
|
|
78
|
+
* <p>Mirrors {@code IronPdf.Engines.Pdfium.GrpcPdfClient.AddInternalLinkAnnotation}
|
|
79
|
+
* on the C# side.</p>
|
|
80
|
+
*/
|
|
81
|
+
export async function addLinkAnnotation(
|
|
82
|
+
id: string,
|
|
83
|
+
link: LinkAnnotation
|
|
84
|
+
): Promise<void> {
|
|
85
|
+
if (link.pageIndex < 0) {
|
|
86
|
+
throw new Error("Invalid page index when adding link annotation");
|
|
87
|
+
}
|
|
88
|
+
if (link.destinationPageIndex < 0) {
|
|
89
|
+
throw new Error("Invalid destination page index when adding link annotation");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const client: IronPdfServiceClient = await Access.ensureConnection();
|
|
93
|
+
|
|
94
|
+
const destType: BookmarkDestinations = link.destinationType ?? BookmarkDestinations.Page;
|
|
95
|
+
const destLeft = link.destinationLeft ?? 0;
|
|
96
|
+
const destRight = link.destinationRight ?? 0;
|
|
97
|
+
const destTop = link.destinationTop ?? 0;
|
|
98
|
+
const destBottom = link.destinationBottom ?? 0;
|
|
99
|
+
const destZoom = link.destinationZoom ?? 0;
|
|
100
|
+
const showBorderFlag = link.showBorder ? 1 : 0;
|
|
101
|
+
|
|
102
|
+
// Matches the 8-field encoding produced by C# AddInternalLinkAnnotation:
|
|
103
|
+
// {prefix}{destPageIndex},{destType},{destLeft},{destRight},{destTop},{destBottom},{destZoom},{showBorder}
|
|
104
|
+
const encodedUrl =
|
|
105
|
+
`${INTERNAL_LINK_PREFIX}${link.destinationPageIndex},${destType},` +
|
|
106
|
+
`${destLeft},${destRight},${destTop},${destBottom},${destZoom},${showBorderFlag}`;
|
|
107
|
+
|
|
108
|
+
// Color fallback: the engine parses `color_code` into IronSoftware.Drawing.Color and
|
|
109
|
+
// throws on an empty string. Match the C# AddLinkAnnotation behavior by always
|
|
110
|
+
// sending a valid color — default to black when the caller hasn't specified one.
|
|
111
|
+
const colorCode = link.colorCode && link.colorCode.length > 0 ? link.colorCode : "#000000";
|
|
112
|
+
|
|
113
|
+
return new Promise(
|
|
114
|
+
(resolve: () => void, reject: (errorMsg: string) => void) => {
|
|
115
|
+
client.Pdfium_Annotation_AddLinkAnnotation(
|
|
116
|
+
{
|
|
117
|
+
document: {documentId: id},
|
|
118
|
+
name: link.title ?? "",
|
|
119
|
+
url: encodedUrl,
|
|
120
|
+
pageIndex: link.pageIndex,
|
|
121
|
+
rectangle: {
|
|
122
|
+
x: link.x,
|
|
123
|
+
y: link.y,
|
|
124
|
+
width: link.width,
|
|
125
|
+
height: link.height,
|
|
126
|
+
},
|
|
127
|
+
colorCode: colorCode,
|
|
128
|
+
Hidden: link.hidden ?? false,
|
|
129
|
+
},
|
|
130
|
+
(
|
|
131
|
+
err: ServiceError | null,
|
|
132
|
+
value: EmptyResultP__Output | undefined
|
|
133
|
+
) => {
|
|
134
|
+
if (err) {
|
|
135
|
+
reject(`${err.name}/n${err.message}`);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (!value) {
|
|
139
|
+
reject("No response from IronPdfEngine for addLinkAnnotation");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
handleEmptyResultP__Output(value, reject);
|
|
143
|
+
resolve();
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Retrieve the number of annotations contained on the specified page via the
|
|
152
|
+
* {@code Pdfium_Annotation_GetAnnotationCount} unary RPC.
|
|
153
|
+
*/
|
|
154
|
+
export async function getAnnotationCount(
|
|
155
|
+
id: string,
|
|
156
|
+
pageIndex: number
|
|
157
|
+
): Promise<number> {
|
|
158
|
+
const client: IronPdfServiceClient = await Access.ensureConnection();
|
|
159
|
+
|
|
160
|
+
return new Promise(
|
|
161
|
+
(resolve: (_: number) => void, reject: (errorMsg: string) => void) => {
|
|
162
|
+
client.Pdfium_Annotation_GetAnnotationCountRequestP(
|
|
163
|
+
{
|
|
164
|
+
document: {documentId: id},
|
|
165
|
+
pageIndex: pageIndex,
|
|
166
|
+
},
|
|
167
|
+
(
|
|
168
|
+
err: ServiceError | null,
|
|
169
|
+
value:
|
|
170
|
+
| import("../../generated_proto/ironpdfengineproto/IntResultP").IntResultP__Output
|
|
171
|
+
| undefined
|
|
172
|
+
) => {
|
|
173
|
+
if (err) {
|
|
174
|
+
reject(`${err.name}/n${err.message}`);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (!value) {
|
|
178
|
+
reject("No response from IronPdfEngine for getAnnotationCount");
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (value.exception) {
|
|
182
|
+
handleRemoteException(value.exception, reject);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
resolve(value.result ?? 0);
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Bookmark } from "../../../public/bookmark";
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve the document's outline bookmarks via the {@code Pdfium_Bookmark_GetBookmarksDescriptor}
|
|
4
|
+
* unary RPC. Mirrors {@code IronPdf.PdfDocument.Bookmarks} on the C# side.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getBookmarks(id: string): Promise<Bookmark[]>;
|
|
7
|
+
//# sourceMappingURL=bookmarks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookmarks.d.ts","sourceRoot":"","sources":["bookmarks.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAGlD;;;GAGG;AACH,wBAAsB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAsClE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getBookmarks = void 0;
|
|
13
|
+
const access_1 = require("../../access");
|
|
14
|
+
const util_1 = require("../util");
|
|
15
|
+
/**
|
|
16
|
+
* Retrieve the document's outline bookmarks via the {@code Pdfium_Bookmark_GetBookmarksDescriptor}
|
|
17
|
+
* unary RPC. Mirrors {@code IronPdf.PdfDocument.Bookmarks} on the C# side.
|
|
18
|
+
*/
|
|
19
|
+
function getBookmarks(id) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const client = yield access_1.Access.ensureConnection();
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
client.Pdfium_Bookmark_GetBookmarksDescriptor({ document: { documentId: id } }, (err, value) => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
if (err) {
|
|
26
|
+
reject(`${err.name}/n${err.message}`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (!value) {
|
|
30
|
+
reject("No response from IronPdfEngine for getBookmarks");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (value.exception) {
|
|
34
|
+
(0, util_1.handleRemoteException)(value.exception, reject);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const descriptors = (_b = (_a = value.result) === null || _a === void 0 ? void 0 : _a.bookmarkDescriptors) !== null && _b !== void 0 ? _b : [];
|
|
38
|
+
resolve(descriptors.map(d => {
|
|
39
|
+
var _a, _b, _c, _d, _e;
|
|
40
|
+
return ({
|
|
41
|
+
text: (_a = d.text) !== null && _a !== void 0 ? _a : "",
|
|
42
|
+
pageIndex: (_b = d.pageIndex) !== null && _b !== void 0 ? _b : 0,
|
|
43
|
+
hierarchy: (_c = d.hierarchy) !== null && _c !== void 0 ? _c : "",
|
|
44
|
+
itemId: (_d = d.itemId) !== null && _d !== void 0 ? _d : "",
|
|
45
|
+
parentItemId: (_e = d.parentItemId) !== null && _e !== void 0 ? _e : "",
|
|
46
|
+
});
|
|
47
|
+
}));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.getBookmarks = getBookmarks;
|
|
53
|
+
//# sourceMappingURL=bookmarks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookmarks.js","sourceRoot":"","sources":["bookmarks.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yCAAoC;AAIpC,kCAA8C;AAE9C;;;GAGG;AACH,SAAsB,YAAY,CAAC,EAAU;;QAC5C,MAAM,MAAM,GAAyB,MAAM,eAAM,CAAC,gBAAgB,EAAE,CAAC;QAErE,OAAO,IAAI,OAAO,CACjB,CAAC,OAAgC,EAAE,MAAkC,EAAE,EAAE;YACxE,MAAM,CAAC,sCAAsC,CAC5C,EAAC,QAAQ,EAAE,EAAC,UAAU,EAAE,EAAE,EAAC,EAAC,EAC5B,CACC,GAAwB,EACxB,KAA8D,EAC7D,EAAE;;gBACH,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;oBACtC,OAAO;iBACP;gBACD,IAAI,CAAC,KAAK,EAAE;oBACX,MAAM,CAAC,iDAAiD,CAAC,CAAC;oBAC1D,OAAO;iBACP;gBACD,IAAI,KAAK,CAAC,SAAS,EAAE;oBACpB,IAAA,4BAAqB,EAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;oBAC/C,OAAO;iBACP;gBAED,MAAM,WAAW,GAAG,MAAA,MAAA,KAAK,CAAC,MAAM,0CAAE,mBAAmB,mCAAI,EAAE,CAAC;gBAC5D,OAAO,CACN,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;;oBAAC,OAAA,CAAC;wBACrB,IAAI,EAAE,MAAA,CAAC,CAAC,IAAI,mCAAI,EAAE;wBAClB,SAAS,EAAE,MAAA,CAAC,CAAC,SAAS,mCAAI,CAAC;wBAC3B,SAAS,EAAE,MAAA,CAAC,CAAC,SAAS,mCAAI,EAAE;wBAC5B,MAAM,EAAE,MAAA,CAAC,CAAC,MAAM,mCAAI,EAAE;wBACtB,YAAY,EAAE,MAAA,CAAC,CAAC,YAAY,mCAAI,EAAE;qBAClC,CAAC,CAAA;iBAAA,CAAC,CACH,CAAC;YACH,CAAC,CACD,CAAC;QACH,CAAC,CACD,CAAC;IACH,CAAC;CAAA;AAtCD,oCAsCC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {ServiceError} from "@grpc/grpc-js";
|
|
2
|
+
import {Access} from "../../access";
|
|
3
|
+
import {IronPdfServiceClient} from "../../generated_proto/ironpdfengineproto/IronPdfService";
|
|
4
|
+
import {PdfiumGetBookmarksDescriptorResultP__Output} from "../../generated_proto/ironpdfengineproto/PdfiumGetBookmarksDescriptorResultP";
|
|
5
|
+
import {Bookmark} from "../../../public/bookmark";
|
|
6
|
+
import {handleRemoteException} from "../util";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Retrieve the document's outline bookmarks via the {@code Pdfium_Bookmark_GetBookmarksDescriptor}
|
|
10
|
+
* unary RPC. Mirrors {@code IronPdf.PdfDocument.Bookmarks} on the C# side.
|
|
11
|
+
*/
|
|
12
|
+
export async function getBookmarks(id: string): Promise<Bookmark[]> {
|
|
13
|
+
const client: IronPdfServiceClient = await Access.ensureConnection();
|
|
14
|
+
|
|
15
|
+
return new Promise(
|
|
16
|
+
(resolve: (_: Bookmark[]) => void, reject: (errorMsg: string) => void) => {
|
|
17
|
+
client.Pdfium_Bookmark_GetBookmarksDescriptor(
|
|
18
|
+
{document: {documentId: id}},
|
|
19
|
+
(
|
|
20
|
+
err: ServiceError | null,
|
|
21
|
+
value: PdfiumGetBookmarksDescriptorResultP__Output | undefined
|
|
22
|
+
) => {
|
|
23
|
+
if (err) {
|
|
24
|
+
reject(`${err.name}/n${err.message}`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!value) {
|
|
28
|
+
reject("No response from IronPdfEngine for getBookmarks");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (value.exception) {
|
|
32
|
+
handleRemoteException(value.exception, reject);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const descriptors = value.result?.bookmarkDescriptors ?? [];
|
|
37
|
+
resolve(
|
|
38
|
+
descriptors.map(d => ({
|
|
39
|
+
text: d.text ?? "",
|
|
40
|
+
pageIndex: d.pageIndex ?? 0,
|
|
41
|
+
hierarchy: d.hierarchy ?? "",
|
|
42
|
+
itemId: d.itemId ?? "",
|
|
43
|
+
parentItemId: d.parentItemId ?? "",
|
|
44
|
+
}))
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { Buffer } from "buffer";
|
|
5
|
+
import { Readable } from "stream";
|
|
6
|
+
import { LinearizationMode } from "../../../public/render";
|
|
7
|
+
/**
|
|
8
|
+
* Check if the given PDF bytes represent a linearized ("Fast Web View") PDF.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isLinearizedFromBytes(pdfBytes: Buffer, password?: string): Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Linearize a PDF held by the engine (by document id) and return the linearized bytes
|
|
13
|
+
* via the {@code QPdf_Linearization_LinearizeInMemoryFromId} unary-request/server-streaming RPC.
|
|
14
|
+
*/
|
|
15
|
+
export declare function linearizeInMemoryFromId(id: string, password?: string): Promise<Buffer>;
|
|
16
|
+
/**
|
|
17
|
+
* Linearize a PDF held by the engine (by document id) and stream the linearized bytes
|
|
18
|
+
* as a {@link Readable}. Useful for piping to HTTP responses or file streams without
|
|
19
|
+
* buffering the entire PDF in memory.
|
|
20
|
+
*/
|
|
21
|
+
export declare function linearizeInMemoryFromIdStream(id: string, password?: string): Promise<Readable>;
|
|
22
|
+
/**
|
|
23
|
+
* Linearize a PDF provided as raw bytes and return the linearized bytes via the
|
|
24
|
+
* bidirectional streaming {@code QPdf_Linearization_LinearizeInMemory} RPC.
|
|
25
|
+
*/
|
|
26
|
+
export declare function linearizeInMemoryFromBytes(pdfBytes: Buffer, password?: string): Promise<Buffer>;
|
|
27
|
+
/**
|
|
28
|
+
* Core linearization logic shared across all linearization entry points. Implements the
|
|
29
|
+
* {@link LinearizationMode} strategy pattern. Mirrors {@code PdfDocument.LinearizePdfCore}
|
|
30
|
+
* on the C# side.
|
|
31
|
+
*/
|
|
32
|
+
export declare function linearizeCoreFromBytes(pdfBytes: Buffer, password?: string, mode?: LinearizationMode): Promise<Buffer>;
|
|
33
|
+
/**
|
|
34
|
+
* Variant of {@link linearizeCoreFromBytes} that starts from an open document on the engine.
|
|
35
|
+
* For {@link LinearizationMode.InMemory} we use the cheap document-id RPC; for the disk-based
|
|
36
|
+
* paths we have to fetch the bytes once and delegate to {@link linearizeCoreFromBytes}.
|
|
37
|
+
*/
|
|
38
|
+
export declare function linearizeCoreFromId(id: string, getBytes: () => Promise<Buffer>, password?: string, mode?: LinearizationMode): Promise<Buffer>;
|
|
39
|
+
/**
|
|
40
|
+
* Linearize a PDF provided as raw bytes and save the result to disk via the file-based
|
|
41
|
+
* streaming {@code QPdf_Linearization_SaveAsLinearizedFromBytes} RPC.
|
|
42
|
+
*
|
|
43
|
+
* Mirrors the in-memory behavior used by {@link compressInMemory} in {@code compress.ts}:
|
|
44
|
+
* the engine streams the linearized bytes back, and we concatenate and persist them
|
|
45
|
+
* locally at {@code outputPath}.
|
|
46
|
+
*/
|
|
47
|
+
export declare function saveAsLinearizedFromBytes(pdfBytes: Buffer, outputPath: string, password?: string): Promise<Buffer>;
|
|
48
|
+
//# sourceMappingURL=linearize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linearize.d.ts","sourceRoot":"","sources":["linearize.ts"],"names":[],"mappings":";;;AACA,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAI9B,OAAO,EAAc,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAc7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAGzD;;GAEG;AACH,wBAAsB,qBAAqB,CAC1C,QAAQ,EAAE,MAAM,EAChB,QAAQ,SAAK,GACX,OAAO,CAAC,OAAO,CAAC,CA6BlB;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC5C,EAAE,EAAE,MAAM,EACV,QAAQ,SAAK,GACX,OAAO,CAAC,MAAM,CAAC,CA6BjB;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CAClD,EAAE,EAAE,MAAM,EACV,QAAQ,SAAK,GACX,OAAO,CAAC,QAAQ,CAAC,CA8BnB;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC/C,QAAQ,EAAE,MAAM,EAChB,QAAQ,SAAK,GACX,OAAO,CAAC,MAAM,CAAC,CAkCjB;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC3C,QAAQ,EAAE,MAAM,EAChB,QAAQ,SAAK,EACb,IAAI,GAAE,iBAA+C,GACnD,OAAO,CAAC,MAAM,CAAC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