Permalink
Browse files

Fixed #96

  • Loading branch information...
1 parent 84b6204 commit 157527d34bc59202e47a32a7715b07e51fb848d7 @diegocr diegocr committed May 21, 2014
Showing with 6 additions and 2 deletions.
  1. +6 −2 jspdf.js
View
@@ -931,6 +931,10 @@ var jsPDF = (function(global) {
* T* (line three) Tj
* ET
*/
+ function ESC(s) {
+ s = s.split("\t").join(Array(options.TabLen||9).join(" "));
+ return pdfEscape(s, flags);
+ }
// Pre-August-2012 the order of arguments was function(x, y, text, flags)
// in effort to make all calls have similar signature like
@@ -970,14 +974,14 @@ var jsPDF = (function(global) {
flags.autoencode = true;
if (typeof text === 'string') {
- text = pdfEscape(text, flags);
+ text = ESC(text);
} else if (text instanceof Array) {
// we don't want to destroy original text array, so cloning it
var sa = text.concat(), da = [], len = sa.length;
// we do array.join('text that must not be PDFescaped")
// thus, pdfEscape each component separately
while (len--) {
- da.push(pdfEscape(sa.shift(), flags));
+ da.push(ESC(sa.shift()));
}
text = da.join(") Tj\nT* (");
} else {

0 comments on commit 157527d

Please sign in to comment.