@robinpath/pdf 0.1.4 → 0.1.5
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 +94 -94
- package/package.json +3 -3
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/pdf.d.ts +0 -100
- package/dist/pdf.d.ts.map +0 -1
- package/dist/pdf.js +0 -561
- package/dist/pdf.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
# @robinpath/pdf
|
|
2
|
-
|
|
3
|
-
> PDF generation (documents, tables, HTML-to-PDF) and parsing (text extraction, metadata, page count)
|
|
4
|
-
|
|
5
|
-
   
|
|
6
|
-
|
|
7
|
-
## Why use this module?
|
|
8
|
-
|
|
9
|
-
The `pdf` module lets you:
|
|
10
|
-
|
|
11
|
-
- Generate a PDF document with title, content, and sections
|
|
12
|
-
- Parse a PDF file and extract text, metadata, and page count
|
|
13
|
-
- Extract all text from a PDF file
|
|
14
|
-
- Get the number of pages in a PDF
|
|
15
|
-
- Get PDF metadata (author, title, creation date, etc.)
|
|
16
|
-
|
|
17
|
-
All functions are callable directly from RobinPath scripts with a simple, consistent API.
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm install @robinpath/pdf
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Quick Start
|
|
26
|
-
|
|
27
|
-
No credentials needed — start using it right away:
|
|
28
|
-
|
|
29
|
-
```robinpath
|
|
30
|
-
pdf.parse "./document.pdf"
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Available Functions
|
|
34
|
-
|
|
35
|
-
| Function | Description |
|
|
36
|
-
|----------|-------------|
|
|
37
|
-
| `pdf.generate` | Generate a PDF document with title, content, and sections |
|
|
38
|
-
| `pdf.parse` | Parse a PDF file and extract text, metadata, and page count |
|
|
39
|
-
| `pdf.extractText` | Extract all text from a PDF file |
|
|
40
|
-
| `pdf.pageCount` | Get the number of pages in a PDF |
|
|
41
|
-
| `pdf.metadata` | Get PDF metadata (author, title, creation date, etc.) |
|
|
42
|
-
| `pdf.generateTable` | Generate a PDF with a formatted table |
|
|
43
|
-
| `pdf.generateFromHtml` | Generate a PDF from basic HTML content |
|
|
44
|
-
|
|
45
|
-
## Examples
|
|
46
|
-
|
|
47
|
-
### Parse a PDF file and extract text, metadata, and page count
|
|
48
|
-
|
|
49
|
-
```robinpath
|
|
50
|
-
pdf.parse "./document.pdf"
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Extract all text from a PDF file
|
|
54
|
-
|
|
55
|
-
```robinpath
|
|
56
|
-
pdf.extractText "./document.pdf"
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Get the number of pages in a PDF
|
|
60
|
-
|
|
61
|
-
```robinpath
|
|
62
|
-
pdf.pageCount "./document.pdf"
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Integration with RobinPath
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
import { RobinPath } from "@wiredwp/robinpath";
|
|
69
|
-
import Module from "@robinpath/pdf";
|
|
70
|
-
|
|
71
|
-
const rp = new RobinPath();
|
|
72
|
-
rp.registerModule(Module.name, Module.functions);
|
|
73
|
-
rp.registerModuleMeta(Module.name, Module.functionMetadata);
|
|
74
|
-
|
|
75
|
-
const result = await rp.executeScript(`
|
|
76
|
-
pdf.parse "./document.pdf"
|
|
77
|
-
`);
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Full API Reference
|
|
81
|
-
|
|
82
|
-
See [MODULE.md](./MODULE.md) for complete documentation including all parameters, return types, error handling, and advanced examples.
|
|
83
|
-
|
|
84
|
-
## Related Modules
|
|
85
|
-
|
|
86
|
-
- [`@robinpath/excel`](../excel) — Excel module for complementary functionality
|
|
87
|
-
- [`@robinpath/office`](../office) — Office module for complementary functionality
|
|
88
|
-
- [`@robinpath/docusign`](../docusign) — DocuSign module for complementary functionality
|
|
89
|
-
- [`@robinpath/pandadoc`](../pandadoc) — PandaDoc module for complementary functionality
|
|
90
|
-
- [`@robinpath/hellosign`](../hellosign) — HelloSign module for complementary functionality
|
|
91
|
-
|
|
92
|
-
## License
|
|
93
|
-
|
|
94
|
-
MIT
|
|
1
|
+
# @robinpath/pdf
|
|
2
|
+
|
|
3
|
+
> PDF generation (documents, tables, HTML-to-PDF) and parsing (text extraction, metadata, page count)
|
|
4
|
+
|
|
5
|
+
   
