You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 28, 2019. It is now read-only.
Hi, actually I used the code example, but when I try to use a personalized font, this doesn't work whit fromHTML function.
I saw the code inside jspdf.customfonts.debug.js and I think that the issue can be inside the ResolveFont function, this because this function always returns font-family "times", nevertheless other css properties works correctly (color for example).
this is my code:
I added the PersonalizedFont.ttf file to the fonts folder and also I modified the default_vfs.js file whit my font in base64, in this case the doc.text(15, 15, 'Hello world'); takes the correct font but the, doc.fromHTML does't.
Could you please help whit this problem.
$(document).ready(function(){vardoc=newjsPDF();varspecialElementHandlers={'#editor': function(element,renderer){returntrue;}};$('#cmd').click(function(){vardoc=newjsPDF();doc.addFont('PersonalizedFont.ttf','PersonalizedFont','normal');doc.setFont('PersonalizedFont');varhtml="<!DOCTYPE html>\ <html>\ <head>\ <style>\ @font-face {\ font-family: GamjaFlower;\ src: url('./fonts/PersonalizedFont.ttf');\ font-weight: bold;\ }\ p {\ font-family: GamjaFlower;\ color: blue;\ }\ </style>\ </head>\ <body>\ <p>\ Lorem ipsum dolor sit amet, consectetur adipisicing elit,\ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris\ nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor\ in reprehenderit in voluptate velit esse cillum dolore eu fugiat\ nulla pariatur. Excepteur sint occaecat cupidatat non proident,\ sunt in culpa qui officia deserunt mollit anim id est laborum.\ Hola mundo FromHTML\ </p>\ </body>\ </html>";doc.fromHTML(html,15,15,{'width': 170,'elementHandlers': specialElementHandlers});doc.addFont('PersonalizedFont.ttf','PersonalizedFont','normal');doc.setFont('PersonalizedFont');doc.text(15,15,'Hello world');doc.save('PersonalizedFont.pdf');});});
The text was updated successfully, but these errors were encountered:
Hi, actually I used the code example, but when I try to use a personalized font, this doesn't work whit fromHTML function.
I saw the code inside jspdf.customfonts.debug.js and I think that the issue can be inside the ResolveFont function, this because this function always returns font-family "times", nevertheless other css properties works correctly (color for example).
this is my code:
I added the PersonalizedFont.ttf file to the fonts folder and also I modified the default_vfs.js file whit my font in base64, in this case the doc.text(15, 15, 'Hello world'); takes the correct font but the, doc.fromHTML does't.
Could you please help whit this problem.
The text was updated successfully, but these errors were encountered: