Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text function produces different output in PDF #2779

Closed
ajit-soman opened this issue Jun 21, 2020 · 3 comments
Closed

Text function produces different output in PDF #2779

ajit-soman opened this issue Jun 21, 2020 · 3 comments

Comments

@ajit-soman
Copy link

Here is my code


let  doc = new jsPDF();
doc.text(20,26,'EVIDÊNCIAS DE CONTEÚDO DIGITAL');
doc.save();

Generated PDF has completely different text
image

Please help

@HackbrettXXX
Copy link
Collaborator

Please see #2677 or the readme.

@ajit-soman
Copy link
Author

ajit-soman commented Jun 22, 2020

I tried with custom font but it is not working . I created Lato-Regular-normal.js file using fontconverter.html

And added that js to my index.html file . The text output changes but it is still wrong

My Html :

<!DOCTYPE html>
<html>
<head>
    <script src="lib/jspdf.min.js"></script>
    <script src="lib/Lato-Regular-normal.js"></script>
</head>

</html>
<script>
    let doc = new jsPDF();
    doc.setFont('Lato-Regular');
    doc.setFontType('normal');
    doc.text(10, 10, 'EVIDÊNCIAS DE CONTEÚDO DIGITAL');

    doc.save();
</script>

output:

image

Any help would be appreciated . Thanks

@ajit-soman
Copy link
Author

Finally i am able to solve the issue . I added meta tag for UTF-8 in my html to fix this issue
<meta charset="utf-8">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants