feat: migrate to new tsclass schema
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import * as helpers from './helpers.js';
|
||||
import * as plugins from "./plugins.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
|
||||
export interface IPdfServiceConstructorOptions {}
|
||||
|
||||
@@ -8,7 +8,9 @@ export interface IPdfServiceConstructorOptions {}
|
||||
*/
|
||||
export class PdfService {
|
||||
// STATIC
|
||||
public static async createAndStart(optionsArg: IPdfServiceConstructorOptions) {
|
||||
public static async createAndStart(
|
||||
optionsArg: IPdfServiceConstructorOptions
|
||||
) {
|
||||
const pdfService = new PdfService(optionsArg);
|
||||
await pdfService.start();
|
||||
return pdfService;
|
||||
@@ -42,17 +44,23 @@ export class PdfService {
|
||||
* creates an letter
|
||||
*/
|
||||
public async createPdfFromLetterObject(optionsArg: {
|
||||
letterData: plugins.tsclass.business.ILetter;
|
||||
letterData: plugins.tsclass.business.TLetter;
|
||||
documentSettings: plugins.shared.interfaces.IDocumentSettings;
|
||||
}) {
|
||||
}): Promise<plugins.smartpdf.IPdf> {
|
||||
const html = `
|
||||
<script type="module">
|
||||
${await helpers.getBundleAsString()}
|
||||
</script>
|
||||
<dedocument-dedocument printMode documentSettings="${plugins.smartjson.stringifyBase64(optionsArg.documentSettings)}" letterData="${plugins.smartjson.stringifyBase64(optionsArg.letterData)}"></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);
|
||||
const pdfResult = await this.smartpdfInstance.getA4PdfResultForHtmlString(
|
||||
html
|
||||
);
|
||||
return pdfResult;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user