-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtyp2docx.js
More file actions
27 lines (26 loc) · 824 Bytes
/
typ2docx.js
File metadata and controls
27 lines (26 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
typ2DocxExport = app.trustedFunction(function (port) {
try {
app.beginPriv();
const path =
app.getPath("user", "temp") + "/" + "typ2docx-" + port + ".docx";
this.saveAs({ cPath: path, cConvID: "com.adobe.acrobat.docx" });
app.endPriv();
typ2DocxReport(port, { status: "ok", path: path });
} catch (e) {
typ2DocxReport(port, {
status: "error",
message: e.message,
stack: e.stack,
});
}
});
// biome-ignore lint/complexity/useArrowFunction: trusted functions can't be arrow
typ2DocxReport = app.trustedFunction(function (port, msg) {
const params = {}; // Acrobat doesn't recognize multi-line objects
params.cVerb = "POST";
params.cURL = "http://localhost:" + port;
params.oRequest = Net.streamFromString(JSON.stringify(msg));
app.beginPriv();
Net.HTTP.request(params);
app.endPriv();
});