feat(core): Enhanced document generation features and added translation capabilities
This commit is contained in:
@ -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.'
|
||||
}
|
||||
|
@ -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);
|
||||
|
5
ts/interfaces/document.ts
Normal file
5
ts/interfaces/document.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export interface IDocumentSettings {
|
||||
enableTopDraftText?: boolean;
|
||||
enableDefaultHeader?: boolean;
|
||||
enableDefaultFooter?: boolean;
|
||||
}
|
2
ts/interfaces/index.ts
Normal file
2
ts/interfaces/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './document.js';
|
||||
export * from './translation.js';
|
4
ts/interfaces/translation.ts
Normal file
4
ts/interfaces/translation.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface IDeDocumentTranslations {
|
||||
"invoice": string;
|
||||
"quantity": string;
|
||||
}
|
Reference in New Issue
Block a user