Jspdf: Problems with .html() - v2.1.1

Created on 7 Sep 2020  路  5Comments  路  Source: MrRio/jsPDF

I have two cases where I get unexpected results when running .html()

I am using jspdf v2.1.1

Case1:

const myDoc = new jsPDF();
const options =  {
    x: 10,
    y: 10,
    callback: function (doc) {
        let options2 =  {
            x: 10,
            y: 20,
             callback: function (doc2) {
                 doc2.save();
               }
        };
        doc.html("<i>Test2</i>", options2);
    }
};
myDoc.html("<b>Test1</b>", options);

What I expect here is to see 1 pdf file with two lines:
Test1
_Test2_

But what I get is only 1 line Test1, where did _Test2_ go?

Case2:

const myDoc1 = new jsPDF();
const options1 =  {
    x: 10,
    y: 10,
     callback: function (doc) {
          doc.save();
       }
};
myDoc1.html("<b>Test1</b>", options1);

const myDoc2 = new jsPDF();
const options2 =  {
    x: 10,
    y: 10,
     callback: function (doc) {
          doc.save();
       }
};
myDoc2.html("<i>Test2</i>", options2);

What I expect here is to see 2 pdf files, one with Test1 and second with _Test2_. But instead I get one empty file and another file with Test1.

Can someone confirm if they get same behaviour? What is going on?

Bug

All 5 comments

That's interesting. Seems like multiple consecutive calls to the html function are broken.

Hi @HackbrettXXX. I can see you are an active contributor to the repo. Any estimate on how long it would take to fix and release new version? Thanks

I'm currently quite busy, so if I have to implement the fix myself it will probably take weeks if not months. If you or someone else provides a pull request, I will merge and release it in a timely manner.

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NoFootDancer picture NoFootDancer  路  3Comments

sayo96 picture sayo96  路  3Comments

0721Betty picture 0721Betty  路  4Comments

sajesh1985 picture sajesh1985  路  5Comments

MaxCodeDE picture MaxCodeDE  路  4Comments