Skip to content

SudoSOS Back-end API / internal/pdf/transaction-pdf-service / TransactionPdfService

Class: TransactionPdfService ​

HTML-to-PDF service for entities that don't store PDFs. It inherits createPdfBuffer and createRaw from BaseHtmlPdfService. It does not implement any stored interface.

Extends ​

Constructors ​

Constructor ​

ts
new TransactionPdfService(manager?): TransactionPdfService;

Parameters ​

ParameterType
manager?EntityManager

Returns ​

TransactionPdfService

Inherited from ​

HtmlUnstoredPdfService.constructor

Properties ​

PropertyModifierTypeDefault valueDescriptionOverridesInherited from
clientprotectedClientundefined--HtmlUnstoredPdfService.client
htmlGeneratorpublic(options) => stringcreateTransactionPdfThe function that generates the HTML. This function should take a data object and return the complete HTML string.HtmlUnstoredPdfService.htmlGenerator-
htmlPdfGenUrlprotectedstringundefined--HtmlUnstoredPdfService.htmlPdfGenUrl
managerprotectedEntityManagerundefined--HtmlUnstoredPdfService.manager

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 ​

HtmlUnstoredPdfService.compileHtml


createPdfBuffer() ​

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

Create a PDF and return bytes.

Parameters ​

ParameterType
entityTransaction

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

HtmlUnstoredPdfService.createPdfBuffer


createRaw() ​

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

Create raw HTML output (for debugging or preview).

Parameters ​

ParameterType
entityTransaction

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

HtmlUnstoredPdfService.createRaw


getHtml() ​

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

Apply parameters to the template and return the complete HTML.

Parameters ​

ParameterType
entityTransaction

Returns ​

Promise<string>

Inherited from ​

HtmlUnstoredPdfService.getHtml


getParameters() ​

ts
getParameters(entity): Promise<ITransactionPdf>;

Get the data object to use with the HTML template.

Parameters ​

ParameterType
entityTransaction

Returns ​

Promise<ITransactionPdf>

Overrides ​

HtmlUnstoredPdfService.getParameters