tenta fix pdfservice.js
This commit is contained in:
1 parent
b0b7fba0f6
commit
5705978424
1 file changed
+6
-12
@@ -340,18 +340,12 @@ export class PdfService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fonte padrão do pdf-lib: Garamond-like (serif) = StandardFonts.TimesRoman
|
// Fonte padrão do pdf-lib: TimesRoman, TimesBold, TimesItalic
|
||||||
// Usa apenas as fontes padrão do pdf-lib, sem tentar carregar fontes externas
|
// Usa apenas as fontes padrão do pdf-lib, sem try/catch, pois são SEMPRE válidas
|
||||||
let font, fontBold, fontItalic, fontBoldItalic;
|
const font = await pdfDoc.embedFont(StandardFonts.TimesRoman);
|
||||||
try {
|
const fontBold = await pdfDoc.embedFont(StandardFonts.TimesBold);
|
||||||
font = await pdfDoc.embedFont(StandardFonts.TimesRoman);
|
const fontItalic = await pdfDoc.embedFont(StandardFonts.TimesItalic);
|
||||||
fontBold = await pdfDoc.embedFont(StandardFonts.TimesBold);
|
const fontBoldItalic = fontBold; // pdf-lib não tem TimesBoldItalic, usa bold
|
||||||
fontItalic = await pdfDoc.embedFont(StandardFonts.TimesItalic);
|
|
||||||
fontBoldItalic = fontBold; // pdf-lib não tem TimesBoldItalic, usa bold
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Erro ao carregar fontes padrão do pdf-lib:', err);
|
|
||||||
throw new Error('Falha ao carregar fontes padrão do PDF.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Função para quebrar texto em linhas respeitando largura máxima e manter quebras de linha simples
|
// Função para quebrar texto em linhas respeitando largura máxima e manter quebras de linha simples
|
||||||
function wrapTextStyled(text: string, font: any, fontBold: any, fontItalic: any, fontBoldItalic: any, fontSize: number, maxWidth: number, indent: boolean, align: string, bold: boolean, italic: boolean): { text: string, font: any, indent: boolean, align: string, bold: boolean, italic: boolean }[] {
|
function wrapTextStyled(text: string, font: any, fontBold: any, fontItalic: any, fontBoldItalic: any, fontSize: number, maxWidth: number, indent: boolean, align: string, bold: boolean, italic: boolean): { text: string, font: any, indent: boolean, align: string, bold: boolean, italic: boolean }[] {
|
||||||
|
|||||||
Reference in new issue
Block a user