question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UTF – 8 character support ( Chinese character support )

See original GitHub issue

Hi , I have requirement to support utf-8 character. I have tried to with Chinese but it did not work . Below is my code , suggest how to support .

index.html

<!DOCTYPE html>
<html>    
    <head>
        <meta charset="UTF-8">
        <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.min.js" type="text/javascript"></script>        
        <script  src="pdf-lib/dist/jspdf.debug.js"></script>
    </head>    
    <body>
        <div id="content"> 
            <h1>The title goes here 正體字/繁體字</h1> 
            <p>The pararaph goes here</p> 
            </div><div id="page">            
            </div> 
            <button id="submit">Export to  PDF</button>
            <script src="script2.js"></script>
    </body>
</html>

script2.js

var doc = new jsPDF(); 
var specialElementHandlers = { 
    '#editor': function (element, renderer) { 
        return true; 
    } 
};
$('#submit').click(function () { 
    doc.fromHTML($('#content').html(), 15, 15, { 
        'width': 190, 
            'elementHandlers': specialElementHandlers 
    }); 
    doc.save('sample-page.pdf'); 
});

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
wanchengcommented, Jan 19, 2016
html2canvas(document.getElementById("print"),{
    onrendered:function(canvas){
        var imgData = canvas.toDataURL('image'/png');
        var doc = jsPDF('p','mm');
        doc.addImage(imgData,'PNG',0,0,canvas.width,canvas.height);

        doc.save('test.pdf');
    }
});
0reactions
Uzlopakcommented, Feb 15, 2018

Duplicate of #12

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should I change from UTF-8 to UTF-16 to accommodate ...
UTF -8 and UTF-16 encode exactly the same set of characters. It's not that UTF-8 doesn't cover Chinese characters and UTF-16 does. UTF-16...
Read more >
What is UTF-8? UTF-8 Character Encoding Tutorial
UTF -8 is a character encoding system. It lets you represent characters as ASCII text, while still allowing for international characters, ...
Read more >
What languages does the character encoding UTF-8 support?
chinese is 100% supported. with complications. there are multiple chinese character sets for digital representation, and there are multiple ways ...
Read more >
Are Chinese characters UTF 8? - Quora
Yes, you can represent them each with 4 bytes in UTF-8. However, it's very inefficient if the text consists entirely or mostly of...
Read more >
Unicode/UTF-8 characters (Chinese characters, Barcodes, etc ...
Unicode /UTF-8 characters (Chinese characters, Barcodes, etc.) and CSV files ... Simple CSV files do not support Unicode/UTF-8 characters. This is a limitation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found