src/module/pdf/subservices/PDFGenerator.markdown.ts
Properties |
|
Methods |
|
constructor(markdownService: MarkdownService)
|
||||||
Parameters :
|
Public generatePDF | ||||||
generatePDF(options: GeneratorOptions)
|
||||||
Inherited from
PDFGenerator
|
||||||
Defined in
PDFGenerator:15
|
||||||
Parameters :
Returns :
Promise<Buffer>
|
Protected Async generatePDFFromBodyContent | ||||||||
generatePDFFromBodyContent(body: string)
|
||||||||
Inherited from
PDFGenerator
|
||||||||
Defined in
PDFGenerator:31
|
||||||||
Generates a PDF from the given body. The body gets put in an HTML wrapper first.
Parameters :
Returns :
Promise<Buffer>
Buffer containing the generated PDF. |
Private Static getCustomCSS |
getCustomCSS()
|
Inherited from
PDFGenerator
|
Defined in
PDFGenerator:114
|
Returns :
string
Some small customizations to the GitHub markdown CSS. |
Private Async getGithubMarkdownCSS |
getGithubMarkdownCSS()
|
Inherited from
PDFGenerator
|
Defined in
PDFGenerator:88
|
Returns :
Promise<string>
The GitHub markdown CSS. |
Private Async getHighlightCSS |
getHighlightCSS()
|
Inherited from
PDFGenerator
|
Defined in
PDFGenerator:95
|
Returns :
Promise<string>
The HighlightJS CSS. |
Private Async loadCSSFile | ||||||
loadCSSFile(moduleName: string)
|
||||||
Inherited from
PDFGenerator
|
||||||
Defined in
PDFGenerator:99
|
||||||
Parameters :
Returns :
Promise<string>
|
Private Async putBodyInHTML | ||||||||
putBodyInHTML(body: string)
|
||||||||
Inherited from
PDFGenerator
|
||||||||
Defined in
PDFGenerator:69
|
||||||||
Puts the given body in corresponding a
Parameters :
Returns :
Promise<string>
Complete HTML "file" which contains the given |
Private Readonly logger |
Default value : new Logger(PDFGenerator.name)
|
Inherited from
PDFGenerator
|
Defined in
PDFGenerator:13
|
import { Injectable } from '@nestjs/common';
import { MarkdownService } from '../../markdown/markdown.service';
import { PDFGenerator } from './PDFGenerator.core';
interface GeneratorOptions {
markdown: string;
}
@Injectable()
export class MarkdownPDFGenerator extends PDFGenerator<GeneratorOptions> {
constructor(protected readonly markdownService: MarkdownService) {
super();
}
public generatePDF(options: GeneratorOptions): Promise<Buffer> {
const body = this.markdownService.generateHTMLFromMarkdown(options.markdown);
return this.generatePDFFromBodyContent(body);
}
}