Я нашел в интернете какой-то плагин, который создает png-изображение из HTML-таблицы. Но этот плагин загружает файл через браузер. Мне нужно сохранить этот файл в каком-то каталоге на сервере.
Этот плагин я обнаружил. Ссылка для скачивания плагина
Это мой HTML-код таблицы:
<a href="#" onClick="doExport('#countries', {type: 'png'});"> <img src='icons/png.png' alt="PNG" style="width:24px"> PNG</a>
<table class="table table-striped table-bordered" id="countries">
<thead class="thead-dark">
<tr>
<th scope="col">Number</th>
<th scope="col">Full Name</th>
<th scope="col">Working time</th>
<th scope="col">Pause</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>07:00-17:00</td>
<td>30 min</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>07:00-17:00</td>
<td>30 min</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>07:00-17:00</td>
<td>30 min</td>
</tr>
</tbody>
</table>
Это js-код:
function doExport(selector, params) {
var options = {
//ignoreRow: [1,11,12,-2],
//ignoreColumn: [0,-1],
//pdfmake: {enabled: true},
tableName: 'Table name'
};
jQuery.extend(true, options, params);
$(selector).tableExport(options);
}
Это мой проект: Ссылка для скачивания
Я работал в файле "test / test.html"