Skip to content

custom-font Verdana does not seem to work #2037

@Remonell

Description

@Remonell

Thank you for submitting an issue to jsPDF. Please read carefully.

Are you using the latest version of jsPDF?
Yes
Have you tried using jspdf.debug.js?
Yes

Prologue:

I am trying to implement Verdana to be able to print Umlaute in the pdf with my chosen font.

I have checked out all the other issues regarding custom fonts and utf-8. I have also checked out the example codes in the hope I would be able to figure this out by my own.

From the example I know that UTF-8 support works, so I assume that I did something wrong somewhere.

To limit the error sources I tried to get it to work by changing only the necessary parts from the repository example code.

The Umlaute do work with PTSans.

Steps to reproduce

Download jsPDF repository master branch and the Verdana.ttf from here.

Use the fontconverter from the browser and choose the just downloaded Verdana.ttf.
Take the output javascript file (Verdana-normal.js) from the converter, copy it in the js folder from the repository and include it in the basic.html between the basic.js and the jspdf.debug.js include.

In the basic.js use following code:

    var doc = new jsPDF();
    doc.setFont('Verdana','normal');
    doc.setFontSize(10);
    doc.text("test123", 10, 10);
    doc.text("ää öö", 10, 30);
    doc.save('test.pdf');

(I also tried replacing the base64 code and the variable names etc. in the basic.js file without including the generated Verdana-normal.js. No success.)

Ideally a link too. Try fork this http://jsbin.com/rilace/edit?html,js,output

What I saw

A bunch of rectangles where the letters should have been. Not even "test123" was written correctly in the pdf file.

What I expected
test123 and ää öö printed in the pdf file.

I would appreciate any kind of help or suggestion. If you need more information, let me know.

Kind regards from Stuttgart

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions