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.

only first html() call is rendered

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
KurtGokhancommented, Sep 23, 2021

I have the same issue and I think it is not related to #3204. Only first call to html is rendered regardless of Y offset. I will try to fix this and provide a PR if I can.

2reactions
HackbrettXXXcommented, Sep 8, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

only first array element is rendering in react js - Stack Overflow
I have an array but only first array element is rendering.How to do this. This is response from Firebase. In console it is...
Read more >
Run Code in React Before Render - Dave Ceddia
Want to run some code before your React component renders? There are a few ways to make this work, and we'll talk about...
Read more >
Rendering Elements - React
To render a React element, first pass the DOM element to ReactDOM.createRoot() , then pass ... In practice, most React apps only call...
Read more >
Rendering and Updating Data using Component Lifecycle ...
Let's look at an example of fetching data from a remote endpoint and using the same data into render() to render it into...
Read more >
ASP.NET Core Razor component lifecycle | Microsoft Learn
If the component is rendering for the first time on a request: ... InvokeAsync is called, the ElementReference is only used in ...
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