fix: pdf font

This commit is contained in:
JOYCEQL
2024-11-27 14:43:24 +08:00
parent 5e2c645904
commit e898b11f80
2 changed files with 12 additions and 13 deletions
@@ -26,7 +26,6 @@ export async function POST(req: Request) {
const pdfContent = `
<html>
<head>
<style>${styles}</style>
<style>
@font-face {
font-family: 'Noto Sans SC';
+12 -12
View File
@@ -22,17 +22,17 @@ export function PdfExport() {
line.style.display = "none";
});
const pdfContent = await convertImagesToBase64(pdfElement);
let styles = Array.from(document.styleSheets)
.map((sheet) => {
try {
return Array.from(sheet.cssRules)
.map((rule) => rule.cssText)
.join("\n");
} catch (e) {
return "";
}
})
.join("\n");
// let styles = Array.from(document.styleSheets)
// .map((sheet) => {
// try {
// return Array.from(sheet.cssRules)
// .map((rule) => rule.cssText)
// .join("\n");
// } catch (e) {
// return "";
// }
// })
// .join("\n");
const response = await fetch("/api/generate-pdf", {
method: "POST",
@@ -41,7 +41,7 @@ export function PdfExport() {
},
body: JSON.stringify({
content: pdfContent,
styles: styles,
// styles: styles,
margin: globalSettings.pagePadding
})
});