I am working with pdfMake, that converts the static text into pdf.
My text in HTML is coming from a service in AngularJS and is dynamic. The text can have both English as well as non-English characters like Korean, Japanese, Chinese, etc.
Currently, I have only English font, so it prints blank for the non-English characters.
How can one fix this issue?
The JS code:
self.downloadAsPdf = function (dateTimeId) {
var datetime = document.getElementById(dateTimeId).innerHTML;
pdfMake.fonts = {
proximaNova: {
normal: 'proximanova-regular.ttf',
bold: 'Roboto-Medium.ttf',
italics: 'proximanova-light.ttf',
bolditalics: 'proximanova-semibold.ttf'
}
};
var docDefinition = {
{ text: 'Heading', style: 'header' },
{ text: 'Subheading', style: 'myscript' },
{ text: datetime, style: 'datetime' },
{ text: model.storyScriptData.personalMoment, style: 'body' },
{ text: model.storyScriptData.createAConnection, style: 'body' },
{ text: model.storyScriptData.theResoultion, style: 'body' }
],
defaultStyle: {
font: 'proximaNova'
},
styles: {
header: {
fontSize: 24,
alignment: 'center',
color: "#ffffff",
margin: [0, 60, 0, 0]
},
myscript: {
fontSize: 18,
alignment: 'left',
color: "#a7a7a7",
margin: [0, 100, 0, 0]
},
datetime: {
fontSize: 11,
alignment: 'left',
color: "#a7a7a7",
margin: [0, 2, 0, 36]
},
body: {
fontSize: 13,
alignment: 'left',
color: "#727272",
lineHeight: 1.5,
bolditalics: true
}
}
}
pdfMake.createPdf(docDefinition).download('optionalName.pdf');
}
where model.storyScriptData.personalMoment
, model.storyScriptData.createAConnection
and model.storyScriptData.theResoultion
are the model
's in AngularJS