jsPDF-AutoTable icon indicating copy to clipboard operation
jsPDF-AutoTable copied to clipboard

Remove table/cell border

Open hitolonen opened this issue 10 years ago • 7 comments

Hi,

how do you completely remove any table/cell borders? Currently this is our setup:

doc.autoTable(columns, rows, {
styles: {
cellPadding: 0,
rowHeight: 10,
fillStyle: 'S',
halign: 'center',
valign: 'middle',
fontStyle: 'bold', 
lineWidth: 0.01,
fontSize: 10,
textColor: 0,
},
margin: [68, 0, 0, 140] ,
tableWidth: width / 2 - 4,
bodyStyles: {
lineColor: [0, 0, 0, 0]
},
drawHeaderRow: function() {
return false;
},
beforePageContent: function(data) {
doc.addImage(imgData, 'JPEG', 0, 0, width, height);
}
});

The above seems to work with mac/ios safari and ff but mac chrome adds a thin white border. Tried also with: lineWidth: 0.00, lineWidth: 0.0, lineWidth: 0,

What we need to achieve is have a background image with the table but no table backgrounds or borders.

hitolonen avatar Oct 19 '16 13:10 hitolonen

Have you tried the plain theme?

simonbengtsson avatar Oct 19 '16 13:10 simonbengtsson

Yes and same thing with mac chrome showing the thin white border but mac ff and safari not showing it. Code:

doc.autoTable(columns, rows, {
    theme: 'plain',
    styles: {
        cellPadding: 0,
        rowHeight: 10,
        fillStyle: 'S',
        halign: 'center',
        valign: 'middle',
        fontStyle: 'bold',
        lineWidth: 0.01,
        fontSize: 10,
        textColor: 0,
    },
    margin: [68, 0, 0, 140],
    tableWidth: width / 2 - 4,
    bodyStyles: {
        lineColor: [0, 0, 0, 0]
    },
    drawHeaderRow: function () {
        return false;
    },
    beforePageContent: function (data) {
        doc.addImage(imgData, 'JPEG', 0, 0, width, height);
    }
});

hitolonen avatar Oct 19 '16 13:10 hitolonen

Sounds strange! So you are seeing a border in the plain theme in the demo as well? https://simonbengtsson.github.io/jsPDF-AutoTable/#themes

I use chrome on mac and can't see it. Can you post a screenshot?

simonbengtsson avatar Oct 19 '16 15:10 simonbengtsson

No not seeing the borders on the plain demo but granted the background is white and we have the image background.

Mac chrome, with borders: pdf-mac-chrome

Mac ff, no borders: pdf-mac-ff

hitolonen avatar Oct 19 '16 15:10 hitolonen

This was a bug. Fixed it now in version 2.0.36. If you specify the style lineWidht: 0 no border will show. You don't need to do that with the plain style set however as that is the default. Let me know if it works for you!

simonbengtsson avatar Oct 19 '16 16:10 simonbengtsson

Ah, thanks for the heads up. We were loading the script from per read me's "It is also available on cdnjs:" but just DL'd the latest version and all good.

Closing topic.

hitolonen avatar Oct 19 '16 16:10 hitolonen

Oh! My bad, updated the readme with the latest version now.

simonbengtsson avatar Oct 19 '16 16:10 simonbengtsson