Skip to content

SudoSOS Back-end API / internal/pdf / HtmlUnstoredPdfService

Abstract Class: HtmlUnstoredPdfService<T, P> ​

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 ​

Extended by ​

Type Parameters ​

Type ParameterDefault type
T extends IUnstoredPdfAble-
P extends PdfTemplateParametersPdfTemplateParameters

Constructors ​

Constructor ​

ts
new HtmlUnstoredPdfService<T, P>(manager?): HtmlUnstoredPdfService<T, P>;

Parameters ​

ParameterType
manager?EntityManager

Returns ​

HtmlUnstoredPdfService<T, P>

Inherited from ​

BaseHtmlPdfService.constructor

Properties ​

PropertyModifierTypeDescriptionInherited from
clientprotectedClient-BaseHtmlPdfService.client
htmlGeneratorabstractHtmlGenerator<P>The function that generates the HTML. This function should take a data object and return the complete HTML string.BaseHtmlPdfService.htmlGenerator
htmlPdfGenUrlprotectedstring-BaseHtmlPdfService.htmlPdfGenUrl
managerprotectedEntityManager-BaseHtmlPdfService.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 ​

BaseHtmlPdfService.compileHtml


createPdfBuffer() ​

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

Create a PDF and return bytes.

Parameters ​

ParameterType
entityT

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

BaseHtmlPdfService.createPdfBuffer


createRaw() ​

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

Create raw HTML output (for debugging or preview).

Parameters ​

ParameterType
entityT

Returns ​

Promise<Buffer<ArrayBufferLike>>

Inherited from ​

BaseHtmlPdfService.createRaw


getHtml() ​

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

Apply parameters to the template and return the complete HTML.

Parameters ​

ParameterType
entityT

Returns ​

Promise<string>

Inherited from ​

BaseHtmlPdfService.getHtml


getParameters() ​

ts
abstract getParameters(entity): Promise<P>;

Get the data object to use with the HTML template.

Parameters ​

ParameterType
entityT

Returns ​

Promise<P>

Inherited from ​

BaseHtmlPdfService.getParameters