Skip to content

only first html() call is rendered #2899

@anton6

Description

@anton6

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions