{"id":2276,"date":"2022-07-10T07:42:39","date_gmt":"2022-07-10T02:42:39","guid":{"rendered":"https:\/\/www.edopedia.com\/blog\/?p=2276"},"modified":"2022-07-10T07:47:18","modified_gmt":"2022-07-10T02:47:18","slug":"jspdf-autotable-print-special-characters-fonts-in-table","status":"publish","type":"post","link":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/","title":{"rendered":"jsPDF-Autotable Print Special Characters &#038; Fonts in Table"},"content":{"rendered":"\n<p>After the release of version 1.4.0, the jsPDF finally supports encoding diacritics characters, but in a very strange way, in my opinion.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Find the font which contains the characters that you need. Let\u2019s say it will be a Calibri.<\/li><li>Go to\u00a0<code>C:\\Windows\\Fonts\\Calibri<\/code>\u00a0and copy a\u00a0<code>.ttf<\/code>\u00a0font file to Desktop.<\/li><li>Go to\u00a0<a href=\"https:\/\/rawgit.com\/MrRio\/jsPDF\/master\/fontconverter\/fontconverter.html\" target=\"_blank\" rel=\"noreferrer noopener\">jsPDF FontConverter<\/a>\u00a0and select copied font file. Click on the\u00a0<em>Create<\/em>\u00a0button.<\/li><li>You should get a JavaScript file with content like this:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;text\/javascript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;JavaScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;js&quot;}\">import { jsPDF } from &quot;jspdf&quot;\nvar font = 'AAEAAAAWAQQAAB...==';\nvar callAddFont = function () {\n  this.addFileToVFS('calibri-normal.ttf', font);\n  this.addFont('calibri-normal.ttf', 'calibri', 'normal');\n};\njsPDF.API.events.push(['addFonts', callAddFont]);<\/pre><\/div>\n\n\n\n<p>The second string in\u00a0<code>this.addFont('calibri-normal.ttf', 'calibri', 'normal');<\/code>\u00a0will be the name of your font. Remember it.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\"><li>Add a downloaded javascript file to your project and import it:\u00a0<code>import '..\/utils\/calibri-normal';<\/code><\/li><li>Go to a place where you initialize a\u00a0<code>jsPDF<\/code>\u00a0object and set your font up:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;text\/javascript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;JavaScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;js&quot;}\">&lt;span class=&quot;hljs-keyword&quot;&gt;const&lt;\/span&gt; doc = &lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;\/span&gt; &lt;span class=&quot;hljs-title function_&quot;&gt;jsPDF&lt;\/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;'p'&lt;\/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;'pt'&lt;\/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;'a4'&lt;\/span&gt;);\ndoc.&lt;span class=&quot;hljs-title function_&quot;&gt;setFont&lt;\/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&quot;calibri&quot;&lt;\/span&gt;);    &lt;span class=&quot;hljs-comment&quot;&gt;\/\/ &lt;-- place here your font name, which you remeber before&lt;\/span&gt;\n&lt;span class=&quot;hljs-comment&quot;&gt;\/\/...&lt;\/span&gt;\ndoc.&lt;span class=&quot;hljs-title function_&quot;&gt;save&lt;\/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;'file001.pdf'&lt;\/span&gt;);<\/pre><\/div>\n\n\n\n<ol class=\"wp-block-list\" start=\"7\"><li>If you use jsPDF Autotable add new font to autotable settings too:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;text\/javascript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;JavaScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;js&quot;}\">doc.&lt;span class=&quot;hljs-title function_&quot;&gt;autoTable&lt;\/span&gt;({\n    &lt;span class=&quot;hljs-attr&quot;&gt;head&lt;\/span&gt;: [[&lt;span class=&quot;hljs-string&quot;&gt;'Column1'&lt;\/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;'Column2'&lt;\/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;'Column3'&lt;\/span&gt;]],\n    &lt;span class=&quot;hljs-attr&quot;&gt;body&lt;\/span&gt;: someDataRows,\n    &lt;span class=&quot;hljs-attr&quot;&gt;styles&lt;\/span&gt;: {\n      &lt;span class=&quot;hljs-attr&quot;&gt;font&lt;\/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;'calibri'&lt;\/span&gt;,    &lt;span class=&quot;hljs-comment&quot;&gt;\/\/ &lt;-- place name of your font here&lt;\/span&gt;\n      &lt;span class=&quot;hljs-attr&quot;&gt;fontStyle&lt;\/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;'normal'&lt;\/span&gt;,\n    },\n    &lt;span class=&quot;hljs-attr&quot;&gt;margin&lt;\/span&gt;: { &lt;span class=&quot;hljs-attr&quot;&gt;bottom&lt;\/span&gt;: &lt;span class=&quot;hljs-number&quot;&gt;60&lt;\/span&gt; }\n});<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>After the release of version 1.4.0, the jsPDF finally supports encoding diacritics characters, but in a very strange way, in my opinion. Find the font which contains the characters that you need. Let\u2019s say it will be a Calibri. Go to\u00a0C:\\Windows\\Fonts\\Calibri\u00a0and copy a\u00a0.ttf\u00a0font file to Desktop. Go to\u00a0jsPDF FontConverter\u00a0and select copied font file. Click on &#8230; <a title=\"jsPDF-Autotable Print Special Characters &#038; Fonts in Table\" class=\"read-more\" href=\"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/\" aria-label=\"Read more about jsPDF-Autotable Print Special Characters &#038; Fonts in Table\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":2279,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[],"class_list":["post-2276","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>jsPDF-Autotable Print Special Characters &amp; Fonts in Table<\/title>\n<meta name=\"description\" content=\"After the release of version 1.4.0, the jsPDF finally supports encoding diacritics characters, but in a very strange way, in my opinion. Find the font\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"jsPDF-Autotable Print Special Characters &amp; Fonts in Table\" \/>\n<meta property=\"og:description\" content=\"After the release of version 1.4.0, the jsPDF finally supports encoding diacritics characters, but in a very strange way, in my opinion. Find the font\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/\" \/>\n<meta property=\"og:site_name\" content=\"Edopedia\" \/>\n<meta property=\"article:author\" content=\"trulyfurqan\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-10T02:42:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-10T02:47:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/07\/scrnli_7_10_2022_7-46-12-AM.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1213\" \/>\n\t<meta property=\"og:image:height\" content=\"470\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Furqan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Furqan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"jsPDF-Autotable Print Special Characters & Fonts in Table","description":"After the release of version 1.4.0, the jsPDF finally supports encoding diacritics characters, but in a very strange way, in my opinion. Find the font","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/","og_locale":"en_US","og_type":"article","og_title":"jsPDF-Autotable Print Special Characters & Fonts in Table","og_description":"After the release of version 1.4.0, the jsPDF finally supports encoding diacritics characters, but in a very strange way, in my opinion. Find the font","og_url":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/","og_site_name":"Edopedia","article_author":"trulyfurqan","article_published_time":"2022-07-10T02:42:39+00:00","article_modified_time":"2022-07-10T02:47:18+00:00","og_image":[{"width":1213,"height":470,"url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/07\/scrnli_7_10_2022_7-46-12-AM.png","type":"image\/png"}],"author":"Furqan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Furqan","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/#article","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/"},"author":{"name":"Furqan","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339"},"headline":"jsPDF-Autotable Print Special Characters &#038; Fonts in Table","datePublished":"2022-07-10T02:42:39+00:00","dateModified":"2022-07-10T02:47:18+00:00","mainEntityOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/"},"wordCount":129,"commentCount":0,"publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/07\/scrnli_7_10_2022_7-46-12-AM.png","articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/","url":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/","name":"jsPDF-Autotable Print Special Characters & Fonts in Table","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/#primaryimage"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/07\/scrnli_7_10_2022_7-46-12-AM.png","datePublished":"2022-07-10T02:42:39+00:00","dateModified":"2022-07-10T02:47:18+00:00","description":"After the release of version 1.4.0, the jsPDF finally supports encoding diacritics characters, but in a very strange way, in my opinion. Find the font","breadcrumb":{"@id":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/#primaryimage","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/07\/scrnli_7_10_2022_7-46-12-AM.png","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/07\/scrnli_7_10_2022_7-46-12-AM.png","width":1213,"height":470,"caption":"jsPDF-Autotable Print Special Characters & Fonts in Table"},{"@type":"BreadcrumbList","@id":"https:\/\/www.edopedia.com\/blog\/jspdf-autotable-print-special-characters-fonts-in-table\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.edopedia.com\/blog\/"},{"@type":"ListItem","position":2,"name":"jsPDF-Autotable Print Special Characters &#038; Fonts in Table"}]},{"@type":"WebSite","@id":"https:\/\/www.edopedia.com\/blog\/#website","url":"https:\/\/www.edopedia.com\/blog\/","name":"Edopedia","description":"Coding\/Programming Blog","publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.edopedia.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.edopedia.com\/blog\/#organization","name":"Edopedia","url":"https:\/\/www.edopedia.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","width":400,"height":100,"caption":"Edopedia"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339","name":"Furqan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","caption":"Furqan"},"description":"Well. I've been working for the past three years as a web designer and developer. I have successfully created websites for small to medium sized companies as part of my freelance career. During that time I've also completed my bachelor's in Information Technology.","sameAs":["http:\/\/www.edopedia.com\/blog\/","trulyfurqan"],"url":"https:\/\/www.edopedia.com\/blog\/author\/furqan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/2276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/comments?post=2276"}],"version-history":[{"count":0,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/2276\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media\/2279"}],"wp:attachment":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media?parent=2276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/categories?post=2276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/tags?post=2276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}