jspdf too long texts in the table are cut off
See original GitHub issueHi @MrRio , @HackbrettXXX :
As you can see from the image I am having the problem if I have a very long text as you see, the final part of the text is cut off and the cell does not continue on the next page.
Can you give me a hand?
Code:
var doc = new jsPDF({ putOnlyUsedFonts: true, orientation: "landscape" });
var generateData = function(amount) {
var result = [];
let t = "ALorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting1, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting2, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting3, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting4, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting5, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting6, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
var splitTitle = doc.splitTextToSize(t, 180);
var data = {
game_group: "GameGroup",
machine: splitTitle,
};
for (var i = 0; i < amount; i += 1) {
data.id = (i + 1).toString();
result.push(Object.assign({}, data));
}
return result;
};
function createHeaders(keys) {
var result = [];
for (var i = 0; i < keys.length; i += 1) {
result.push({
id: keys[i],
name: keys[i],
prompt: keys[i],
width: 65,
align: "center",
padding: 0
});
}
return result;
}
var headers = createHeaders([
"game_group",
"machine",
]);
doc.table(1, 1, generateData(2), headers, { autoSize: true });
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
jspdf too long texts in the table are cut off · Issue #3052 - GitHub
I think breaking a single cell over multiple pages is just not designated. You might try the AutoTable plugin. Pull requests are also...
Read more >Word wrap in generated PDF (using jsPDF)? - Stack Overflow
I've added the bit of code I'm using to create the document. And as I've stated, sometimes the reportTitle is too long and...
Read more >React Js Jspdf Too Long Texts In The Table Are Cut Off
After initialization of JsPDF I am going to put the image into my document width for the output pdf file with correct orientation...
Read more >jspdf too long texts in the table are cut off - - Bountysource
Hi @MrRio , @HackbrettXXX : As you can see from the image I am having the problem if I have a very long...
Read more >How to Wrap Long Text With splittexttosize in jsPDF - YouTube
How to Wrap Long Text With splittexttosize in jsPDF | jsPDF Tutorial Part 8How to use jsPDF to create PDF files in Javascript....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think breaking a single cell over multiple pages is just not designated. You might try the AutoTable plugin. Pull requests are also welcome 😃
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.