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 ​
new TransactionPdfService(manager?): TransactionPdfService;Parameters ​
| Parameter | Type |
|---|---|
manager? | EntityManager |
Returns ​
TransactionPdfService
Inherited from ​
HtmlUnstoredPdfService.constructor
Properties ​
| Property | Modifier | Type | Default value | Description | Overrides | Inherited from |
|---|---|---|---|---|---|---|
client | protected | Client | undefined | - | - | HtmlUnstoredPdfService.client |
htmlGenerator | public | (options) => string | createTransactionPdf | The function that generates the HTML. This function should take a data object and return the complete HTML string. | HtmlUnstoredPdfService.htmlGenerator | - |
htmlPdfGenUrl | protected | string | undefined | - | - | HtmlUnstoredPdfService.htmlPdfGenUrl |
manager | protected | EntityManager | undefined | - | - | HtmlUnstoredPdfService.manager |
Methods ​
compileHtml() ​
protected compileHtml(html): Promise<Buffer<ArrayBufferLike>>;Compile HTML to PDF using the external service.
Parameters ​
| Parameter | Type |
|---|---|
html | string |
Returns ​
Promise<Buffer<ArrayBufferLike>>
Inherited from ​
HtmlUnstoredPdfService.compileHtml
createPdfBuffer() ​
createPdfBuffer(entity): Promise<Buffer<ArrayBufferLike>>;Create a PDF and return bytes.
Parameters ​
| Parameter | Type |
|---|---|
entity | Transaction |
Returns ​
Promise<Buffer<ArrayBufferLike>>
Inherited from ​
HtmlUnstoredPdfService.createPdfBuffer
createRaw() ​
createRaw(entity): Promise<Buffer<ArrayBufferLike>>;Create raw HTML output (for debugging or preview).
Parameters ​
| Parameter | Type |
|---|---|
entity | Transaction |
Returns ​
Promise<Buffer<ArrayBufferLike>>
Inherited from ​
HtmlUnstoredPdfService.createRaw
getHtml() ​
protected getHtml(entity): Promise<string>;Apply parameters to the template and return the complete HTML.
Parameters ​
| Parameter | Type |
|---|---|
entity | Transaction |
Returns ​
Promise<string>
Inherited from ​
HtmlUnstoredPdfService.getHtml
getParameters() ​
getParameters(entity): Promise<ITransactionPdf>;Get the data object to use with the HTML template.
Parameters ​
| Parameter | Type |
|---|---|
entity | Transaction |
Returns ​
Promise<ITransactionPdf>