I'm currently trying to print a string containing HTML markup to pdf using the HTML-to-pdfmake and pdf make libraries. The HTML contains a lot of classes and ids and I have styling for those in a CSS file. Is there a way to pass that CSS file to the styles attribute in pdfmake instead of writing all the styles in the content definition section?
This is what I currently have:
let documentDefinition = {
pageSize: "A4",
pageOrientation: "portrait",
footer: footer,
header: header,
content: [
{
text: htmlToPdfmake(documentBody, {
window: window,
}),
},
],
styles: {
header: {
fontSize: 22,
bold: true,
},
anotherStyle: {
italics: true,
alignment: "right",
},
},
}
The goal would be to reference these styles from a css instead as I have a 1000 lines long css styling. So would be something like this:
let documentDefinition = {
pageSize: "A4",
pageOrientation: "portrait",
footer: footer,
header: header,
content: [
{
text: htmlToPdfmake(documentBody, {
window: window,
}),
},
],
styles: {
path: "./styles/style.css"
}
}