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.

I’m using React and every time I generate a PDF, cursor.y is set based on the last one created. I’ve managed to solve this problem creating a method that resets the variable cursor, so every time I call the jsPDF’s save or output, I call resetCursor.

src/main.js

jsPDF.API.resetCursor = function () {
    cursor = {};
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
vladpkecommented, Jan 25, 2017

It feels like setting this.autoTable.previous to false on new instance creation would fix the problem.

3reactions
peterscommented, Dec 7, 2016

@simonbengtsson

jsPDF-AutoTable version: 2.1.0 jsPDF: 1.3.2

Run this code twice and it will demonstrate the problem:

var columns = [
	{ title: "A", dataKey: "A" },
	{ title: "B", dataKey: "B" },
	{ title: "C", dataKey: "C" }
];

var rows = [
	{ A: "A", B: "B", C: "C" },
	{ A: "A", B: "B", C: "C" }
];

var doc = new jsPDF('p', 'pt');
doc.setFontSize(20);
doc.setTextColor(40);
doc.setFontStyle('normal');
doc.text("YOLO", 10, 20);
doc.text("YOLO2", 10, 50);

doc.autoTable(columns, rows, {
	startY: doc.autoTableEndPosY() + 70,
	margin: { horizontal: 10 },
	styles: { overflow: 'linebreak' },
	bodyStyles: { valign: 'top' },
	columnStyles: { email: { columnWidth: 'wrap' } },
	theme: "striped"
});

doc.save('repro.pdf');
Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom mouse cursors reset on restart - Microsoft Community
Click on windows start orb and type mouse and select mouse · Go to the pointers tab and at the bottom you should...
Read more >
How to change your mouse cursor in Windows - Digital Trends
1. Click on the Search box located in the taskbar. 2. Type in "mouse." 3. Select Change your mouse settings from the resulting...
Read more >
How to Reset Mouse Settings to Default in Windows 11/10 ...
Issues addressed in this tutorial: reset mouse settings to default windows 11 how to reset default mouse settings in windows 11 mouse cursor...
Read more >
How To Restore Your Mouse Cursor Back To Default Settings ...
How To Restore Your Mouse Cursor Back To Default Settings In Windows 11 *2022*This is a video tutorial on how to restore your...
Read more >
How to reset Mouse settings to default in Windows 11/10
In this guide, we will show you how you can reset your mouse's settings to default on your Windows 11/10 computers. To reset...
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