mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
refactor: wip to nestjs
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { PageProperties, PdfFormat } from '@/libs/Chromiumly/_types';
|
||||
import { ChromiumlyHtmlConvert } from './ChromiumlyHtmlConvert.service';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class ChromiumlyTenancy {
|
||||
constructor(private htmlConvert: ChromiumlyHtmlConvert) {}
|
||||
|
||||
/**
|
||||
* Converts the given HTML content to PDF.
|
||||
* @param {string} content
|
||||
* @param {PageProperties} properties
|
||||
* @param {PdfFormat} pdfFormat
|
||||
* @returns {Promise<Buffer>}
|
||||
*/
|
||||
public convertHtmlContent(
|
||||
content: string,
|
||||
properties?: PageProperties,
|
||||
pdfFormat?: PdfFormat
|
||||
) {
|
||||
const parsedProperties = {
|
||||
margins: { top: 0, bottom: 0, left: 0, right: 0 },
|
||||
...properties,
|
||||
}
|
||||
return this.htmlConvert.convert(content, parsedProperties, pdfFormat);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user