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.

Problem Date with jspdf.text() in IE and EDGE

See original GitHub issue

I tried to use the jsPDF to write a date but I can’t write correctly.

The code is :

var pdf = new jsPDF('p', 'pt');
var dateOptions = {
                day: "numeric",
                month: "numeric",
                year: "numeric"
            };
pdf.text("in "+ new Date("28/12/2015").toLocaleString("fr-fr", dateOptions), 40, 100);
pdf.text("in 28/12/2015", 40, 125);
pdf.text("in "+new Date("28/12/2015").toString, 40, 150);

The result is :

 i  n     2 8   /   1 2   /   2 0 1 5
in 28/12/2015
in Mon Dec 28 2015 01:00:00 GMT+0100 (Paris, Madrid)

The problem is that insert many blank space between letters. This problem appear if I use date toLocaleString function and the Browers IE or EDGE. Is there any solution?

thanks in advance

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12

github_iconTop GitHub Comments

5reactions
ahmedmahdicommented, Nov 2, 2016

I found the solution. I detected the character and I replaced it.

text = text.replace(/[\u200E]/g, '');

0reactions
naga-sagarikacommented, Oct 29, 2019

I found the solution. I detected the character and I replaced it.

text = text.replace(/[\u200E]/g, ''); Hi Ahmed,

Found this very helpful

Regards, Sagarika

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem Date with jspdf.text() in IE and EDGE · Issue #937
I tried to use the jsPDF to write a date but I can't write correctly. The code is : var pdf = new...
Read more >
jspdf text stretched in MS Edge
This turns out to be another case of IE's toLocaleString has strange characters in results: Edge is adding unicode formatting characters to ...
Read more >
jsPDF in Internet Explorer and Microsoft Edge - MSDN
Hello, I am using the jsPDF library in my application to display PDFs and save them, but in Internet Explorer and Microsoft Edge...
Read more >
Generating PDFs from Web Pages on the Fly with jsPDF
Massimo Cassandro demonstrates how to make use of jsPDF, a JavaScript library for generating PDF documents from web pages.
Read more >
jspdf.js - Documentation
ADVANCED) {; throw new Error(; methodName +; " is only available in 'advanced' API mode. " +; "You need to call advancedAPI() first....
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