My pdf is showing table and this table is can small and can long table (depends on the amount of data) , i set if data more than 10 its will new page (addPage) but i have some problem , if addpage its have more space in the midle on pdf you can see at this image or this 
why this table not continue at top on this second page ? this is my code . can someone help for this ??
this is my code
downloadPDF(){
// footer
var addFooters = doc => {
const pageCount = doc.internal.getNumberOfPages()
doc.setFont('helvetica', 'italic')
doc.setFontSize(8)
for (var i = 1; i <= pageCount; i++) {
doc.setPage(i)
doc.text('Page ' + String(i) + ' of ' + String(pageCount), doc.internal.pageSize.width / 2, 587, {
align: 'center'
})
}
}
var doc = new jsPDF('l', 'pt');
let totals = this.datatotal
let anggarans = this.dataanggaran
let uraian = this.datauraian
let tgl = this.datatanggal
let digunakan = this.datadigunakan
let sisa = (this.dataanggaran - (this.datadigunakan + this.datatotal))
//header
var header = function (data) {
doc.setFontSize(18);
doc.setTextColor(40);
doc.setFontStyle('normal');
doc.text(330, 50, 'Pengajuan Pencairan')
};
doc.setFontSize(12)
doc.text(55, 80, 'Nama Program')
doc.text(165, 80, ': 1.02.06.1 Program Upaya Kesehatan Masyarakat')
doc.text(55, 100, 'Kegiatan')
doc.text(165,100, ': 1.02.06.1.5.2.2.26.01.02.01 Pelayanan Kesehatan')
doc.text(165,120, 'RSUD dr.Soeratno Gemolong Sragen-BLUD ')
doc.text(55, 140, 'Rincian Kegiatan')
doc.text(165, 140, ': '+ String(uraian))
doc.text(55, 160, 'Bulan Tanggal')
doc.text(165, 160, ': '+ String(tgl))
doc.text(540, 80, 'Anggaran')
doc.text(660, 80, ':Rp '+ String(this.formatPrice(anggarans)))
// doc.text(130, 100, uraian)
doc.text(540, 100, 'Sudah Digunakan')
doc.text(660, 100, ':Rp '+ String(this.formatPrice(digunakan)))
doc.text(540, 140, 'Pengajuan')
doc.text(660, 140, ':Rp '+ String(this.formatPrice(totals)))
doc.text(540, 160, 'Sisa Anggaran')
doc.text(660, 160, ':Rp '+ String(this.formatPrice(sisa)))
//table data
var res = doc.autoTableHtmlToJson(document.getElementById("basic-table"));
doc.autoTable(res.columns, res.data, {
margin: {
top: 180,
},
styles: {
fontsize: 10,
cellPadding: 1.5,
// overflow: 'linebreak',
valign: 'middle',
halign: 'center',
lineColor: [0, 0, 0],
lineWidth: 0.2
},
didDrawCell: function(rows) {
var pageNumber = doc.internal.getCurrentPageInfo().pageNumber;
if(pageNumber == 1){
if (rows.row.index > 0 && rows.row.index % 11 === 0 && rows.column.index === rows.table.columns.length - 1) {
doc.addPage();
}
}else{
if (rows.row.index > 0 && rows.row.index % 30 === 0 && rows.column.index === rows.table.columns.length - 1) {
doc.addPage();
}
}
}
});
addFooters(doc)
doc.save("table.pdf");
}
}
can someone help ????