parent
b82a32ae3e
commit
5ba26c4cbf
@ -192,6 +192,7 @@ export class PdfCreator {
|
|||||||
*/
|
*/
|
||||||
public async imgToBase64(html): Promise<string> {
|
public async imgToBase64(html): Promise<string> {
|
||||||
const $ = cheerio.load(html)
|
const $ = cheerio.load(html)
|
||||||
|
|
||||||
$('img').each(async (index, element) => {
|
$('img').each(async (index, element) => {
|
||||||
let imgsrc = $(element).attr("src");
|
let imgsrc = $(element).attr("src");
|
||||||
if (imgsrc.startsWith("data:image")) {
|
if (imgsrc.startsWith("data:image")) {
|
||||||
@ -217,7 +218,7 @@ export class PdfCreator {
|
|||||||
|
|
||||||
image = `data:${img_type};base64,${image}`
|
image = `data:${img_type};base64,${image}`
|
||||||
$(element).attr("src", image)
|
$(element).attr("src", image)
|
||||||
})
|
});
|
||||||
|
|
||||||
return $.html();
|
return $.html();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user