tenta fix pdfservice.js
This commit is contained in:
1 parent
3d044a962a
commit
bd67cf49cc
1 file changed
+3
-1
@@ -247,6 +247,9 @@ export class PdfService {
|
||||
const LINE_HEIGHT = FONT_SIZE * 1.5;
|
||||
const MAX_WIDTH = PAGE_WIDTH - margens.left - margens.right;
|
||||
|
||||
// Crie o PDFDocument ANTES de tentar usar pdfDoc para embedFont!
|
||||
let pdfDoc: PDFDocument = await PDFDocument.create();
|
||||
|
||||
// Fonte padrão do pdf-lib: TimesRoman, TimesBold, TimesItalic
|
||||
const font = await pdfDoc.embedFont('Times-Roman');
|
||||
const fontBold = await pdfDoc.embedFont('Times-Bold');
|
||||
@@ -451,7 +454,6 @@ export class PdfService {
|
||||
const paragrafos = texto.split(/\n{2,}/).map(p => p.trim()).filter(Boolean);
|
||||
|
||||
// Carregar o timbrado (se houver) e criar o PDF final
|
||||
let pdfDoc: PDFDocument = await PDFDocument.create();
|
||||
let timbradoPdf: PDFDocument | null = null;
|
||||
let timbradoPageCount = 0;
|
||||
let timbradoPages: any[] = [];
|
||||
|
||||
Reference in new issue
Block a user