@design.estate/dees-document 1.6.9 → 2.0.3
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/dist_bundle/bundle.js +622 -605
- package/dist_bundle/bundle.js.map +4 -4
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.pdfservice.d.ts +3 -3
- package/dist_ts/classes.pdfservice.js +6 -3
- package/dist_ts/helpers.d.ts +1 -1
- package/dist_ts/helpers.js +2 -2
- package/dist_ts/paths.js +4 -2
- package/dist_ts/plugins.d.ts +2 -0
- package/dist_ts/plugins.js +3 -1
- package/dist_ts_shared/demoletter.d.ts +3 -3
- package/dist_ts_shared/demoletter.js +223 -192
- package/dist_ts_shared/index.d.ts +6 -7
- package/dist_ts_shared/index.js +10 -8
- package/dist_ts_shared/interfaces/document.d.ts +15 -2
- package/dist_ts_shared/interfaces/document.js +1 -1
- package/dist_ts_shared/translation.d.ts +79 -28
- package/dist_ts_shared/translation.js +121 -107
- package/dist_ts_web/ts_shared/translation.d.ts +82 -0
- package/dist_ts_web/ts_shared/translation.js +134 -0
- package/dist_ts_web/{00_commitinfo_data.js → ts_web/00_commitinfo_data.js} +2 -2
- package/dist_ts_web/{elements → ts_web/elements}/contentinvoice.d.ts +12 -6
- package/dist_ts_web/ts_web/elements/contentinvoice.js +466 -0
- package/dist_ts_web/{elements → ts_web/elements}/document.d.ts +10 -10
- package/dist_ts_web/ts_web/elements/document.demo.js +9 -0
- package/dist_ts_web/ts_web/elements/document.js +306 -0
- package/dist_ts_web/ts_web/elements/index.d.ts +10 -0
- package/dist_ts_web/ts_web/elements/index.js +11 -0
- package/dist_ts_web/ts_web/elements/letterheader.d.ts +18 -0
- package/dist_ts_web/ts_web/elements/letterheader.js +224 -0
- package/dist_ts_web/ts_web/elements/page.d.ts +25 -0
- package/dist_ts_web/ts_web/elements/page.js +335 -0
- package/dist_ts_web/{elements → ts_web/elements}/pagecontainer.d.ts +4 -4
- package/dist_ts_web/ts_web/elements/pagecontainer.js +114 -0
- package/dist_ts_web/{elements → ts_web/elements}/pagecontent.d.ts +7 -6
- package/dist_ts_web/ts_web/elements/pagecontent.js +177 -0
- package/dist_ts_web/ts_web/elements/pagefooter.d.ts +17 -0
- package/dist_ts_web/ts_web/elements/pagefooter.js +234 -0
- package/dist_ts_web/ts_web/elements/pageheader.d.ts +17 -0
- package/dist_ts_web/ts_web/elements/pageheader.js +165 -0
- package/dist_ts_web/ts_web/elements/paymentcode.d.ts +19 -0
- package/dist_ts_web/ts_web/elements/paymentcode.js +162 -0
- package/dist_ts_web/{elements → ts_web/elements}/viewer.d.ts +5 -5
- package/dist_ts_web/ts_web/elements/viewer.demo.js +9 -0
- package/dist_ts_web/ts_web/elements/viewer.js +150 -0
- package/dist_ts_web/{index.js → ts_web/index.js} +1 -1
- package/dist_ts_web/{pages → ts_web/pages}/index.js +1 -1
- package/dist_ts_web/ts_web/pages/page1.js +21 -0
- package/dist_ts_web/{pages → ts_web/pages}/page2.js +1 -1
- package/dist_ts_web/ts_web/plugins.js +14 -0
- package/dist_ts_web/ts_web/style.js +38 -0
- package/license +2 -2
- package/package.json +21 -19
- package/readme.hints.md +40 -1
- package/readme.md +202 -125
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.pdfservice.ts +15 -7
- package/ts/helpers.ts +1 -1
- package/ts/paths.ts +3 -1
- package/ts/plugins.ts +3 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/contentinvoice.ts +272 -250
- package/ts_web/elements/document.demo.ts +7 -4
- package/ts_web/elements/document.ts +68 -82
- package/ts_web/elements/index.ts +10 -9
- package/ts_web/elements/letterheader.ts +106 -39
- package/ts_web/elements/page.ts +106 -48
- package/ts_web/elements/pagecontainer.ts +14 -13
- package/ts_web/elements/pagecontent.ts +34 -53
- package/ts_web/elements/pagefooter.ts +125 -45
- package/ts_web/elements/pageheader.ts +22 -16
- package/ts_web/elements/paymentcode.ts +95 -0
- package/ts_web/elements/viewer.demo.ts +7 -4
- package/ts_web/elements/viewer.ts +26 -12
- package/ts_web/pages/page1.ts +10 -6
- package/ts_web/style.ts +34 -3
- package/dist_ts_shared/interfaces/translation.d.ts +0 -19
- package/dist_ts_shared/interfaces/translation.js +0 -2
- package/dist_ts_web/elements/contentinvoice.js +0 -388
- package/dist_ts_web/elements/document.demo.js +0 -6
- package/dist_ts_web/elements/document.js +0 -272
- package/dist_ts_web/elements/index.d.ts +0 -9
- package/dist_ts_web/elements/index.js +0 -10
- package/dist_ts_web/elements/letterheader.d.ts +0 -16
- package/dist_ts_web/elements/letterheader.js +0 -124
- package/dist_ts_web/elements/page.d.ts +0 -25
- package/dist_ts_web/elements/page.js +0 -219
- package/dist_ts_web/elements/pagecontainer.js +0 -67
- package/dist_ts_web/elements/pagecontent.js +0 -143
- package/dist_ts_web/elements/pagefooter.d.ts +0 -17
- package/dist_ts_web/elements/pagefooter.js +0 -138
- package/dist_ts_web/elements/pageheader.d.ts +0 -17
- package/dist_ts_web/elements/pageheader.js +0 -109
- package/dist_ts_web/elements/viewer.demo.js +0 -6
- package/dist_ts_web/elements/viewer.js +0 -101
- package/dist_ts_web/pages/page1.js +0 -17
- package/dist_ts_web/plugins.js +0 -14
- package/dist_ts_web/style.js +0 -7
- package/dist_watch/bundle.js +0 -40318
- package/dist_watch/bundle.js.map +0 -7
- package/dist_watch/index.html +0 -25
- /package/dist_ts_web/{00_commitinfo_data.d.ts → ts_web/00_commitinfo_data.d.ts} +0 -0
- /package/dist_ts_web/{elements → ts_web/elements}/document.demo.d.ts +0 -0
- /package/dist_ts_web/{elements → ts_web/elements}/viewer.demo.d.ts +0 -0
- /package/dist_ts_web/{index.d.ts → ts_web/index.d.ts} +0 -0
- /package/dist_ts_web/{pages → ts_web/pages}/index.d.ts +0 -0
- /package/dist_ts_web/{pages → ts_web/pages}/page1.d.ts +0 -0
- /package/dist_ts_web/{pages → ts_web/pages}/page2.d.ts +0 -0
- /package/dist_ts_web/{plugins.d.ts → ts_web/plugins.d.ts} +0 -0
- /package/dist_ts_web/{style.d.ts → ts_web/style.d.ts} +0 -0
package/readme.md
CHANGED
|
@@ -1,199 +1,276 @@
|
|
|
1
1
|
# @design.estate/dees-document
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A powerful TypeScript framework for dynamically generating professional business documents like invoices with web components and PDF export capabilities. 🧾
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Issue Reporting and Security
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
8
10
|
|
|
9
11
|
```shell
|
|
10
|
-
|
|
12
|
+
pnpm install @design.estate/dees-document
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
The `@design.estate/dees-document` package serves as a robust framework to facilitate the generation of business documents, such as invoices, contracts, and reports. Leveraging modern web technologies, this package integrates seamlessly with TypeScript and ES modules, offering a type-safe environment conducive to efficient, dynamic document creation.
|
|
18
|
-
|
|
19
|
-
Below, we provide a detailed guide for utilizing this package, from initializing your environment to generating complete PDF documents.
|
|
20
|
-
|
|
21
|
-
### Setting Up the Environment
|
|
22
|
-
|
|
23
|
-
Before diving into document creation, ensure your environment is properly configured. Make sure to import necessary dependencies and setup configurations:
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
import { PdfService, IPdfServiceConstructorOptions } from '@design.estate/dees-document';
|
|
27
|
-
|
|
28
|
-
async function setupPdfService() {
|
|
29
|
-
const options: IPdfServiceConstructorOptions = {
|
|
30
|
-
// Configure your options here
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const pdfService = await PdfService.createAndStart(options);
|
|
34
|
-
console.log('PDF Service started successfully.');
|
|
35
|
-
return pdfService;
|
|
36
|
-
}
|
|
37
|
-
```
|
|
15
|
+
## Features
|
|
38
16
|
|
|
39
|
-
|
|
17
|
+
- 📄 **PDF Generation** - Server-side PDF creation from structured data using Puppeteer
|
|
18
|
+
- 🎨 **Web Components** - Lit-based custom elements for document rendering
|
|
19
|
+
- 🌍 **Multi-language Support** - Built-in translation system (EN, DE, ES)
|
|
20
|
+
- 📱 **Automatic Pagination** - Smart content overflow handling across pages
|
|
21
|
+
- 💳 **QR Payment Codes** - EPC QR codes for SEPA payments
|
|
22
|
+
- 🖨️ **Print Mode** - Optimized rendering for both screen and print
|
|
23
|
+
- 📐 **A4 Format** - Precise DIN A4 document dimensions
|
|
24
|
+
- ✨ **Theming** - Customizable colors, backgrounds, and branding
|
|
40
25
|
|
|
41
|
-
|
|
26
|
+
## Usage
|
|
42
27
|
|
|
43
|
-
|
|
28
|
+
### Server-Side PDF Generation
|
|
44
29
|
|
|
45
30
|
```typescript
|
|
46
|
-
import {
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
import { PdfService } from '@design.estate/dees-document';
|
|
32
|
+
import type { TInvoice } from '@tsclass/tsclass/finance';
|
|
33
|
+
|
|
34
|
+
// Initialize the PDF service
|
|
35
|
+
const pdfService = new PdfService({});
|
|
36
|
+
await pdfService.start();
|
|
37
|
+
|
|
38
|
+
// Create invoice data
|
|
39
|
+
const invoice: TInvoice = {
|
|
40
|
+
type: 'invoice',
|
|
41
|
+
invoiceType: 'debitnote',
|
|
42
|
+
id: 'INV-2024-001',
|
|
43
|
+
invoiceId: 'INV-2024-001',
|
|
44
|
+
date: Date.now(),
|
|
45
|
+
currency: 'EUR',
|
|
46
|
+
dueInDays: 30,
|
|
47
|
+
reverseCharge: false,
|
|
49
48
|
from: {
|
|
50
|
-
name: 'Your Company
|
|
49
|
+
name: 'Your Company GmbH',
|
|
50
|
+
type: 'company',
|
|
51
|
+
status: 'active',
|
|
51
52
|
address: {
|
|
52
|
-
streetName: '
|
|
53
|
+
streetName: 'Business Street',
|
|
53
54
|
houseNumber: '123',
|
|
54
|
-
city: '
|
|
55
|
-
country: '
|
|
56
|
-
postalCode: '
|
|
55
|
+
city: 'Berlin',
|
|
56
|
+
country: 'Germany',
|
|
57
|
+
postalCode: '10115',
|
|
58
|
+
},
|
|
59
|
+
sepaConnection: {
|
|
60
|
+
bic: 'DEUTDEFF',
|
|
61
|
+
iban: 'DE89370400440532013000',
|
|
62
|
+
},
|
|
63
|
+
registrationDetails: {
|
|
64
|
+
vatId: 'DE123456789',
|
|
65
|
+
registrationName: 'Amtsgericht Berlin',
|
|
66
|
+
registrationId: 'HRB 12345',
|
|
57
67
|
},
|
|
58
|
-
email: 'your-email@example.com',
|
|
59
|
-
phone: '123-456-7890',
|
|
60
68
|
},
|
|
61
69
|
to: {
|
|
62
|
-
name: '
|
|
70
|
+
name: 'Customer Inc.',
|
|
71
|
+
type: 'company',
|
|
72
|
+
status: 'active',
|
|
63
73
|
address: {
|
|
64
|
-
streetName: '
|
|
74
|
+
streetName: 'Client Avenue',
|
|
65
75
|
houseNumber: '456',
|
|
66
|
-
city: '
|
|
67
|
-
country: '
|
|
68
|
-
postalCode: '
|
|
76
|
+
city: 'Munich',
|
|
77
|
+
country: 'Germany',
|
|
78
|
+
postalCode: '80331',
|
|
69
79
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
content: {
|
|
74
|
-
invoiceData: {
|
|
75
|
-
items: [
|
|
76
|
-
{
|
|
77
|
-
name: 'Service or Product Name',
|
|
78
|
-
unitQuantity: 2,
|
|
79
|
-
unitNetPrice: 100.0,
|
|
80
|
-
unitType: 'service',
|
|
81
|
-
vatPercentage: 19,
|
|
82
|
-
currency: 'EUR',
|
|
83
|
-
},
|
|
84
|
-
],
|
|
80
|
+
registrationDetails: {
|
|
81
|
+
vatId: 'DE987654321',
|
|
85
82
|
},
|
|
86
83
|
},
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
items: [
|
|
85
|
+
{
|
|
86
|
+
name: 'Web Development Services',
|
|
87
|
+
unitQuantity: 40,
|
|
88
|
+
unitNetPrice: 95,
|
|
89
|
+
unitType: 'hours',
|
|
90
|
+
vatPercentage: 19,
|
|
91
|
+
position: 1,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'Hosting (Annual)',
|
|
95
|
+
unitQuantity: 1,
|
|
96
|
+
unitNetPrice: 299,
|
|
97
|
+
unitType: 'item',
|
|
98
|
+
vatPercentage: 19,
|
|
99
|
+
position: 2,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
subject: 'Invoice INV-2024-001',
|
|
89
103
|
versionInfo: {
|
|
90
104
|
type: 'final',
|
|
91
105
|
version: '1.0.0',
|
|
92
106
|
},
|
|
93
107
|
};
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
The `invoiceTemplate` object utilizes the `ILetter` interface which specifies the structure for invoice data, including sender and recipient details, itemization, and pricing.
|
|
97
108
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
109
|
+
// Generate PDF
|
|
110
|
+
const pdfResult = await pdfService.createPdfFromLetterObject({
|
|
111
|
+
letterData: invoice,
|
|
112
|
+
documentSettings: {
|
|
113
|
+
languageCode: 'EN',
|
|
114
|
+
enableDefaultHeader: true,
|
|
115
|
+
enableDefaultFooter: true,
|
|
116
|
+
enableFoldMarks: true,
|
|
117
|
+
dateStyle: 'long',
|
|
118
|
+
},
|
|
119
|
+
});
|
|
101
120
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
121
|
+
// Save to file
|
|
122
|
+
import { SmartFs, SmartFsProviderNode } from '@push.rocks/smartfs';
|
|
123
|
+
const fs = new SmartFs(new SmartFsProviderNode());
|
|
124
|
+
await fs.file('./invoice.pdf').write(Buffer.from(pdfResult.buffer));
|
|
106
125
|
|
|
107
|
-
|
|
108
|
-
|
|
126
|
+
// Don't forget to stop the service when done
|
|
127
|
+
await pdfService.stop();
|
|
109
128
|
```
|
|
110
129
|
|
|
111
|
-
|
|
130
|
+
### Document Settings
|
|
112
131
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Below is an example integrating all previous steps into a single coherent script:
|
|
132
|
+
Customize document appearance with `IDocumentSettings`:
|
|
116
133
|
|
|
117
134
|
```typescript
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
135
|
+
const documentSettings = {
|
|
136
|
+
// Language for translations
|
|
137
|
+
languageCode: 'DE', // 'EN' | 'DE' | 'ES'
|
|
138
|
+
|
|
139
|
+
// Layout options
|
|
140
|
+
enableDefaultHeader: true,
|
|
141
|
+
enableDefaultFooter: true,
|
|
142
|
+
enableFoldMarks: true,
|
|
143
|
+
enableTopDraftText: true,
|
|
144
|
+
enableInvoiceContractRefSection: true,
|
|
145
|
+
|
|
146
|
+
// Display options
|
|
147
|
+
vatGroupPositions: true,
|
|
148
|
+
dateStyle: 'long', // 'short' | 'medium' | 'long' | 'full'
|
|
149
|
+
|
|
150
|
+
// Theming
|
|
151
|
+
theme: {
|
|
152
|
+
colorPrimaryForeground: '#ffffff',
|
|
153
|
+
colorPrimaryBackground: '#e4002b',
|
|
154
|
+
colorAccentForeground: '#333333',
|
|
155
|
+
colorAccentBackground: '#f5f5f5',
|
|
156
|
+
pageBackground: 'url(your-watermark.png)',
|
|
157
|
+
coverPageBackground: 'url(your-cover.png)',
|
|
158
|
+
},
|
|
159
|
+
};
|
|
127
160
|
```
|
|
128
161
|
|
|
129
|
-
|
|
162
|
+
### Web Component Usage
|
|
130
163
|
|
|
131
|
-
|
|
164
|
+
For browser-based document viewing:
|
|
132
165
|
|
|
133
|
-
|
|
166
|
+
```typescript
|
|
167
|
+
import '@design.estate/dees-document/web';
|
|
168
|
+
|
|
169
|
+
// In your HTML/Lit template
|
|
170
|
+
html`
|
|
171
|
+
<dedocument-viewer
|
|
172
|
+
.letterData=${invoiceData}
|
|
173
|
+
.documentSettings=${documentSettings}
|
|
174
|
+
></dedocument-viewer>
|
|
175
|
+
`;
|
|
176
|
+
|
|
177
|
+
// Or render the document directly
|
|
178
|
+
html`
|
|
179
|
+
<dedocument-dedocument
|
|
180
|
+
.letterData=${invoiceData}
|
|
181
|
+
.documentSettings=${documentSettings}
|
|
182
|
+
></dedocument-dedocument>
|
|
183
|
+
`;
|
|
184
|
+
```
|
|
134
185
|
|
|
135
|
-
|
|
186
|
+
### Translation System
|
|
136
187
|
|
|
137
|
-
|
|
138
|
-
- Templates can be adjusted to present different document types (e.g., contracts, reports).
|
|
188
|
+
The package includes a translation system for multi-language document generation:
|
|
139
189
|
|
|
140
|
-
|
|
190
|
+
```typescript
|
|
191
|
+
import { translate } from '@design.estate/dees-document/shared';
|
|
141
192
|
|
|
142
|
-
|
|
193
|
+
// Translate document labels
|
|
194
|
+
translate('DE', 'invoice@@totalGross'); // "Gesamtbetrag (Brutto)"
|
|
195
|
+
translate('EN', 'invoice@@totalGross'); // "Total (Gross)"
|
|
196
|
+
translate('ES', 'invoice@@totalGross'); // "Total (Bruto)"
|
|
197
|
+
```
|
|
143
198
|
|
|
144
|
-
|
|
199
|
+
## Module Exports
|
|
145
200
|
|
|
146
|
-
|
|
201
|
+
The package provides multiple entry points:
|
|
147
202
|
|
|
148
|
-
|
|
203
|
+
```typescript
|
|
204
|
+
// Node.js server-side (PDF generation)
|
|
205
|
+
import { PdfService } from '@design.estate/dees-document';
|
|
206
|
+
import { PdfService } from '@design.estate/dees-document/node';
|
|
149
207
|
|
|
150
|
-
|
|
208
|
+
// Browser web components
|
|
209
|
+
import '@design.estate/dees-document/web';
|
|
151
210
|
|
|
152
|
-
|
|
211
|
+
// Shared utilities and types
|
|
212
|
+
import { translate, IDocumentSettings } from '@design.estate/dees-document/shared';
|
|
153
213
|
|
|
154
|
-
|
|
214
|
+
// TypeScript interfaces
|
|
215
|
+
import type { IDocumentSettings } from '@design.estate/dees-document/interfaces';
|
|
216
|
+
```
|
|
155
217
|
|
|
156
|
-
|
|
218
|
+
## Document Components
|
|
157
219
|
|
|
158
|
-
|
|
220
|
+
The framework includes these web components:
|
|
159
221
|
|
|
160
|
-
|
|
161
|
-
|
|
222
|
+
| Component | Description |
|
|
223
|
+
|-----------|-------------|
|
|
224
|
+
| `<dedocument-dedocument>` | Main document container with pagination |
|
|
225
|
+
| `<dedocument-viewer>` | Document viewer with controls |
|
|
226
|
+
| `<dedocument-page>` | Single A4 page with scaling support |
|
|
227
|
+
| `<dedocument-pageheader>` | Company logo and branding header |
|
|
228
|
+
| `<dedocument-letterheader>` | Sender/recipient addresses |
|
|
229
|
+
| `<dedocument-pagecontent>` | Main content area |
|
|
230
|
+
| `<dedocument-pagefooter>` | Company info and page numbers |
|
|
231
|
+
| `<dedocument-contentinvoice>` | Invoice-specific content layout |
|
|
232
|
+
| `<dedocument-paymentcode>` | EPC QR code for SEPA payments |
|
|
162
233
|
|
|
163
|
-
|
|
234
|
+
## Draft vs Final Documents
|
|
164
235
|
|
|
165
|
-
|
|
236
|
+
Control document version display:
|
|
166
237
|
|
|
167
238
|
```typescript
|
|
168
|
-
|
|
239
|
+
const invoice = {
|
|
240
|
+
// ... other fields
|
|
241
|
+
versionInfo: {
|
|
242
|
+
type: 'draft', // Shows watermark "DRAFT" across pages
|
|
243
|
+
version: '0.1.0',
|
|
244
|
+
},
|
|
245
|
+
};
|
|
169
246
|
|
|
170
|
-
|
|
171
|
-
|
|
247
|
+
// For final documents
|
|
248
|
+
const invoice = {
|
|
249
|
+
// ... other fields
|
|
250
|
+
versionInfo: {
|
|
251
|
+
type: 'final', // Clean document without watermark
|
|
252
|
+
version: '1.0.0',
|
|
253
|
+
},
|
|
254
|
+
};
|
|
172
255
|
```
|
|
173
256
|
|
|
174
|
-
Different language settings can be applied, enabling the seamless presentation of document contents tailored to regional and linguistic preferences.
|
|
175
|
-
|
|
176
|
-
### Conclusion
|
|
177
|
-
|
|
178
|
-
The `@design.estate/dees-document` package is a versatile and powerful solution for businesses seeking to automate and streamline their document generation processes using modern web technologies. By integrating seamlessly with TypeScript, it offers robust capabilities for creating complex, customizable, and interactive documents that can meet a variety of business needs.
|
|
179
|
-
|
|
180
|
-
From custom templates to localization and advanced security features, this module provides the flexibility and power to create polished and professional documents efficiently. Whether you're generating invoices, contracts, or detailed reports, `@design.estate/dees-document` has the tools to support your enterprise workflows with ease and precision.
|
|
181
|
-
|
|
182
257
|
## License and Legal Information
|
|
183
258
|
|
|
184
|
-
This repository contains open-source code
|
|
259
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
|
|
185
260
|
|
|
186
261
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
187
262
|
|
|
188
263
|
### Trademarks
|
|
189
264
|
|
|
190
|
-
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein.
|
|
265
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
|
|
266
|
+
|
|
267
|
+
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
|
191
268
|
|
|
192
269
|
### Company Information
|
|
193
270
|
|
|
194
|
-
Task Venture Capital GmbH
|
|
195
|
-
Registered at District
|
|
271
|
+
Task Venture Capital GmbH
|
|
272
|
+
Registered at District Court Bremen HRB 35230 HB, Germany
|
|
196
273
|
|
|
197
|
-
For any legal inquiries or
|
|
274
|
+
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
198
275
|
|
|
199
276
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-document',
|
|
6
|
-
version: '
|
|
6
|
+
version: '2.0.2',
|
|
7
7
|
description: 'A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.'
|
|
8
8
|
}
|
package/ts/classes.pdfservice.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as plugins from
|
|
2
|
-
import * as helpers from
|
|
1
|
+
import * as plugins from "./plugins.js";
|
|
2
|
+
import * as helpers from "./helpers.js";
|
|
3
3
|
|
|
4
4
|
export interface IPdfServiceConstructorOptions {}
|
|
5
5
|
|
|
@@ -8,7 +8,9 @@ export interface IPdfServiceConstructorOptions {}
|
|
|
8
8
|
*/
|
|
9
9
|
export class PdfService {
|
|
10
10
|
// STATIC
|
|
11
|
-
public static async createAndStart(
|
|
11
|
+
public static async createAndStart(
|
|
12
|
+
optionsArg: IPdfServiceConstructorOptions
|
|
13
|
+
) {
|
|
12
14
|
const pdfService = new PdfService(optionsArg);
|
|
13
15
|
await pdfService.start();
|
|
14
16
|
return pdfService;
|
|
@@ -42,17 +44,23 @@ export class PdfService {
|
|
|
42
44
|
* creates an letter
|
|
43
45
|
*/
|
|
44
46
|
public async createPdfFromLetterObject(optionsArg: {
|
|
45
|
-
letterData: plugins.tsclass.business.
|
|
47
|
+
letterData: plugins.tsclass.business.TLetter;
|
|
46
48
|
documentSettings: plugins.shared.interfaces.IDocumentSettings;
|
|
47
|
-
}) {
|
|
49
|
+
}): Promise<plugins.smartpdf.IPdf> {
|
|
48
50
|
const html = `
|
|
49
51
|
<script type="module">
|
|
50
52
|
${await helpers.getBundleAsString()}
|
|
51
53
|
</script>
|
|
52
|
-
<dedocument-dedocument printMode documentSettings="${plugins.smartjson.stringifyBase64(
|
|
54
|
+
<dedocument-dedocument printMode documentSettings="${plugins.smartjson.stringifyBase64(
|
|
55
|
+
optionsArg.documentSettings
|
|
56
|
+
)}" letterData="${plugins.smartjson.stringifyBase64(
|
|
57
|
+
optionsArg.letterData
|
|
58
|
+
)}"></dedocument-dedocument>
|
|
53
59
|
`;
|
|
54
60
|
// console.log(html);
|
|
55
|
-
const pdfResult = await this.smartpdfInstance.getA4PdfResultForHtmlString(
|
|
61
|
+
const pdfResult = await this.smartpdfInstance.getA4PdfResultForHtmlString(
|
|
62
|
+
html
|
|
63
|
+
);
|
|
56
64
|
return pdfResult;
|
|
57
65
|
}
|
|
58
66
|
}
|
package/ts/helpers.ts
CHANGED
package/ts/paths.ts
CHANGED
|
@@ -6,7 +6,9 @@ export const packageDir = plugins.path.join(
|
|
|
6
6
|
);
|
|
7
7
|
|
|
8
8
|
export const nogitDir = plugins.path.join(packageDir, '.nogit/');
|
|
9
|
-
plugins.
|
|
9
|
+
if (!(await plugins.smartfs.directory(nogitDir).exists())) {
|
|
10
|
+
await plugins.smartfs.directory(nogitDir).create();
|
|
11
|
+
}
|
|
10
12
|
|
|
11
13
|
export const bundleDir = plugins.path.join(packageDir, './dist_bundle');
|
|
12
14
|
export const bundleFile = plugins.path.join(bundleDir, './bundle.js');
|
package/ts/plugins.ts
CHANGED
|
@@ -10,10 +10,13 @@ export { shared };
|
|
|
10
10
|
|
|
11
11
|
// @push.rocks/scope
|
|
12
12
|
import * as smartfile from '@push.rocks/smartfile';
|
|
13
|
+
import { SmartFs, SmartFsProviderNode } from '@push.rocks/smartfs';
|
|
13
14
|
import * as smartjson from '@push.rocks/smartjson';
|
|
14
15
|
import * as smartpath from '@push.rocks/smartpath';
|
|
15
16
|
import * as smartpdf from '@push.rocks/smartpdf';
|
|
16
17
|
|
|
18
|
+
export const smartfs = new SmartFs(new SmartFsProviderNode());
|
|
19
|
+
|
|
17
20
|
export { smartfile, smartpath, smartjson, smartpdf };
|
|
18
21
|
|
|
19
22
|
// @tsclass scope
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-document',
|
|
6
|
-
version: '
|
|
6
|
+
version: '2.0.2',
|
|
7
7
|
description: 'A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.'
|
|
8
8
|
}
|