feat(core): Enhanced document generation features and added translation capabilities

This commit is contained in:
2024-11-30 20:54:15 +01:00
parent e6cd135920
commit af77fcbe0e
18 changed files with 483 additions and 322 deletions

View File

@ -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.'
}

View File

@ -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 = `
<script type="module">
${await helpers.getBundleAsString()}
</script>
<dedocument-dedocument printMode letterData="${plugins.smartjson.stringifyBase64(letterDataArg)}"></dedocument-dedocument>
<dedocument-dedocument printMode documentSettings="${plugins.smartjson.stringifyBase64(optionsArg.documentSettings)}" letterData="${plugins.smartjson.stringifyBase64(optionsArg.letterData)}"></dedocument-dedocument>
`;
// console.log(html);
const pdfResult = await this.smartpdfInstance.getA4PdfResultForHtmlString(html);

View File

@ -0,0 +1,5 @@
export interface IDocumentSettings {
enableTopDraftText?: boolean;
enableDefaultHeader?: boolean;
enableDefaultFooter?: boolean;
}

2
ts/interfaces/index.ts Normal file
View File

@ -0,0 +1,2 @@
export * from './document.js';
export * from './translation.js';

View File

@ -0,0 +1,4 @@
export interface IDeDocumentTranslations {
"invoice": string;
"quantity": string;
}