columns data trucated html table to pdf
Hi,
I could not get overflow: linebreak to work for me. I have data as HTML, I convert it to json using autoTableHtmlToJson and then use autoTable to generate the PDF.
For example:
var res = doc.autoTableHtmlToJson(document.getElementById("basic-table"), true);
doc.autoTable(res.columns, res.data, {margins: {horizontal: 10, top: 40, bottom: 40}, startY: 370, overflow: 'linebreak', overflowColumns: false});
publish(doc.output('datauristring'));
But the column data gets truncated instead of getting word wrapped. How to achieve it?
I found a bug just now that means that the overflowColumns option has to be specifued in order for linebreak to work. I will fix it as son as possible, but in the mean time you can simply specify it.
If i specify overflow columns, It does not increase the height of row dynamically, but it increases the cell width which causes my table to extend out of the page :(
How can i achieve something similar to the last table shown in longData example considering i dnt have the json data, I have html data.
I even tried putting the same scenario in from html example of yours, But that does not work too for the overflow thing , what can i do to get it work, probably that would be same case with my html data.
I just published a fix in the latest version 1.3.1. Let me know if it works for you now!
Awesome its working.. Just one more thing the table headers are not wrapped still. Anything i have missed? How to get that working?
Sweet! Header linebreaks are not supported right now unfortunately.
Is there any workaround for that. I mean "th" is quite similar to "td", I need to have the header row visible properly. Let me know if there is anything i can play with to get this working. I would really appreciate.
It is wonderful. That worked. But again linebreaks on headers are not working. Please let me know any workaround. I am using th has header. Can use td instead of th. Will it work.? Please assist.
Tried using td instead of th. Does not work. It seems the first row is always taken as columns.
Putting the headers in simply a row works but then it needs to have some formatting options to set background color to differentiate it from normal rows. But again there is no way to remove the default header that is to have just the data not the columns.
You can style the first row using the renderCell option. And I think setting the headers parameter to false will disable/hide the header row.
Hi Ruhi,
Please do let me know if that workaround works. And possibly if you can share the code. Thanks in advance.
Tried setting columns parameter to false, The header is still displayed and header text become 0..1..2...3..4 :(
Any workaround for this. Just wanted to remove the header completely.
Somehow i removed the header by setting its width and height to 0 from renderHeaderCell.
But there are two problems still:
- How to achieve having header row on everypage if i want to use first row as header?
- How to renderCell for background color for only top row in all the pages?
The best preferred solution would be to have line break option for header too. Other workaround require too much of extra work.
Then I think the easiest way would be to change the plugin code. It wouldn't be too hard, but I won't be able to do it for a few days probably. If you end up doing it, be sure to send a pull request!
Unfortunately I am pretty new in Javascript. I have figured out that printHeader is the function i may have to modify, but it looks quite hard to play around with the code being not an expert in it. I would try but can you tell me by what time you could come with a fix for this?
Okey! Some day this week, hopefully tonight, worst case sunday.
Cool, I would better wait for it and i wish you do not have to go for the worst case :). Thanks a lot for responding so quickly to this.
Ankur, Are you also working over the header text wrapping issue. Let me know if you find a fix for this. It is kind of urgent for me.
Ruhi,
I can solve this, but problem is time. I have left it as it is and working on other tasks. But i have to solve this till this friday. If we do not get the fix then i will look into this on friday or saturday in worst case.
Thanks Ankur Garg
Thanks Ankur,
The same case is with me. Need to get this fixed by Friday. But since i am not an expert in javascript, It would be tricky for me to modify the plugin code. Let me know if you are able to find a fix.
Meanwhile i would also wait for Simon's fix.
Okay. But i must say this is a wonderful plugin. I tried many others as well. Just looking for this final fix. But did you try any of plugins or normal jspdf in IE 11. In IE11 none is working. Not able to download the file in IE11. Simons, please let me know if you have ever tried to save pdf in IE11
Thanks