ShadowKnight700
ShadowKnight700

Reputation: 105

How to dynamically adjust this image for this PDF such that the image is directly below the text?

In this code, I need to adjust the code such that the image is directly below the text. When I run this code,

Here is my current code:

var pdf = new jsPDF('p', 'pt', 'letter');
let w = 40;
let h = 100;

source = `Some text`;
pdf.addImage(chartIMG, 'PNG', w, h + 50, 180, 100);

pdf.fromHTML(source, w, h, { 'width': 522 }, function () {
  pdf.save('Test.pdf');
});

Here, the chartIMG object should then be placed 50 pixels below the text, through the h+50 clause. However, if I try to lengthen the text, the image stays in it's same place. Any help is appreciated.

Upvotes: 0

Views: 57

Answers (0)

Related Questions