Skip to content

SudoSOS Back-end API / internal/pdf/invoice-html-pdf-service / InvoiceHtmlPdfService

Class: InvoiceHtmlPdfService ​

HTML-to-PDF service for entities that store PDFs. Similar to PdfService but uses HTML templates instead of LaTeX.

Extends ​

Constructors ​

Constructor ​

ts
new InvoiceHtmlPdfService(fileLocation, manager?): InvoiceHtmlPdfService;

Parameters ​

ParameterType
fileLocationstring
manager?EntityManager

Returns ​

InvoiceHtmlPdfService

Inherited from ​

HtmlPdfService.constructor

Properties ​

PropertyModifierTypeDefault valueDescriptionOverridesInherited from
clientprotectedClientundefined--HtmlPdfService.client
fileServicepublicFileServiceundefined--HtmlPdfService.fileService
htmlGeneratorpublic(options) => stringcreateInvoicePdfThe function that generates the HTML. This function should take a data object and return the complete HTML string.HtmlPdfService.htmlGenerator-
htmlPdfGenUrlprotectedstringundefined--HtmlPdfService.htmlPdfGenUrl
managerprotectedEntityManagerundefined--HtmlPdfService.manager
pdfConstructorpublictypeof InvoicePdfInvoicePdf-HtmlPdfService.pdfConstructor-

Methods ​

compileHtml() ​

ts
protected compileHtml(html): Promise<Buffer<ArrayBufferLike>>;

Compile HTML to PDF using the external service.

Parameters ​

ParameterType
htmlstring

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

HtmlPdfService.compileHtml


configureLogger() ​

ts
protected configureLogger(logger): void;

Parameters ​

ParameterType
loggerLogger

Returns ​

void

Inherited from ​

HtmlPdfService.configureLogger


createPdfBuffer() ​

ts
createPdfBuffer(entity): Promise<Buffer<ArrayBufferLike>>;

Create a PDF and return bytes.

Parameters ​

ParameterType
entityInvoice

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

HtmlPdfService.createPdfBuffer


createPdfWithEntity() ​

ts
createPdfWithEntity(entity): Promise<InvoicePdf>;

Persist the generated PDF and return the stored Pdf entity.

Parameters ​

ParameterType
entityInvoice

Returns ​

Promise<InvoicePdf>

Inherited from ​

HtmlPdfService.createPdfWithEntity


createRaw() ​

ts
createRaw(entity): Promise<Buffer<ArrayBufferLike>>;

Create raw HTML output (for debugging or preview).

Parameters ​

ParameterType
entityInvoice

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

HtmlPdfService.createRaw


getHtml() ​

ts
protected getHtml(entity): Promise<string>;

Apply parameters to the template and return the complete HTML.

Parameters ​

ParameterType
entityInvoice

Returns ​

Promise<string>

Inherited from ​

HtmlPdfService.getHtml


getParameters() ​

ts
getParameters(invoice): Promise<IInvoicePdf>;

Get the data object to use with the HTML template.

Parameters ​

ParameterType
invoiceInvoice

Returns ​

Promise<IInvoicePdf>

Overrides ​

HtmlPdfService.getParameters