diff --git a/changelog.md b/changelog.md
index 625fc76..5f4b0d9 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,13 @@
# Changelog
+## 2024-11-30 - 1.1.0 - feat(core)
+Enhanced document generation features and added translation capabilities
+
+- Updated document rendering with advanced modular architecture.
+- Introduced translation mechanism for document content.
+- Improved PDF generation with dynamic settings support.
+- Enhanced test cases for PDF generation with complex document structures.
+
## 2024-11-27 - 1.0.103 - fix(DeDocument)
Fix rendering of documents by properly moving new pages back to the document container
diff --git a/npmextra.json b/npmextra.json
index e03d2f0..de12191 100644
--- a/npmextra.json
+++ b/npmextra.json
@@ -5,7 +5,7 @@
"githost": "code.foss.global",
"gitscope": "designestate/private",
"gitrepo": "dedocument-catalog",
- "description": "A comprehensive solution for generating documents like invoices, integrating elements, templates, and services to streamline document creation.",
+ "description": "A versatile tool for dynamically generating and rendering business documents, such as invoices, using modern web technologies and elements.",
"npmPackagename": "@designestate_private/dedocument-catalog",
"license": "MIT",
"projectDomain": "design.estate",
@@ -14,19 +14,20 @@
"document generation",
"invoices",
"PDF creation",
- "typescript",
+ "TypeScript",
"web components",
- "custom elements",
- "QR code",
- "smart contracts",
"templating",
"dynamic rendering",
"responsive design",
- "modular development",
- "lightweight",
- "efficient",
- "finance",
- "business"
+ "business documentation",
+ "automated workflows",
+ "modular architecture",
+ "smart contracts",
+ "javascript",
+ "QR code",
+ "custom elements",
+ "nodejs",
+ "data-driven"
]
}
},
diff --git a/package.json b/package.json
index 1a230a8..f05a3da 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "@design.estate/dees-document",
"version": "1.0.103",
"private": false,
- "description": "A comprehensive solution for generating documents like invoices, integrating elements, templates, and services to streamline document creation.",
+ "description": "A versatile tool for dynamically generating and rendering business documents, such as invoices, using modern web technologies and elements.",
"main": "dist_ts_web/index.js",
"typings": "dist_ts_web/index.d.ts",
"exports": {
@@ -25,7 +25,7 @@
"@push.rocks/smartfile": "^11.0.21",
"@push.rocks/smartjson": "^5.0.20",
"@push.rocks/smartpath": "^5.0.18",
- "@push.rocks/smartpdf": "^3.1.7",
+ "@push.rocks/smartpdf": "^3.1.8",
"@push.rocks/smarttime": "^4.0.8",
"@tsclass/tsclass": "^4.1.2",
"@types/qrcode": "^1.5.5",
@@ -67,18 +67,19 @@
"document generation",
"invoices",
"PDF creation",
- "typescript",
+ "TypeScript",
"web components",
- "custom elements",
- "QR code",
- "smart contracts",
"templating",
"dynamic rendering",
"responsive design",
- "modular development",
- "lightweight",
- "efficient",
- "finance",
- "business"
+ "business documentation",
+ "automated workflows",
+ "modular architecture",
+ "smart contracts",
+ "javascript",
+ "QR code",
+ "custom elements",
+ "nodejs",
+ "data-driven"
]
-}
+}
\ No newline at end of file
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b534e42..c3e653d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -30,8 +30,8 @@ importers:
specifier: ^5.0.18
version: 5.0.18
'@push.rocks/smartpdf':
- specifier: ^3.1.7
- version: 3.1.7
+ specifier: ^3.1.8
+ version: 3.1.8
'@push.rocks/smarttime':
specifier: ^4.0.8
version: 4.0.8
@@ -268,8 +268,8 @@ packages:
resolution: {integrity: sha512-2Yv65nlWnWlSpe3fXEyX5i7fx5kIKo4Qbcj+hMO0odwaneFjfXw5fdum+4yL20O0QiaHpia0cYQ9xpNMqrBwHg==}
engines: {node: '>=6.9.0'}
- '@cloudflare/workers-types@4.20241112.0':
- resolution: {integrity: sha512-Q4p9bAWZrX14bSCKY9to19xl0KMU7nsO5sJ2cTVspHoypsjPUMeQCsjHjmsO2C4Myo8/LPeDvmqFmkyNAPPYZw==}
+ '@cloudflare/workers-types@4.20241127.0':
+ resolution: {integrity: sha512-UqlvtqV8eI0CdPR7nxlbVlE52+lcjHvGdbYXEPwisy23+39RsFV7OOy0da0moJAhqnL2OhDmWTOaKdsVcPHiJQ==}
'@colors/colors@1.6.0':
resolution: {integrity: sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==}
@@ -611,8 +611,8 @@ packages:
'@hapi/bourne@3.0.0':
resolution: {integrity: sha512-Waj1cwPXJDucOib4a3bAISsKJVb15MKi9IvmTI/7ssVEm6sywXGjVJDhl6/umt1pK1ZS7PacXU3A1PmFKHEZ2w==}
- '@happy-dom/global-registrator@15.11.6':
- resolution: {integrity: sha512-TGE7tUM3+0h47wfj2zS+madL53jVq3f2/YvJqrA/clwv3wz5Mm2jHhTpbLZSSydNvDwBc9l5uNt5qylWClj6uQ==}
+ '@happy-dom/global-registrator@15.11.7':
+ resolution: {integrity: sha512-mfOoUlIw8VBiJYPrl5RZfMzkXC/z7gbSpi2ecycrj/gRWLq2CMV+Q+0G+JPjeOmuNFgg0skEIzkVFzVYFP6URw==}
engines: {node: '>=18.0.0'}
'@isaacs/cliui@8.0.2':
@@ -835,8 +835,8 @@ packages:
'@push.rocks/smartpath@5.0.18':
resolution: {integrity: sha512-kIyRTlOoeEth5b4Qp8KPUxNOGNdvhb2aD0hbHfF3oGTQ0xnDdgB1l03/4bIoapHG48OrTgh4uQ5tUorykgdOzw==}
- '@push.rocks/smartpdf@3.1.7':
- resolution: {integrity: sha512-Qtyz4CnrxEcNSe09r4wpOdTwfu1pihBLYiPFkb9iwF3SrOK0rkH4qKXnsnYAVCumOoGdQdr3NhNjwpe9vqjoIw==}
+ '@push.rocks/smartpdf@3.1.8':
+ resolution: {integrity: sha512-9fxshJAp6VCkrAFWXAFS7X7QzZLFSWM/JzDtllYW7gaWzRKxsMCdfaNy1vKsGq5uK5L91Lrd+A9Olp1mx4xs1w==}
'@push.rocks/smartpromise@4.0.4':
resolution: {integrity: sha512-Mbh+DnX4+rVPEZgYU7LtTJI/AYoNn7+h27AycEFpPJW41DCfjTiXiI0+ecNdyO1AfbcL0Q02RQjoEauEWx5FQg==}
@@ -1409,8 +1409,8 @@ packages:
'@types/node-forge@1.3.11':
resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==}
- '@types/node@22.10.0':
- resolution: {integrity: sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==}
+ '@types/node@22.10.1':
+ resolution: {integrity: sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==}
'@types/parse5@6.0.3':
resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==}
@@ -2356,8 +2356,9 @@ packages:
resolution: {integrity: sha512-4kKdWXTtgQ4biIo7hZA396HT062nDVVHPjQcurNZ3o/voYN+o5FUC5kOwuORbpExp3XbTJ3SU7iRipiIhQtovw==}
engines: {node: '>=14'}
- gopd@1.0.1:
- resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==}
+ gopd@1.1.0:
+ resolution: {integrity: sha512-FQoVQnqcdk4hVM4JN1eromaun4iuS34oStkdlLENLdpULsuQcTyXj8w7ayhuUfPwEYZ1ZOooOTT6fdA9Vmx/RA==}
+ engines: {node: '>= 0.4'}
got@12.6.1:
resolution: {integrity: sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==}
@@ -2373,8 +2374,8 @@ packages:
resolution: {integrity: sha512-4haO1M4mLO91PW57BMsDFf75UmwoRX0GkdD+Faw+Lr+r/OZrOCS0pIBwOL1xCKQqnQzbNFGgK2V2CpBUPeFNTw==}
hasBin: true
- happy-dom@15.11.6:
- resolution: {integrity: sha512-elX7iUTu+5+3b2+NGQc0L3eWyq9jKhuJJ4GpOMxxT/c2pg9O3L5H3ty2VECX0XXZgRmmRqXyOK8brA2hDI6LsQ==}
+ happy-dom@15.11.7:
+ resolution: {integrity: sha512-KyrFvnl+J9US63TEzwoiJOQzZBJY7KgBushJA8X61DMbNsH+2ONkDuLDnCnwUiPTF42tLoEmrPyoqbenVA5zrg==}
engines: {node: '>=18.0.0'}
has-flag@3.0.0:
@@ -3287,8 +3288,8 @@ packages:
pdf-lib@1.17.1:
resolution: {integrity: sha512-V/mpyJAoTsN4cnP31vc0wfNA1+p20evqqnap0KLoRUN0Yk/p3wN52DOEsL4oBFcLdb76hlpKPtzJIgo67j/XLw==}
- pdf2json@3.0.5:
- resolution: {integrity: sha512-Un1yLbSlk/zfwrltgguskExIioXZlFSFwsyXU0cnBorLywbTbcdzmJJEebh+U2cFCtR7y8nDs5lPHAe7ldxjZg==}
+ pdf2json@3.1.4:
+ resolution: {integrity: sha512-rS+VapXpXZr+5lUpHmRh3ugXdFXp24p1RyG24yP1DMpqP4t0mrYNGpLtpSbWD42PnQ59GIXofxF+yWb7M+3THg==}
engines: {node: '>=18.12.1', npm: '>=8.19.2'}
hasBin: true
bundledDependencies:
@@ -3442,8 +3443,8 @@ packages:
regenerator-runtime@0.14.1:
resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==}
- registry-auth-token@5.0.2:
- resolution: {integrity: sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ==}
+ registry-auth-token@5.0.3:
+ resolution: {integrity: sha512-1bpc9IyC+e+CNFRaWyn77tk4xGG4PPUyfakSmA6F6cvUDjrm58dfyJ3II+9yb10EDkHoy1LaPSmHaWLOH3m6HA==}
engines: {node: '>=14'}
registry-url@6.0.1:
@@ -4121,7 +4122,7 @@ snapshots:
'@api.global/typedrequest': 3.1.10
'@api.global/typedrequest-interfaces': 3.0.19
'@api.global/typedsocket': 3.0.1
- '@cloudflare/workers-types': 4.20241112.0
+ '@cloudflare/workers-types': 4.20241127.0
'@design.estate/dees-comms': 1.0.27
'@push.rocks/lik': 6.1.0
'@push.rocks/smartchok': 1.0.34
@@ -4776,7 +4777,7 @@ snapshots:
dependencies:
regenerator-runtime: 0.14.1
- '@cloudflare/workers-types@4.20241112.0': {}
+ '@cloudflare/workers-types@4.20241127.0': {}
'@colors/colors@1.6.0': {}
@@ -5085,9 +5086,9 @@ snapshots:
'@hapi/bourne@3.0.0': {}
- '@happy-dom/global-registrator@15.11.6':
+ '@happy-dom/global-registrator@15.11.7':
dependencies:
- happy-dom: 15.11.6
+ happy-dom: 15.11.7
'@isaacs/cliui@8.0.2':
dependencies:
@@ -5111,7 +5112,7 @@ snapshots:
'@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.6
'@types/istanbul-reports': 3.0.4
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/yargs': 17.0.33
chalk: 4.1.2
@@ -5300,7 +5301,7 @@ snapshots:
'@push.rocks/smartbrowser@2.0.6':
dependencies:
'@push.rocks/smartdelay': 3.0.5
- '@push.rocks/smartpdf': 3.1.7
+ '@push.rocks/smartpdf': 3.1.8
'@push.rocks/smartpuppeteer': 2.0.2
'@push.rocks/smartunique': 3.0.9
transitivePeerDependencies:
@@ -5568,7 +5569,7 @@ snapshots:
'@push.rocks/smartntml@2.0.8':
dependencies:
'@design.estate/dees-element': 2.0.39
- '@happy-dom/global-registrator': 15.11.6
+ '@happy-dom/global-registrator': 15.11.7
'@push.rocks/smartpromise': 4.0.4
fake-indexeddb: 6.0.0
transitivePeerDependencies:
@@ -5585,7 +5586,7 @@ snapshots:
'@push.rocks/smartpath@5.0.18': {}
- '@push.rocks/smartpdf@3.1.7':
+ '@push.rocks/smartpdf@3.1.8':
dependencies:
'@push.rocks/smartbuffer': 3.0.4
'@push.rocks/smartdelay': 3.0.5
@@ -5596,10 +5597,10 @@ snapshots:
'@push.rocks/smartpuppeteer': 2.0.2
'@push.rocks/smartunique': 3.0.9
'@tsclass/tsclass': 4.1.2
- '@types/express': 4.17.21
+ '@types/express': 5.0.0
express: 4.21.1
pdf-lib: 1.17.1
- pdf2json: 3.0.5
+ pdf2json: 3.1.4
pdf2pic: 3.1.3
transitivePeerDependencies:
- bufferutil
@@ -6393,14 +6394,14 @@ snapshots:
'@types/accepts@1.3.7':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/babel__code-frame@7.0.6': {}
'@types/body-parser@1.19.5':
dependencies:
'@types/connect': 3.4.38
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/buffer-json@2.0.3': {}
@@ -6416,17 +6417,17 @@ snapshots:
'@types/clean-css@4.2.11':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
source-map: 0.6.1
'@types/co-body@6.1.3':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/qs': 6.9.17
'@types/connect@3.4.38':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/content-disposition@0.5.8': {}
@@ -6439,11 +6440,11 @@ snapshots:
'@types/connect': 3.4.38
'@types/express': 5.0.0
'@types/keygrip': 1.0.6
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/cors@2.8.17':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/debounce@1.2.4': {}
@@ -6457,14 +6458,14 @@ snapshots:
'@types/express-serve-static-core@4.19.6':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/qs': 6.9.17
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
'@types/express-serve-static-core@5.0.2':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/qs': 6.9.17
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
@@ -6489,30 +6490,30 @@ snapshots:
'@types/from2@2.3.5':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/fs-extra@11.0.4':
dependencies:
'@types/jsonfile': 6.1.4
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/fs-extra@9.0.13':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/glob@7.2.0':
dependencies:
'@types/minimatch': 5.1.2
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/glob@8.1.0':
dependencies:
'@types/minimatch': 5.1.2
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/gunzip-maybe@1.4.2':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/hast@3.0.4':
dependencies:
@@ -6546,7 +6547,7 @@ snapshots:
'@types/jsonfile@6.1.4':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/keygrip@1.0.6': {}
@@ -6563,7 +6564,7 @@ snapshots:
'@types/http-errors': 2.0.4
'@types/keygrip': 1.0.6
'@types/koa-compose': 3.2.8
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/mdast@4.0.4':
dependencies:
@@ -6581,9 +6582,9 @@ snapshots:
'@types/node-forge@1.3.11':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
- '@types/node@22.10.0':
+ '@types/node@22.10.1':
dependencies:
undici-types: 6.20.0
@@ -6593,7 +6594,7 @@ snapshots:
'@types/qrcode@1.5.5':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/qs@6.9.17': {}
@@ -6605,19 +6606,19 @@ snapshots:
'@types/s3rver@3.7.4':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/semver@7.5.8': {}
'@types/send@0.17.4':
dependencies:
'@types/mime': 1.3.5
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/serve-static@1.15.7':
dependencies:
'@types/http-errors': 2.0.4
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/send': 0.17.4
'@types/sinon-chai@3.2.12':
@@ -6637,11 +6638,11 @@ snapshots:
'@types/tar-stream@2.2.3':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/through2@2.0.41':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/triple-beam@1.3.5': {}
@@ -6665,7 +6666,7 @@ snapshots:
'@types/whatwg-url@8.2.2':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/webidl-conversions': 7.0.3
'@types/which@2.0.2': {}
@@ -6674,11 +6675,11 @@ snapshots:
'@types/ws@7.4.7':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/ws@8.5.13':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
'@types/yargs-parser@21.0.3': {}
@@ -6688,7 +6689,7 @@ snapshots:
'@types/yauzl@2.10.3':
dependencies:
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
optional: true
'@ungap/structured-clone@1.2.0': {}
@@ -7171,7 +7172,7 @@ snapshots:
dependencies:
es-define-property: 1.0.0
es-errors: 1.3.0
- gopd: 1.0.1
+ gopd: 1.1.0
define-lazy-prop@2.0.0: {}
@@ -7264,7 +7265,7 @@ snapshots:
dependencies:
'@types/cookie': 0.4.1
'@types/cors': 2.8.17
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
accepts: 1.3.8
base64id: 2.0.0
cookie: 0.4.2
@@ -7654,7 +7655,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
- gopd@1.0.1:
+ gopd@1.1.0:
dependencies:
get-intrinsic: 1.2.4
@@ -7685,7 +7686,7 @@ snapshots:
pumpify: 1.5.1
through2: 2.0.5
- happy-dom@15.11.6:
+ happy-dom@15.11.7:
dependencies:
entities: 4.5.0
webidl-conversions: 7.0.0
@@ -7955,7 +7956,7 @@ snapshots:
jest-util@29.7.0:
dependencies:
'@jest/types': 29.6.3
- '@types/node': 22.10.0
+ '@types/node': 22.10.1
chalk: 4.1.2
ci-info: 3.9.0
graceful-fs: 4.2.11
@@ -8734,7 +8735,7 @@ snapshots:
package-json@8.1.1:
dependencies:
got: 12.6.1
- registry-auth-token: 5.0.2
+ registry-auth-token: 5.0.3
registry-url: 6.0.1
semver: 7.6.3
@@ -8782,7 +8783,7 @@ snapshots:
pako: 1.0.11
tslib: 1.14.1
- pdf2json@3.0.5: {}
+ pdf2json@3.1.4: {}
pdf2pic@3.1.3:
dependencies:
@@ -8954,7 +8955,7 @@ snapshots:
regenerator-runtime@0.14.1: {}
- registry-auth-token@5.0.2:
+ registry-auth-token@5.0.3:
dependencies:
'@pnpm/npm-conf': 2.3.1
@@ -9115,7 +9116,7 @@ snapshots:
es-errors: 1.3.0
function-bind: 1.1.2
get-intrinsic: 1.2.4
- gopd: 1.0.1
+ gopd: 1.1.0
has-property-descriptors: 1.0.2
setprototypeof@1.1.0: {}
diff --git a/readme.md b/readme.md
index 4bc2050..3776773 100644
--- a/readme.md
+++ b/readme.md
@@ -1,26 +1,31 @@
# @design.estate/dees-document
-a catalog for creating documents like invoices
+
+A comprehensive solution for generating documents like invoices, integrating elements, templates, and services to streamline document creation.
## Install
-To install `@design.estate/dees-document`, run the following command in your project directory:
+
+To add `@design.estate/dees-document` to your project, run the following command in your terminal:
+
```shell
npm install @design.estate/dees-document --save
```
-This will add `@design.estate/dees-document` to your project's dependencies and ensure it's installed into your `node_modules` folder.
+This will install the package and add it to your project's dependencies, ensuring all required modules are available in your `node_modules` directory.
## Usage
-The `@design.estate/dees-document` package is a comprehensive toolkit for creating various types of documents, such as invoices, with ease. It leverages modern ECMAScript (ES) modules and TypeScript for a type-safe, developer-friendly experience. Below, you'll find detailed examples covering how to utilize the package to its full potential.
-### Setting Up the Document Service
-Before diving into creating documents, you first need to set up the document service. This involves importing the necessary modules and initializing the service instance.
+The `@design.estate/dees-document` package provides a robust framework for creating documents including invoices, contracts, and various other business-related documents. It is built on modern web technologies including TypeScript and ES modules to ensure a type-safe and easy-to-integrate experience. Below, we will guide you through the comprehensive usage of this package, from setting up your environment to generating PDF documents.
+
+### Getting Started
+
+Before creating documents, initialize the document service which is central to this package. This is typically done at the beginning of your application.
```typescript
import { PdfService, IPdfServiceConstructorOptions } from '@design.estate/dees-document';
async function setupPdfService() {
const options: IPdfServiceConstructorOptions = {
- // Configuration options here
+ // Add necessary configuration here
};
const pdfService = await PdfService.createAndStart(options);
@@ -29,100 +34,136 @@ async function setupPdfService() {
}
```
-In the example above, we import `PdfService` from the package and use its `createAndStart` method to initialize it with optional configuration settings. Replace `// Configuration options here` with any specific options your project may require.
+This script initializes `PdfService`. Modify the options to tailor the service to your needs.
-### Creating a Simple Invoice
-After setting up the document service, you can proceed to create documents such as invoices. Here, we'll demonstrate how to create a basic invoice.
+### Creating Documents
-#### Define the Invoice Data Structure
-First, define the basic structure of your invoice. This involves specifying details like the sender, recipient, items, and more.
+With the PDF service ready, you can proceed to generate documents. The following section provides a detailed example of creating an invoice. This example is applicable to various document types with necessary adjustments.
-```typescript
-import { ILetter } from '@design.estate/dees-document';
+#### Step-by-Step: Create an Invoice
-const invoiceData: ILetter = {
- from: {
- name: "Your Company Name",
- address: {
- streetName: "Your Street",
- houseNumber: "123",
- city: "Your City",
- country: "Your Country",
- postalCode: "12345",
- },
- email: "your-email@example.com",
- phone: "123-456-7890",
- },
- to: {
- name: "Recipient Company Name",
- address: {
- streetName: "Recipient Street",
- houseNumber: "456",
- city: "Recipient City",
- country: "Recipient Country",
- postalCode: "67890",
- },
- email: "recipient-email@example.com",
- phone: "098-765-4321",
- },
- content: {
- invoiceData: {
- items: [
- {
- name: "Service or Product Name",
- unitQuantity: 2,
- unitNetPrice: 100.00,
- unitType: 'service',
- vatPercentage: 19,
- currency: 'EUR',
- }
- ]
- }
- },
- subject: "Invoice for Services Rendered",
- date: new Date().getTime(),
- versionInfo: {
- type: "final",
- version: "1.0.0"
- },
-};
-```
+1. **Define the Data Structure**: Describe the invoice details. This includes sender and recipient information, the items being invoiced, and more.
-In this structure, `invoiceData` outlines essential details for an invoice document, using the `ILetter` interface. It includes information about both the sender (`from`) and the recipient (`to`), as well as the invoiced items under `content.invoiceData.items`.
+ ```typescript
+ import { ILetter } from '@design.estate/dees-document';
-#### Generate the Invoice PDF
-With the invoice data ready, you can now generate the PDF using the `PdfService` instance.
+ const invoiceData: ILetter = {
+ from: {
+ name: "Your Company Name",
+ address: {
+ streetName: "Your Street",
+ houseNumber: "123",
+ city: "Your City",
+ country: "Your Country",
+ postalCode: "12345",
+ },
+ email: "your-email@example.com",
+ phone: "123-456-7890",
+ },
+ to: {
+ name: "Recipient Company Name",
+ address: {
+ streetName: "Recipient Street",
+ houseNumber: "456",
+ city: "Recipient City",
+ country: "Recipient Country",
+ postalCode: "67890",
+ },
+ email: "recipient-email@example.com",
+ phone: "098-765-4321",
+ },
+ content: {
+ invoiceData: {
+ items: [
+ {
+ name: "Service or Product Name",
+ unitQuantity: 2,
+ unitNetPrice: 100.00,
+ unitType: 'service',
+ vatPercentage: 19,
+ currency: 'EUR',
+ }
+ ]
+ }
+ },
+ subject: "Invoice for Services Rendered",
+ date: new Date().getTime(),
+ versionInfo: {
+ type: "final",
+ version: "1.0.0"
+ },
+ };
+ ```
-```typescript
-async function generateInvoice(pdfService: PdfService, invoiceData: ILetter) {
- const pdfBuffer = await pdfService.createPdfFromLetterObject(invoiceData);
- console.log('Invoice PDF generated successfully.');
+ Here, `ILetter` interface details all components of an invoice including sender (`from`) and recipient (`to`) information, as well as the invoiced items.
- // Here, you can save the PDF to a file, send it over a network, etc.
-}
-```
+2. **Generate the PDF**: Transform the invoice details into a PDF.
-The method `createPdfFromLetterObject` receives the invoice data and returns a `Buffer` containing the PDF. You can then save this PDF to the filesystem, send it over email, or perform any other required actions.
+ ```typescript
+ async function generateInvoice(pdfService: PdfService, invoiceData: ILetter) {
+ const pdfBuffer = await pdfService.createPdfFromLetterObject(invoiceData);
+ console.log('Invoice PDF generated successfully.');
-#### Complete Example Integration
-Combining everything, your complete script to set up the service, define invoice data, and generate a PDF invoice might look something like this:
+ // Save the PDF, send it via email, etc.
+ }
+ ```
-```typescript
-async function main() {
- const pdfService = await setupPdfService();
- await generateInvoice(pdfService, invoiceData);
-}
+ The function `createPdfFromLetterObject` returns a `Buffer` containing the generated PDF. From here, you can save this PDF to a file, send it to clients, or archive it.
-main().then(() => console.log('Invoice generation process completed.'));
-```
+3. **Integrate It All**: Here's how everything ties together into a complete script for generating an invoice:
-### Beyond Invoices
-The `@design.estate/dees-document` package is not limited to invoices alone. It's designed to handle a wide range of document types. The modular architecture allows for the customizable construction of documents, enabling you to tailor the output to meet precise requirements.
+ ```typescript
+ async function main() {
+ const pdfService = await setupPdfService();
+ await generateInvoice(pdfService, invoiceData);
+ }
-For instance, you can create contracts, reports, and other document types using a similar approach—by defining the content structure and utilizing the PDF service to generate the document. The package's flexibility and extensibility make it an invaluable tool in any document generation workflow.
+ main().then(() => console.log('Invoice generation process completed.'));
+ ```
-### Advanced Usage
-For more advanced scenarios, such as custom styling, embedding images, and handling more complex document structures, refer to the package's documentation. It provides comprehensive details and examples to help you fully leverage the capabilities of `@design.estate/dees-document`.
+ This script initiates the PDF service and generates the invoice PDF with the provided information.
+
+### Advanced Document Features
+
+The package is designed to create not only invoices but a wide range of document types. Leverage its modular architecture to build and customize documents to fit specific needs.
+
+#### Advanced Scenarios
+
+1. **Custom Styling**: Customize the appearance of elements within your documents, such as headers, footers, and more.
+
+ ```typescript
+ import { DeDocumentViewer } from '@design.estate/dees-element';
+
+ const customStyledViewer = new DeDocumentViewer();
+ customStyledViewer.style.setProperty('--main-bg-color', 'lightblue');
+ document.body.appendChild(customStyledViewer);
+ ```
+
+ Customize via CSS or dynamically through TypeScript where necessary.
+
+2. **Interactive Document Elements**: Incorporate UI components like buttons, input fields, or visualizations tailored for your document needs.
+
+3. **Multi-page Document Generation**: Handle overflow of content and automatic page generation while maintaining headers and footers.
+
+ ```typescript
+ pdfService.adjustDePageScaling();
+ ```
+
+ Toggle between print and digital formats and handle scaling.
+
+4. **Embedding Images and Logos**: Add company logos, graphics, or auxiliary content to enhance document presentation.
+
+### Additional Capabilities
+
+Beyond these examples, delve deeper into advanced functionalities such as:
+
+- **Document Management**: Manage multiple document templates, manage versions, and add annotations or notes.
+- **Dynamic Rendering**: Use templating for dynamic content rendering based on variable inputs.
+- **Responsive Design for Digital Documents**: Ensure documents are displayed correctly across devices.
+
+### Concluding Remarks
+
+The `@design.estate/dees-document` package is an essential tool in the modern document generation ecosystem. Its expansive capabilities, from basic invoices to complex document templates, make it a versatile solution for businesses of all scales. Implementing this service broadly simplifies document management workflows and enhances document presentation precision and quality. For further depth, consult the package's documentation or explore the examples included in the module.
## License and Legal Information
diff --git a/test/test.ts b/test/test.ts
index d05604f..5f7f520 100644
--- a/test/test.ts
+++ b/test/test.ts
@@ -1,5 +1,6 @@
import * as plugins from './plugins.js';
import * as paths from './paths.js';
+import * as interfaces from '../ts/interfaces/index.js';
import { expect, tap } from '@push.rocks/tapbundle';
import * as deesDocumentServer from '../ts/index.js';
@@ -16,6 +17,9 @@ const testLetterData: plugins.tsclass.business.ILetter = {
id: 'XX-CLIENT-48765',
reverseCharge: true,
dueInDays: 30,
+ currency: 'EUR',
+ notes: [],
+ type: 'debitnote',
billedBy: {
address: null,
description: null,
@@ -102,116 +106,132 @@ tap.test('should create a document from an invoice', async () => {
tap.test('should create an invoice', async () => {
let counter = 0;
- const saveResult = async (letterDataArg: plugins.tsclass.business.ILetter) => {
- const pdfResult = await testPdfServiceInstance.createPdfFromLetterObject(letterDataArg);
- await plugins.smartfile.memory.toFs(Buffer.from(pdfResult.buffer), plugins.path.join(paths.nogitDir, `test-${counter++}.pdf`));
- }
- await saveResult(testLetterData);
+ const saveResult = async (optionsArg: {
+ letterData: plugins.tsclass.business.ILetter;
+ documentSettings: interfaces.IDocumentSettings;
+ }) => {
+ const pdfResult = await testPdfServiceInstance.createPdfFromLetterObject(optionsArg);
+ await plugins.smartfile.memory.toFs(
+ Buffer.from(pdfResult.buffer),
+ plugins.path.join(paths.nogitDir, `test-${counter++}.pdf`)
+ );
+ };
await saveResult({
- ...testLetterData,
- versionInfo: {
- type: 'draft',
- version: '1.0.0',
- }
+ letterData: testLetterData,
+ documentSettings: {},
});
- testLetterData.content.invoiceData.items = [
- {
- name: 'Website Creation',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 0,
- currency: 'EUR',
- },
- {
- name: 'Hosting',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 19,
- currency: 'EUR',
- },
- {
- name: 'Overnight Shipping',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 24,
- currency: 'EUR',
- },{
- name: 'Website Creation',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 0,
- currency: 'EUR',
- },
- {
- name: 'Hosting',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 19,
- currency: 'EUR',
- },
- {
- name: 'Overnight Shipping',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 24,
- currency: 'EUR',
- },{
- name: 'Website Creation',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 0,
- currency: 'EUR',
- },
- {
- name: 'Hosting',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 19,
- currency: 'EUR',
- },
- {
- name: 'Overnight Shipping',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 24,
- currency: 'EUR',
- },{
- name: 'Website Creation',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 0,
- currency: 'EUR',
- },
- {
- name: 'Hosting',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 19,
- currency: 'EUR',
- },
- {
- name: 'Overnight Shipping',
- unitQuantity: 1,
- unitNetPrice: 1200,
- unitType: 'item',
- vatPercentage: 24,
- currency: 'EUR',
- },
- ],
await saveResult({
- ...testLetterData,
- })
+ letterData: {
+ ...testLetterData,
+ versionInfo: {
+ type: 'draft',
+ version: '1.0.0',
+ },
+ },
+ documentSettings: {},
+ });
+ (testLetterData.content.invoiceData.items = [
+ {
+ name: 'Website Creation',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 0,
+ position: 1,
+ },
+ {
+ name: 'Hosting',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 19,
+ position: 2,
+ },
+ {
+ name: 'Overnight Shipping',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 24,
+ position: 3,
+ },
+ {
+ name: 'Website Creation',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 0,
+ position: 4,
+ },
+ {
+ name: 'Hosting',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 19,
+ position: 5,
+ },
+ {
+ name: 'Overnight Shipping',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 24,
+ position: 6,
+ },
+ {
+ name: 'Website Creation',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 0,
+ position: 7,
+ },
+ {
+ name: 'Hosting',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 19,
+ position: 8,
+ },
+ {
+ name: 'Overnight Shipping',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 24,
+ position: 9,
+ },
+ {
+ name: 'Website Creation',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 0,
+ position: 10,
+ },
+ {
+ name: 'Hosting',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 19,
+ position: 11,
+ },
+ {
+ name: 'Overnight Shipping',
+ unitQuantity: 1,
+ unitNetPrice: 1200,
+ unitType: 'item',
+ vatPercentage: 24,
+ position: 12,
+ },
+ ]),
+ await saveResult({
+ letterData: testLetterData,
+ documentSettings: {},
+ });
});
tap.test('should stop the service', async () => {
diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts
index 01f771e..78d15ee 100644
--- a/ts/00_commitinfo_data.ts
+++ b/ts/00_commitinfo_data.ts
@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@design.estate/dees-document',
- version: '1.0.103',
- description: 'A comprehensive solution for generating documents like invoices, integrating elements, templates, and services to streamline document creation.'
+ version: '1.1.0',
+ description: 'A versatile tool for dynamically generating and rendering business documents, such as invoices, using modern web technologies and elements.'
}
diff --git a/ts/classes.pdfservice.ts b/ts/classes.pdfservice.ts
index 49c5b14..83bee2f 100644
--- a/ts/classes.pdfservice.ts
+++ b/ts/classes.pdfservice.ts
@@ -1,6 +1,7 @@
import * as plugins from './plugins.js';
import * as paths from './paths.js';
import * as helpers from './helpers.js';
+import * as interfaces from '../ts/interfaces/index.js';
export interface IPdfServiceConstructorOptions {
@@ -44,12 +45,15 @@ export class PdfService {
/**
* creates an letter
*/
- public async createPdfFromLetterObject(letterDataArg: plugins.tsclass.business.ILetter) {
+ public async createPdfFromLetterObject(optionsArg: {
+ letterData: plugins.tsclass.business.ILetter,
+ documentSettings: interfaces.IDocumentSettings
+ }) {
const html = `
-