|
|
6
|
+
|
|
7
|
+
## Why use this module?
|
|
8
|
+
|
|
9
|
+
The `pdf` module lets you:
|
|
10
|
+
|
|
11
|
+
- Generate a PDF document with title, content, and sections
|
|
12
|
+
- Parse a PDF file and extract text, metadata, and page count
|
|
13
|
+
- Extract all text from a PDF file
|
|
14
|
+
- Get the number of pages in a PDF
|
|
15
|
+
- Get PDF metadata (author, title, creation date, etc.)
|
|
16
|
+
|
|
17
|
+
All functions are callable directly from RobinPath scripts with a simple, consistent API.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @robinpath/pdf
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
No credentials needed — start using it right away:
|
|
28
|
+
|
|
29
|
+
```robinpath
|
|
30
|
+
pdf.parse "./document.pdf"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Available Functions
|
|
34
|
+
|
|
35
|
+
| Function | Description |
|
|
36
|
+
|----------|-------------|
|
|
37
|
+
| `pdf.generate` | Generate a PDF document with title, content, and sections |
|
|
38
|
+
| `pdf.parse` | Parse a PDF file and extract text, metadata, and page count |
|
|
39
|
+
| `pdf.extractText` | Extract all text from a PDF file |
|
|
40
|
+
| `pdf.pageCount` | Get the number of pages in a PDF |
|
|
41
|
+
| `pdf.metadata` | Get PDF metadata (author, title, creation date, etc.) |
|
|
42
|
+
| `pdf.generateTable` | Generate a PDF with a formatted table |
|
|
43
|
+
| `pdf.generateFromHtml` | Generate a PDF from basic HTML content |
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
### Parse a PDF file and extract text, metadata, and page count
|
|
48
|
+
|
|
49
|
+
```robinpath
|
|
50
|
+
pdf.parse "./document.pdf"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Extract all text from a PDF file
|
|
54
|
+
|
|
55
|
+
```robinpath
|
|
56
|
+
pdf.extractText "./document.pdf"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Get the number of pages in a PDF
|
|
60
|
+
|
|
61
|
+
```robinpath
|
|
62
|
+
pdf.pageCount "./document.pdf"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Integration with RobinPath
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { RobinPath } from "@wiredwp/robinpath";
|
|
69
|
+
import Module from "@robinpath/pdf";
|
|
70
|
+
|
|
71
|
+
const rp = new RobinPath();
|
|
72
|
+
rp.registerModule(Module.name, Module.functions);
|
|
73
|
+
rp.registerModuleMeta(Module.name, Module.functionMetadata);
|
|
74
|
+
|
|
75
|
+
const result = await rp.executeScript(`
|
|
76
|
+
pdf.parse "./document.pdf"
|
|
77
|
+
`);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Full API Reference
|
|
81
|
+
|
|
82
|
+
See [MODULE.md](./MODULE.md) for complete documentation including all parameters, return types, error handling, and advanced examples.
|
|
83
|
+
|
|
84
|
+
## Related Modules
|
|
85
|
+
|
|
86
|
+
- [`@robinpath/excel`](../excel) — Excel module for complementary functionality
|
|
87
|
+
- [`@robinpath/office`](../office) — Office module for complementary functionality
|
|
88
|
+
- [`@robinpath/docusign`](../docusign) — DocuSign module for complementary functionality
|
|
89
|
+
- [`@robinpath/pandadoc`](../pandadoc) — PandaDoc module for complementary functionality
|
|
90
|
+
- [`@robinpath/hellosign`](../hellosign) — HelloSign module for complementary functionality
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robinpath/pdf",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "PDF generation from HTML/text and text extraction from PDFs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"test": "node --import tsx --test tests/*.test.ts"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@
|
|
25
|
+
"@robinpath/core": ">=0.20.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@
|
|
29
|
+
"@robinpath/core": "^0.30.1",
|
|
30
30
|
"tsx": "^4.19.0",
|
|
31
31
|
"typescript": "^5.6.0"
|
|
32
32
|
},
|
package/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ModuleAdapter } from "@wiredwp/robinpath";
|
|
2
|
-
declare const PdfModule: ModuleAdapter;
|
|
3
|
-
export default PdfModule;
|
|
4
|
-
export { PdfModule };
|
|
5
|
-
export { PdfFunctions, PdfFunctionMetadata, PdfModuleMetadata } from "./pdf.js";
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,QAAA,MAAM,SAAS,EAAE,aAMhB,CAAC;AAEF,eAAe,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PdfFunctions, PdfFunctionMetadata, PdfModuleMetadata } from "./pdf.js";
|
|
2
|
-
const PdfModule = {
|
|
3
|
-
name: "pdf",
|
|
4
|
-
functions: PdfFunctions,
|
|
5
|
-
functionMetadata: PdfFunctionMetadata,
|
|
6
|
-
moduleMetadata: PdfModuleMetadata,
|
|
7
|
-
global: false,
|
|
8
|
-
}; // as ModuleAdapter
|
|
9
|
-
export default PdfModule;
|
|
10
|
-
export { PdfModule };
|
|
11
|
-
export { PdfFunctions, PdfFunctionMetadata, PdfModuleMetadata } from "./pdf.js";
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEhF,MAAM,SAAS,GAAkB;IAC/B,IAAI,EAAE,KAAK;IACX,SAAS,EAAE,YAAY;IACvB,gBAAgB,EAAE,mBAA0B;IAC5C,cAAc,EAAE,iBAAwB;IACxC,MAAM,EAAE,KAAK;CACd,CAAC,CAAC,mBAAmB;AAEtB,eAAe,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/pdf.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import type { BuiltinHandler } from "@wiredwp/robinpath";
|
|
2
|
-
export declare const PdfFunctions: Record<string, BuiltinHandler>;
|
|
3
|
-
export declare const PdfFunctionMetadata: {
|
|
4
|
-
generate: {
|
|
5
|
-
description: string;
|
|
6
|
-
parameters: {
|
|
7
|
-
name: string;
|
|
8
|
-
dataType: string;
|
|
9
|
-
description: string;
|
|
10
|
-
formInputType: string;
|
|
11
|
-
required: boolean;
|
|
12
|
-
}[];
|
|
13
|
-
returnType: string;
|
|
14
|
-
returnDescription: string;
|
|
15
|
-
example: string;
|
|
16
|
-
};
|
|
17
|
-
parse: {
|
|
18
|
-
description: string;
|
|
19
|
-
parameters: {
|
|
20
|
-
name: string;
|
|
21
|
-
dataType: string;
|
|
22
|
-
description: string;
|
|
23
|
-
formInputType: string;
|
|
24
|
-
required: boolean;
|
|
25
|
-
}[];
|
|
26
|
-
returnType: string;
|
|
27
|
-
returnDescription: string;
|
|
28
|
-
example: string;
|
|
29
|
-
};
|
|
30
|
-
extractText: {
|
|
31
|
-
description: string;
|
|
32
|
-
parameters: {
|
|
33
|
-
name: string;
|
|
34
|
-
dataType: string;
|
|
35
|
-
description: string;
|
|
36
|
-
formInputType: string;
|
|
37
|
-
required: boolean;
|
|
38
|
-
}[];
|
|
39
|
-
returnType: string;
|
|
40
|
-
returnDescription: string;
|
|
41
|
-
example: string;
|
|
42
|
-
};
|
|
43
|
-
pageCount: {
|
|
44
|
-
description: string;
|
|
45
|
-
parameters: {
|
|
46
|
-
name: string;
|
|
47
|
-
dataType: string;
|
|
48
|
-
description: string;
|
|
49
|
-
formInputType: string;
|
|
50
|
-
required: boolean;
|
|
51
|
-
}[];
|
|
52
|
-
returnType: string;
|
|
53
|
-
returnDescription: string;
|
|
54
|
-
example: string;
|
|
55
|
-
};
|
|
56
|
-
metadata: {
|
|
57
|
-
description: string;
|
|
58
|
-
parameters: {
|
|
59
|
-
name: string;
|
|
60
|
-
dataType: string;
|
|
61
|
-
description: string;
|
|
62
|
-
formInputType: string;
|
|
63
|
-
required: boolean;
|
|
64
|
-
}[];
|
|
65
|
-
returnType: string;
|
|
66
|
-
returnDescription: string;
|
|
67
|
-
example: string;
|
|
68
|
-
};
|
|
69
|
-
generateTable: {
|
|
70
|
-
description: string;
|
|
71
|
-
parameters: {
|
|
72
|
-
name: string;
|
|
73
|
-
dataType: string;
|
|
74
|
-
description: string;
|
|
75
|
-
formInputType: string;
|
|
76
|
-
required: boolean;
|
|
77
|
-
}[];
|
|
78
|
-
returnType: string;
|
|
79
|
-
returnDescription: string;
|
|
80
|
-
example: string;
|
|
81
|
-
};
|
|
82
|
-
generateFromHtml: {
|
|
83
|
-
description: string;
|
|
84
|
-
parameters: {
|
|
85
|
-
name: string;
|
|
86
|
-
dataType: string;
|
|
87
|
-
description: string;
|
|
88
|
-
formInputType: string;
|
|
89
|
-
required: boolean;
|
|
90
|
-
}[];
|
|
91
|
-
returnType: string;
|
|
92
|
-
returnDescription: string;
|
|
93
|
-
example: string;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
export declare const PdfModuleMetadata: {
|
|
97
|
-
description: string;
|
|
98
|
-
methods: string[];
|
|
99
|
-
};
|
|
100
|
-
//# sourceMappingURL=pdf.d.ts.map
|
package/dist/pdf.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../src/pdf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAunBzD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAEvD,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAG7B,CAAC"}
|
package/dist/pdf.js
DELETED
|
@@ -1,561 +0,0 @@
|
|
|
1
|
-
import { writeFileSync, readFileSync } from "node:fs";
|
|
2
|
-
import { deflateSync, inflateSync } from "node:zlib";
|
|
3
|
-
// ── Pure JS PDF Writer ──────────────────────────────────────────────
|
|
4
|
-
const PAGE_SIZES = {
|
|
5
|
-
A4: [595.28, 841.89],
|
|
6
|
-
letter: [612, 792],
|
|
7
|
-
legal: [612, 1008],
|
|
8
|
-
A3: [841.89, 1190.55],
|
|
9
|
-
A5: [419.53, 595.28],
|
|
10
|
-
};
|
|
11
|
-
const FONT_METRICS = {
|
|
12
|
-
"Helvetica": { ascent: 718, descent: -207, widths: {} },
|
|
13
|
-
"Helvetica-Bold": { ascent: 718, descent: -207, widths: {} },
|
|
14
|
-
"Times-Roman": { ascent: 683, descent: -217, widths: {} },
|
|
15
|
-
"Times-Bold": { ascent: 683, descent: -217, widths: {} },
|
|
16
|
-
"Courier": { ascent: 629, descent: -157, widths: {} },
|
|
17
|
-
"Courier-Bold": { ascent: 629, descent: -157, widths: {} },
|
|
18
|
-
};
|
|
19
|
-
function estimateTextWidth(text, fontName, fontSize) {
|
|
20
|
-
// Average character widths for standard PDF fonts (in 1/1000 of a unit)
|
|
21
|
-
const avgWidths = {
|
|
22
|
-
"Helvetica": 530, "Helvetica-Bold": 560,
|
|
23
|
-
"Times-Roman": 500, "Times-Bold": 530,
|
|
24
|
-
"Courier": 600, "Courier-Bold": 600,
|
|
25
|
-
};
|
|
26
|
-
const avg = avgWidths[fontName] ?? 530;
|
|
27
|
-
return (text.length * avg * fontSize) / 1000;
|
|
28
|
-
}
|
|
29
|
-
function escapeText(text) {
|
|
30
|
-
return text
|
|
31
|
-
.replace(/\\/g, "\\\\")
|
|
32
|
-
.replace(/\(/g, "\\(")
|
|
33
|
-
.replace(/\)/g, "\\)")
|
|
34
|
-
.replace(/\r/g, "\\r");
|
|
35
|
-
}
|
|
36
|
-
class PdfWriter {
|
|
37
|
-
objects = [];
|
|
38
|
-
nextId = 1;
|
|
39
|
-
pages = [];
|
|
40
|
-
pageContents = [];
|
|
41
|
-
pagesObjId = 0;
|
|
42
|
-
catalogObjId = 0;
|
|
43
|
-
infoObjId = 0;
|
|
44
|
-
fontObjIds = {};
|
|
45
|
-
currentStream = "";
|
|
46
|
-
currentPageWidth = 595.28;
|
|
47
|
-
currentPageHeight = 841.89;
|
|
48
|
-
cursorX = 50;
|
|
49
|
-
cursorY = 50;
|
|
50
|
-
margin = 50;
|
|
51
|
-
currentFont = "Helvetica";
|
|
52
|
-
currentFontSize = 12;
|
|
53
|
-
currentFontKey = "F1";
|
|
54
|
-
lineHeight = 1.2;
|
|
55
|
-
pageCount = 0;
|
|
56
|
-
info = {};
|
|
57
|
-
allocId() {
|
|
58
|
-
return this.nextId++;
|
|
59
|
-
}
|
|
60
|
-
addObj(id, content) {
|
|
61
|
-
this.objects.push({ id, generation: 0, data: content });
|
|
62
|
-
}
|
|
63
|
-
setInfo(info) {
|
|
64
|
-
this.info = info;
|
|
65
|
-
}
|
|
66
|
-
setupFonts() {
|
|
67
|
-
const standardFonts = ["Helvetica", "Helvetica-Bold", "Times-Roman", "Times-Bold", "Courier", "Courier-Bold"];
|
|
68
|
-
const keyMap = {
|
|
69
|
-
"Helvetica": "F1", "Helvetica-Bold": "F2",
|
|
70
|
-
"Times-Roman": "F3", "Times-Bold": "F4",
|
|
71
|
-
"Courier": "F5", "Courier-Bold": "F6",
|
|
72
|
-
};
|
|
73
|
-
for (const font of standardFonts) {
|
|
74
|
-
const id = this.allocId();
|
|
75
|
-
this.fontObjIds[font] = id;
|
|
76
|
-
this.addObj(id, `<< /Type /Font /Subtype /Type1 /BaseFont /${font} /Encoding /WinAnsiEncoding >>`);
|
|
77
|
-
}
|
|
78
|
-
this.currentFontKey = keyMap[this.currentFont] ?? "F1";
|
|
79
|
-
}
|
|
80
|
-
fontResourceDict() {
|
|
81
|
-
const entries = Object.entries(this.fontObjIds).map(([name, id]) => {
|
|
82
|
-
const keyMap = {
|
|
83
|
-
"Helvetica": "F1", "Helvetica-Bold": "F2",
|
|
84
|
-
"Times-Roman": "F3", "Times-Bold": "F4",
|
|
85
|
-
"Courier": "F5", "Courier-Bold": "F6",
|
|
86
|
-
};
|
|
87
|
-
return `/${keyMap[name]} ${id} 0 R`;
|
|
88
|
-
});
|
|
89
|
-
return `<< ${entries.join(" ")} >>`;
|
|
90
|
-
}
|
|
91
|
-
getFontKey(fontName) {
|
|
92
|
-
const keyMap = {
|
|
93
|
-
"Helvetica": "F1", "Helvetica-Bold": "F2",
|
|
94
|
-
"Times-Roman": "F3", "Times-Bold": "F4",
|
|
95
|
-
"Courier": "F5", "Courier-Bold": "F6",
|
|
96
|
-
};
|
|
97
|
-
return keyMap[fontName] ?? "F1";
|
|
98
|
-
}
|
|
99
|
-
initDocument(width, height, margin) {
|
|
100
|
-
this.currentPageWidth = width;
|
|
101
|
-
this.currentPageHeight = height;
|
|
102
|
-
this.margin = margin;
|
|
103
|
-
this.catalogObjId = this.allocId();
|
|
104
|
-
this.pagesObjId = this.allocId();
|
|
105
|
-
this.infoObjId = this.allocId();
|
|
106
|
-
this.setupFonts();
|
|
107
|
-
this.addPage();
|
|
108
|
-
}
|
|
109
|
-
addPage() {
|
|
110
|
-
// Finalize previous page if any
|
|
111
|
-
if (this.pageCount > 0) {
|
|
112
|
-
this.finalizePage();
|
|
113
|
-
}
|
|
114
|
-
this.pageCount++;
|
|
115
|
-
this.currentStream = "";
|
|
116
|
-
this.cursorX = this.margin;
|
|
117
|
-
this.cursorY = this.currentPageHeight - this.margin;
|
|
118
|
-
// Set initial font
|
|
119
|
-
this.currentStream += `BT\n/${this.currentFontKey} ${this.currentFontSize} Tf\n`;
|
|
120
|
-
}
|
|
121
|
-
finalizePage() {
|
|
122
|
-
// Close any open BT block
|
|
123
|
-
this.currentStream += "ET\n";
|
|
124
|
-
const contentId = this.allocId();
|
|
125
|
-
const pageId = this.allocId();
|
|
126
|
-
const compressed = deflateSync(Buffer.from(this.currentStream, "latin1"));
|
|
127
|
-
this.addObj(contentId, `<< /Length ${compressed.length} /Filter /FlateDecode >>\nstream\n` +
|
|
128
|
-
String.fromCharCode(...compressed) + "\nendstream");
|
|
129
|
-
this.addObj(pageId, `<< /Type /Page /Parent ${this.pagesObjId} 0 R ` +
|
|
130
|
-
`/MediaBox [0 0 ${this.currentPageWidth} ${this.currentPageHeight}] ` +
|
|
131
|
-
`/Contents ${contentId} 0 R ` +
|
|
132
|
-
`/Resources << /Font ${this.fontResourceDict()} >> >>`);
|
|
133
|
-
this.pages.push(pageId);
|
|
134
|
-
}
|
|
135
|
-
setFont(name, size) {
|
|
136
|
-
if (FONT_METRICS[name]) {
|
|
137
|
-
this.currentFont = name;
|
|
138
|
-
this.currentFontKey = this.getFontKey(name);
|
|
139
|
-
}
|
|
140
|
-
this.currentFontSize = size;
|
|
141
|
-
this.currentStream += `/${this.currentFontKey} ${this.currentFontSize} Tf\n`;
|
|
142
|
-
}
|
|
143
|
-
setColor(r, g, b) {
|
|
144
|
-
this.currentStream += `${(r / 255).toFixed(3)} ${(g / 255).toFixed(3)} ${(b / 255).toFixed(3)} rg\n`;
|
|
145
|
-
}
|
|
146
|
-
setColorHex(hex) {
|
|
147
|
-
const h = hex.replace("#", "");
|
|
148
|
-
const r = parseInt(h.substring(0, 2), 16);
|
|
149
|
-
const g = parseInt(h.substring(2, 4), 16);
|
|
150
|
-
const b = parseInt(h.substring(4, 6), 16);
|
|
151
|
-
this.setColor(r, g, b);
|
|
152
|
-
}
|
|
153
|
-
textAt(text, x, y) {
|
|
154
|
-
// y in PDF coords (bottom-up)
|
|
155
|
-
this.currentStream += `1 0 0 1 ${x.toFixed(2)} ${y.toFixed(2)} Tm\n(${escapeText(text)}) Tj\n`;
|
|
156
|
-
}
|
|
157
|
-
writeText(text, options) {
|
|
158
|
-
const maxWidth = (options?.width ?? this.currentPageWidth - 2 * this.margin);
|
|
159
|
-
const lines = text.split("\n");
|
|
160
|
-
const lineSpacing = this.currentFontSize * this.lineHeight;
|
|
161
|
-
for (const line of lines) {
|
|
162
|
-
// Word-wrap
|
|
163
|
-
const words = line.split(" ");
|
|
164
|
-
let currentLine = "";
|
|
165
|
-
for (const word of words) {
|
|
166
|
-
const testLine = currentLine ? currentLine + " " + word : word;
|
|
167
|
-
const testWidth = estimateTextWidth(testLine, this.currentFont, this.currentFontSize);
|
|
168
|
-
if (testWidth > maxWidth && currentLine) {
|
|
169
|
-
this.renderLine(currentLine, options?.align, maxWidth);
|
|
170
|
-
this.cursorY -= lineSpacing;
|
|
171
|
-
if (this.cursorY < this.margin + 20) {
|
|
172
|
-
this.addPage();
|
|
173
|
-
}
|
|
174
|
-
currentLine = word;
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
currentLine = testLine;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (currentLine) {
|
|
181
|
-
this.renderLine(currentLine, options?.align, maxWidth);
|
|
182
|
-
this.cursorY -= lineSpacing;
|
|
183
|
-
if (this.cursorY < this.margin + 20) {
|
|
184
|
-
this.addPage();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
// Empty line
|
|
188
|
-
if (line === "") {
|
|
189
|
-
this.cursorY -= lineSpacing;
|
|
190
|
-
if (this.cursorY < this.margin + 20) {
|
|
191
|
-
this.addPage();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
renderLine(text, align, maxWidth) {
|
|
197
|
-
let x = this.margin;
|
|
198
|
-
const w = maxWidth ?? (this.currentPageWidth - 2 * this.margin);
|
|
199
|
-
if (align === "center") {
|
|
200
|
-
const tw = estimateTextWidth(text, this.currentFont, this.currentFontSize);
|
|
201
|
-
x = this.margin + (w - tw) / 2;
|
|
202
|
-
}
|
|
203
|
-
else if (align === "right") {
|
|
204
|
-
const tw = estimateTextWidth(text, this.currentFont, this.currentFontSize);
|
|
205
|
-
x = this.margin + w - tw;
|
|
206
|
-
}
|
|
207
|
-
this.textAt(text, x, this.cursorY);
|
|
208
|
-
}
|
|
209
|
-
moveDown(lines = 1) {
|
|
210
|
-
this.cursorY -= this.currentFontSize * this.lineHeight * lines;
|
|
211
|
-
if (this.cursorY < this.margin + 20) {
|
|
212
|
-
this.addPage();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
getCursorY() { return this.cursorY; }
|
|
216
|
-
getPageWidth() { return this.currentPageWidth; }
|
|
217
|
-
getPageHeight() { return this.currentPageHeight; }
|
|
218
|
-
getMargin() { return this.margin; }
|
|
219
|
-
getPageCount() { return this.pageCount; }
|
|
220
|
-
drawLine(x1, y1, x2, y2, lineWidth = 1) {
|
|
221
|
-
// Need to end text block, draw, and start a new text block
|
|
222
|
-
this.currentStream += `ET\n${lineWidth} w\n${x1.toFixed(2)} ${y1.toFixed(2)} m ${x2.toFixed(2)} ${y2.toFixed(2)} l S\nBT\n/${this.currentFontKey} ${this.currentFontSize} Tf\n`;
|
|
223
|
-
}
|
|
224
|
-
toBuffer() {
|
|
225
|
-
// Finalize last page
|
|
226
|
-
this.finalizePage();
|
|
227
|
-
// Build info object
|
|
228
|
-
let infoDict = "<< ";
|
|
229
|
-
if (this.info.title)
|
|
230
|
-
infoDict += `/Title (${escapeText(this.info.title)}) `;
|
|
231
|
-
if (this.info.author)
|
|
232
|
-
infoDict += `/Author (${escapeText(this.info.author)}) `;
|
|
233
|
-
if (this.info.subject)
|
|
234
|
-
infoDict += `/Subject (${escapeText(this.info.subject)}) `;
|
|
235
|
-
infoDict += `/Producer (RobinPath PDF Writer) `;
|
|
236
|
-
infoDict += `/CreationDate (D:${new Date().toISOString().replace(/[-:T]/g, "").slice(0, 14)}) `;
|
|
237
|
-
infoDict += ">>";
|
|
238
|
-
this.addObj(this.infoObjId, infoDict);
|
|
239
|
-
// Pages object
|
|
240
|
-
const pageRefs = this.pages.map(p => `${p} 0 R`).join(" ");
|
|
241
|
-
this.addObj(this.pagesObjId, `<< /Type /Pages /Kids [${pageRefs}] /Count ${this.pages.length} >>`);
|
|
242
|
-
// Catalog
|
|
243
|
-
this.addObj(this.catalogObjId, `<< /Type /Catalog /Pages ${this.pagesObjId} 0 R >>`);
|
|
244
|
-
// Sort objects by id
|
|
245
|
-
this.objects.sort((a, b) => a.id - b.id);
|
|
246
|
-
// Build PDF bytes
|
|
247
|
-
let pdf = "%PDF-1.4\n%\xE2\xE3\xCF\xD3\n";
|
|
248
|
-
const offsets = [];
|
|
249
|
-
for (const obj of this.objects) {
|
|
250
|
-
offsets[obj.id] = pdf.length;
|
|
251
|
-
pdf += `${obj.id} 0 obj\n${obj.data}\nendobj\n`;
|
|
252
|
-
}
|
|
253
|
-
// Cross-reference table
|
|
254
|
-
const xrefOffset = pdf.length;
|
|
255
|
-
pdf += "xref\n";
|
|
256
|
-
pdf += `0 ${this.nextId}\n`;
|
|
257
|
-
pdf += "0000000000 65535 f \n";
|
|
258
|
-
for (let i = 1; i < this.nextId; i++) {
|
|
259
|
-
const off = offsets[i] ?? 0;
|
|
260
|
-
pdf += `${String(off).padStart(10, "0")} 00000 n \n`;
|
|
261
|
-
}
|
|
262
|
-
// Trailer
|
|
263
|
-
pdf += "trailer\n";
|
|
264
|
-
pdf += `<< /Size ${this.nextId} /Root ${this.catalogObjId} 0 R /Info ${this.infoObjId} 0 R >>\n`;
|
|
265
|
-
pdf += "startxref\n";
|
|
266
|
-
pdf += `${xrefOffset}\n`;
|
|
267
|
-
pdf += "%%EOF\n";
|
|
268
|
-
return Buffer.from(pdf, "latin1");
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
// ── Pure JS PDF Reader / Text Extractor ─────────────────────────────
|
|
272
|
-
function extractPdfText(buffer) {
|
|
273
|
-
const raw = buffer.toString("latin1");
|
|
274
|
-
const texts = [];
|
|
275
|
-
// Find all stream...endstream blocks
|
|
276
|
-
const streamRegex = /stream\r?\n([\s\S]*?)endstream/g;
|
|
277
|
-
let match;
|
|
278
|
-
while ((match = streamRegex.exec(raw)) !== null) {
|
|
279
|
-
let data = match[1];
|
|
280
|
-
// Remove trailing \r\n if present
|
|
281
|
-
if (data.endsWith("\r\n"))
|
|
282
|
-
data = data.slice(0, -2);
|
|
283
|
-
else if (data.endsWith("\n"))
|
|
284
|
-
data = data.slice(0, -1);
|
|
285
|
-
let decoded;
|
|
286
|
-
try {
|
|
287
|
-
// Try FlateDecode decompression
|
|
288
|
-
const buf = Buffer.from(data, "latin1");
|
|
289
|
-
const inflated = inflateSync(buf);
|
|
290
|
-
decoded = inflated.toString("latin1");
|
|
291
|
-
}
|
|
292
|
-
catch {
|
|
293
|
-
// Not compressed or different encoding, use raw
|
|
294
|
-
decoded = data;
|
|
295
|
-
}
|
|
296
|
-
// Extract text operators: Tj, TJ, ', "
|
|
297
|
-
const extracted = extractTextOperators(decoded);
|
|
298
|
-
if (extracted.trim()) {
|
|
299
|
-
texts.push(extracted);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
return texts.join("\n").trim();
|
|
303
|
-
}
|
|
304
|
-
function extractTextOperators(stream) {
|
|
305
|
-
const parts = [];
|
|
306
|
-
// Handle Tj operator: (text) Tj
|
|
307
|
-
const tjRegex = /\(([^)]*)\)\s*Tj/g;
|
|
308
|
-
let m;
|
|
309
|
-
while ((m = tjRegex.exec(stream)) !== null) {
|
|
310
|
-
parts.push(unescapePdfString(m[1]));
|
|
311
|
-
}
|
|
312
|
-
// Handle TJ operator: [(text) num (text) ...] TJ
|
|
313
|
-
const tjArrayRegex = /\[((?:[^]]*?))\]\s*TJ/g;
|
|
314
|
-
while ((m = tjArrayRegex.exec(stream)) !== null) {
|
|
315
|
-
const inner = m[1];
|
|
316
|
-
const strRegex = /\(([^)]*)\)/g;
|
|
317
|
-
let sm;
|
|
318
|
-
while ((sm = strRegex.exec(inner)) !== null) {
|
|
319
|
-
parts.push(unescapePdfString(sm[1]));
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
// Handle ' operator (move to next line and show text): (text) '
|
|
323
|
-
const quoteRegex = /\(([^)]*)\)\s*'/g;
|
|
324
|
-
while ((m = quoteRegex.exec(stream)) !== null) {
|
|
325
|
-
parts.push(unescapePdfString(m[1]));
|
|
326
|
-
}
|
|
327
|
-
// Handle " operator: num num (text) "
|
|
328
|
-
const dblQuoteRegex = /[\d.]+\s+[\d.]+\s+\(([^)]*)\)\s*"/g;
|
|
329
|
-
while ((m = dblQuoteRegex.exec(stream)) !== null) {
|
|
330
|
-
parts.push(unescapePdfString(m[1]));
|
|
331
|
-
}
|
|
332
|
-
// Also handle text positioning context: detect Td/TD for newlines
|
|
333
|
-
// Simple heuristic: check for significant Y changes between Tm/Td commands
|
|
334
|
-
// This gives rough line separation
|
|
335
|
-
if (parts.length === 0)
|
|
336
|
-
return "";
|
|
337
|
-
return parts.join(" ");
|
|
338
|
-
}
|
|
339
|
-
function unescapePdfString(s) {
|
|
340
|
-
return s
|
|
341
|
-
.replace(/\\n/g, "\n")
|
|
342
|
-
.replace(/\\r/g, "\r")
|
|
343
|
-
.replace(/\\t/g, "\t")
|
|
344
|
-
.replace(/\\\(/g, "(")
|
|
345
|
-
.replace(/\\\)/g, ")")
|
|
346
|
-
.replace(/\\\\/g, "\\");
|
|
347
|
-
}
|
|
348
|
-
function getPdfPageCount(buffer) {
|
|
349
|
-
const raw = buffer.toString("latin1");
|
|
350
|
-
// Look for /Pages ... /Count N
|
|
351
|
-
const countMatch = raw.match(/\/Type\s*\/Pages[^>]*\/Count\s+(\d+)/);
|
|
352
|
-
if (countMatch)
|
|
353
|
-
return parseInt(countMatch[1], 10);
|
|
354
|
-
// Alternative: /Count before /Type
|
|
355
|
-
const altMatch = raw.match(/\/Count\s+(\d+)[^>]*\/Type\s*\/Pages/);
|
|
356
|
-
if (altMatch)
|
|
357
|
-
return parseInt(altMatch[1], 10);
|
|
358
|
-
// Fallback: count /Type /Page (not /Pages)
|
|
359
|
-
const pageMatches = raw.match(/\/Type\s*\/Page(?!\s*s)\b/g);
|
|
360
|
-
return pageMatches ? pageMatches.length : 0;
|
|
361
|
-
}
|
|
362
|
-
function getPdfMetadata(buffer) {
|
|
363
|
-
const raw = buffer.toString("latin1");
|
|
364
|
-
const info = {};
|
|
365
|
-
// Find /Info dictionary reference or inline
|
|
366
|
-
const fields = ["Title", "Author", "Subject", "Creator", "Producer", "CreationDate", "ModDate", "Keywords"];
|
|
367
|
-
for (const field of fields) {
|
|
368
|
-
// Match /Field (value) or /Field <hex>
|
|
369
|
-
const regex = new RegExp(`\\/${field}\\s*\\(([^)]*)\\)`, "i");
|
|
370
|
-
const m = raw.match(regex);
|
|
371
|
-
if (m) {
|
|
372
|
-
info[field.toLowerCase()] = unescapePdfString(m[1]);
|
|
373
|
-
}
|
|
374
|
-
// Also try hex string
|
|
375
|
-
const hexRegex = new RegExp(`\\/${field}\\s*<([0-9a-fA-F]+)>`, "i");
|
|
376
|
-
const hm = raw.match(hexRegex);
|
|
377
|
-
if (hm && !info[field.toLowerCase()]) {
|
|
378
|
-
const hex = hm[1];
|
|
379
|
-
let str = "";
|
|
380
|
-
for (let i = 0; i < hex.length; i += 2) {
|
|
381
|
-
str += String.fromCharCode(parseInt(hex.substring(i, i + 2), 16));
|
|
382
|
-
}
|
|
383
|
-
info[field.toLowerCase()] = str;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
return info;
|
|
387
|
-
}
|
|
388
|
-
// ── Function Handlers ───────────────────────────────────────────────
|
|
389
|
-
const generate = async (args) => {
|
|
390
|
-
const outputPath = String(args[0] ?? "output.pdf");
|
|
391
|
-
const opts = (typeof args[1] === "object" && args[1] !== null ? args[1] : {});
|
|
392
|
-
const sizeKey = String(opts.size ?? "A4");
|
|
393
|
-
const [w, h] = PAGE_SIZES[sizeKey] ?? PAGE_SIZES.A4;
|
|
394
|
-
const margin = Number(opts.margin ?? 50);
|
|
395
|
-
const pdf = new PdfWriter();
|
|
396
|
-
pdf.setInfo({
|
|
397
|
-
title: opts.title ? String(opts.title) : "",
|
|
398
|
-
author: opts.author ? String(opts.author) : "",
|
|
399
|
-
});
|
|
400
|
-
pdf.initDocument(w, h, margin);
|
|
401
|
-
// Title
|
|
402
|
-
if (opts.title) {
|
|
403
|
-
pdf.setFont("Helvetica-Bold", Number(opts.titleSize ?? 24));
|
|
404
|
-
pdf.writeText(String(opts.title), { align: "center" });
|
|
405
|
-
pdf.moveDown();
|
|
406
|
-
}
|
|
407
|
-
// Author
|
|
408
|
-
if (opts.author) {
|
|
409
|
-
pdf.setFont("Helvetica", 12);
|
|
410
|
-
pdf.writeText(`By: ${opts.author}`, { align: "center" });
|
|
411
|
-
pdf.moveDown(2);
|
|
412
|
-
}
|
|
413
|
-
// Content
|
|
414
|
-
if (opts.content) {
|
|
415
|
-
pdf.setFont("Helvetica", Number(opts.fontSize ?? 12));
|
|
416
|
-
pdf.writeText(String(opts.content));
|
|
417
|
-
}
|
|
418
|
-
// Sections
|
|
419
|
-
if (Array.isArray(opts.sections)) {
|
|
420
|
-
for (const section of opts.sections) {
|
|
421
|
-
if (section.heading) {
|
|
422
|
-
pdf.moveDown();
|
|
423
|
-
pdf.setFont("Helvetica-Bold", Number(section.headingSize ?? 18));
|
|
424
|
-
pdf.writeText(String(section.heading));
|
|
425
|
-
pdf.moveDown(0.5);
|
|
426
|
-
}
|
|
427
|
-
if (section.text) {
|
|
428
|
-
pdf.setFont("Helvetica", Number(section.fontSize ?? 12));
|
|
429
|
-
pdf.writeText(String(section.text));
|
|
430
|
-
}
|
|
431
|
-
if (section.list && Array.isArray(section.list)) {
|
|
432
|
-
pdf.setFont("Helvetica", 12);
|
|
433
|
-
for (const item of section.list) {
|
|
434
|
-
pdf.writeText(` \u2022 ${item}`);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
if (section.pageBreak)
|
|
438
|
-
pdf.addPage();
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
// Footer - write on each page is complex with this approach;
|
|
442
|
-
// for simplicity we add footer text at bottom of last page if present
|
|
443
|
-
if (opts.footer) {
|
|
444
|
-
pdf.setFont("Helvetica", 10);
|
|
445
|
-
const footerY = margin;
|
|
446
|
-
pdf.textAt(String(opts.footer), w / 2 - estimateTextWidth(String(opts.footer), "Helvetica", 10) / 2, footerY);
|
|
447
|
-
}
|
|
448
|
-
const buf = pdf.toBuffer();
|
|
449
|
-
writeFileSync(outputPath, buf);
|
|
450
|
-
return { path: outputPath, pages: pdf.getPageCount() };
|
|
451
|
-
};
|
|
452
|
-
const parse = async (args) => {
|
|
453
|
-
const filePath = String(args[0] ?? "");
|
|
454
|
-
const buffer = readFileSync(filePath);
|
|
455
|
-
const text = extractPdfText(buffer);
|
|
456
|
-
const pages = getPdfPageCount(buffer);
|
|
457
|
-
const info = getPdfMetadata(buffer);
|
|
458
|
-
return {
|
|
459
|
-
text,
|
|
460
|
-
pages,
|
|
461
|
-
info,
|
|
462
|
-
metadata: info,
|
|
463
|
-
};
|
|
464
|
-
};
|
|
465
|
-
const extractText = async (args) => {
|
|
466
|
-
const filePath = String(args[0] ?? "");
|
|
467
|
-
const buffer = readFileSync(filePath);
|
|
468
|
-
return extractPdfText(buffer);
|
|
469
|
-
};
|
|
470
|
-
const pageCount = async (args) => {
|
|
471
|
-
const filePath = String(args[0] ?? "");
|
|
472
|
-
const buffer = readFileSync(filePath);
|
|
473
|
-
return getPdfPageCount(buffer);
|
|
474
|
-
};
|
|
475
|
-
const metadata = async (args) => {
|
|
476
|
-
const filePath = String(args[0] ?? "");
|
|
477
|
-
const buffer = readFileSync(filePath);
|
|
478
|
-
const info = getPdfMetadata(buffer);
|
|
479
|
-
const pages = getPdfPageCount(buffer);
|
|
480
|
-
return { info, metadata: info, pages };
|
|
481
|
-
};
|
|
482
|
-
const generateTable = async (args) => {
|
|
483
|
-
const outputPath = String(args[0] ?? "table.pdf");
|
|
484
|
-
const headers = Array.isArray(args[1]) ? args[1].map(String) : [];
|
|
485
|
-
const rows = Array.isArray(args[2]) ? args[2] : [];
|
|
486
|
-
const opts = (typeof args[3] === "object" && args[3] !== null ? args[3] : {});
|
|
487
|
-
const [w, h] = opts.landscape ? [841.89, 595.28] : [595.28, 841.89];
|
|
488
|
-
const margin = 40;
|
|
489
|
-
const pdf = new PdfWriter();
|
|
490
|
-
pdf.setInfo({ title: opts.title ? String(opts.title) : "" });
|
|
491
|
-
pdf.initDocument(w, h, margin);
|
|
492
|
-
if (opts.title) {
|
|
493
|
-
pdf.setFont("Helvetica-Bold", 16);
|
|
494
|
-
pdf.writeText(String(opts.title), { align: "center" });
|
|
495
|
-
pdf.moveDown();
|
|
496
|
-
}
|
|
497
|
-
const colWidth = (w - 2 * margin) / headers.length;
|
|
498
|
-
let y = pdf.getCursorY();
|
|
499
|
-
// Headers
|
|
500
|
-
pdf.setFont("Helvetica-Bold", 10);
|
|
501
|
-
headers.forEach((hdr, i) => {
|
|
502
|
-
pdf.textAt(hdr, margin + i * colWidth, y);
|
|
503
|
-
});
|
|
504
|
-
y -= 20;
|
|
505
|
-
pdf.drawLine(margin, y, w - margin, y);
|
|
506
|
-
y -= 5;
|
|
507
|
-
// Rows
|
|
508
|
-
pdf.setFont("Helvetica", 9);
|
|
509
|
-
for (const row of rows) {
|
|
510
|
-
const cells = Array.isArray(row) ? row.map(String) : Object.values(row).map(String);
|
|
511
|
-
if (y < margin + 30) {
|
|
512
|
-
pdf.addPage();
|
|
513
|
-
y = pdf.getCursorY();
|
|
514
|
-
}
|
|
515
|
-
cells.forEach((cell, i) => {
|
|
516
|
-
pdf.textAt(cell, margin + i * colWidth, y);
|
|
517
|
-
});
|
|
518
|
-
y -= 18;
|
|
519
|
-
}
|
|
520
|
-
const buf = pdf.toBuffer();
|
|
521
|
-
writeFileSync(outputPath, buf);
|
|
522
|
-
return { path: outputPath };
|
|
523
|
-
};
|
|
524
|
-
const generateFromHtml = async (args) => {
|
|
525
|
-
const outputPath = String(args[0] ?? "output.pdf");
|
|
526
|
-
const html = String(args[1] ?? "");
|
|
527
|
-
// Simple HTML to text conversion (basic support)
|
|
528
|
-
const text = html
|
|
529
|
-
.replace(/<h1[^>]*>(.*?)<\/h1>/gi, (_, t) => `\n\n### ${t}\n`)
|
|
530
|
-
.replace(/<h2[^>]*>(.*?)<\/h2>/gi, (_, t) => `\n\n## ${t}\n`)
|
|
531
|
-
.replace(/<h3[^>]*>(.*?)<\/h3>/gi, (_, t) => `\n# ${t}\n`)
|
|
532
|
-
.replace(/<p[^>]*>(.*?)<\/p>/gi, (_, t) => `${t}\n\n`)
|
|
533
|
-
.replace(/<br\s*\/?>/gi, "\n")
|
|
534
|
-
.replace(/<li[^>]*>(.*?)<\/li>/gi, (_, t) => `\u2022 ${t}\n`)
|
|
535
|
-
.replace(/<[^>]+>/g, "")
|
|
536
|
-
.replace(/&/g, "&")
|
|
537
|
-
.replace(/</g, "<")
|
|
538
|
-
.replace(/>/g, ">")
|
|
539
|
-
.replace(/"/g, '"')
|
|
540
|
-
.replace(/'/g, "'")
|
|
541
|
-
.trim();
|
|
542
|
-
return await generate([outputPath, { content: text }]);
|
|
543
|
-
};
|
|
544
|
-
// ── Exports ─────────────────────────────────────────────────────────
|
|
545
|
-
export const PdfFunctions = {
|
|
546
|
-
generate, parse, extractText, pageCount, metadata, generateTable, generateFromHtml,
|
|
547
|
-
};
|
|
548
|
-
export const PdfFunctionMetadata = {
|
|
549
|
-
generate: { description: "Generate a PDF document with title, content, and sections", parameters: [{ name: "outputPath", dataType: "string", description: "Output file path", formInputType: "text", required: true }, { name: "options", dataType: "object", description: "{title, author, content, sections, footer, size, margin, fontSize}", formInputType: "text", required: true }], returnType: "object", returnDescription: "{path, pages}", example: 'pdf.generate "./report.pdf" {"title": "Monthly Report", "content": "..."}' },
|
|
550
|
-
parse: { description: "Parse a PDF file and extract text, metadata, and page count", parameters: [{ name: "filePath", dataType: "string", description: "Path to PDF file", formInputType: "text", required: true }], returnType: "object", returnDescription: "{text, pages, info, metadata}", example: 'pdf.parse "./document.pdf"' },
|
|
551
|
-
extractText: { description: "Extract all text from a PDF file", parameters: [{ name: "filePath", dataType: "string", description: "Path to PDF file", formInputType: "text", required: true }], returnType: "string", returnDescription: "Extracted text content", example: 'pdf.extractText "./document.pdf"' },
|
|
552
|
-
pageCount: { description: "Get the number of pages in a PDF", parameters: [{ name: "filePath", dataType: "string", description: "Path to PDF file", formInputType: "text", required: true }], returnType: "number", returnDescription: "Page count", example: 'pdf.pageCount "./document.pdf"' },
|
|
553
|
-
metadata: { description: "Get PDF metadata (author, title, creation date, etc.)", parameters: [{ name: "filePath", dataType: "string", description: "Path to PDF file", formInputType: "text", required: true }], returnType: "object", returnDescription: "{info, metadata, pages}", example: 'pdf.metadata "./document.pdf"' },
|
|
554
|
-
generateTable: { description: "Generate a PDF with a formatted table", parameters: [{ name: "outputPath", dataType: "string", description: "Output file path", formInputType: "text", required: true }, { name: "headers", dataType: "array", description: "Column headers", formInputType: "text", required: true }, { name: "rows", dataType: "array", description: "Array of row arrays or objects", formInputType: "text", required: true }, { name: "options", dataType: "object", description: "{title, landscape}", formInputType: "text", required: false }], returnType: "object", returnDescription: "{path}", example: 'pdf.generateTable "./table.pdf" ["Name","Email"] $rows' },
|
|
555
|
-
generateFromHtml: { description: "Generate a PDF from basic HTML content", parameters: [{ name: "outputPath", dataType: "string", description: "Output file path", formInputType: "text", required: true }, { name: "html", dataType: "string", description: "HTML content", formInputType: "text", required: true }], returnType: "object", returnDescription: "{path, pages}", example: 'pdf.generateFromHtml "./output.pdf" "<h1>Title</h1><p>Content</p>"' },
|
|
556
|
-
};
|
|
557
|
-
export const PdfModuleMetadata = {
|
|
558
|
-
description: "PDF generation (documents, tables, HTML-to-PDF) and parsing (text extraction, metadata, page count)",
|
|
559
|
-
methods: ["generate", "parse", "extractText", "pageCount", "metadata", "generateTable", "generateFromHtml"],
|
|
560
|
-
};
|
|
561
|
-
//# sourceMappingURL=pdf.js.map
|
package/dist/pdf.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf.js","sourceRoot":"","sources":["../src/pdf.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAErD,uEAAuE;AAEvE,MAAM,UAAU,GAAqC;IACnD,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,CA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