javascript - pdfmake - using own fonts not working -
i using pdfmake create pdf's on client side. have wysiwyg editor allows users created pdf. parsed work pdfmake.
however, cannot normal fonts work. plugin uses vfs_fonts.js create font on pdf, default roboto.
i trying work likes of times new roman etc etc.
i have tried alter file this:
window.pdfmake = window.pdfmake || {}; window.pdfmake.vfs = { roboto: { "roboto-italic.ttf": "base 64 here", "roboto-medium.ttf": "base 64 here", "roboto-regular.ttf": "base 64 here" }, timesnewroman: { "roboto-italic.ttf": "base 64 here", "roboto-medium.ttf": "base 64 here", "roboto-regular.ttf": "base 64 here" } }
i have used same fonts roboto test still doesn't work. here error back
uncaught error: no unicode cmap font
here code below. paste string pdf tester here , see result
{ "content":[ { "stack":[ { "text":[ { "text":"" } ] }, { "text":"ygjjkjgjkhjkjghk", "style":"style_2", "lineheight":"1" } ], "style":"style_1" }, { "stack":[ { "text":[ { "text":"" } ] }, { "text":" ", "style":"style_4", "lineheight":"1" } ], "style":"style_3" }, { "stack":[ { "text":[ { "text":"" } ] }, { "text":"", "style":"style_7", "font":"timesnewroman", "lineheight":"1" }, { "text":"sdfghfdghfghdgfgfh", "style":"style_8", "font":"timesnewroman", "lineheight":"1" } ], "style":"style_5" } ], "styles":{ "style_1":{ "opacity":"1" }, "style_2":{ "opacity":"1" }, "style_3":{ "opacity":"1" }, "style_4":{ "opacity":"1" }, "style_5":{ "opacity":"1" }, "style_6":{ "opacity":"1" }, "style_7":{ "font":"timesnewroman", "opacity":"1" }, "style_8":{ "opacity":"1" } }, "pagesize":"a4", "pageorientation":"portrait", "pagemargins":[ 40, 20, 40, 20 ] }
has else used library? if so, did use custom fonts, , how did them work? can post more code if needed, thanks
Comments
Post a Comment