angular - 如何使用jspdf autotable删除表格之间的边距
问题描述
我有一个使用 jspdf 的 Angular 应用程序,但它有很多错误,尤其是在图像和空间方面,所以我开始使用 jspdf autotable,这似乎更稳定,但表格之间有边距。这是我的代码:
const doc = new jsPDF()
//@ts-ignore
doc.autoTable({
theme: 'plain',
margin: {top: 0, bottom: 0},
head: [[ 'Logo mecprog placeholder', {content: 'ORDEM DE SERVIÇO', styles: {fontSize: 20, lineWidth: 1}}, 'logo cliente placeholder']],
body: [['',{content: ordemDeServico.cod, styles: {lineWidth: 1}}, '']]
})
//@ts-ignore
doc.autoTable({
theme: 'plain',
margin: {top: 0, bottom: 0},
head: [[ {content: 'Cliente', styles: {lineWidth: 1}},{content: 'Data Progamada', styles: {lineWidth: 1}}, {content: 'Data Executada', styles: {lineWidth: 1}}]],
body: [[{content: ordemDeServico.cliente.nomeFantasia, styles: {lineWidth: 1}}, {content: ordemDeServico.dataProgramada, styles: {lineWidth: 1}},{content: ordemDeServico.dataExecutada, styles: {lineWidth: 1}}]]
})
//@ts-ignore
doc.autoTable({
theme: 'plain',
margin: {top: 0, bottom: 0},
head: [[{content: 'Equipamento', styles: {lineWidth: 1}} , {content: 'Km/Hora Execução', styles: {lineWidth: 1}}, {content: 'Modelo', styles: {lineWidth: 1}}]],
body: [[{content: ordemDeServico.equipamento.equipamento, styles: {lineWidth: 1}},{content: this.check(ordemDeServico.quilometroExecucao), styles: {lineWidth: 1}},{content: this.check(ordemDeServico.equipamento.modelo), styles: {lineWidth: 1}}]]
})
//@ts-ignore
doc.autoTable({
theme: 'plain',
margin: {top: 0, bottom: 0},
head: [[{content: 'Equipamento', styles: {lineWidth: 1}} , {content: 'Km/Hora Execução', styles: {lineWidth: 1}}, {content: 'Modelo', styles: {lineWidth: 1}}]],
body: [[{content: ordemDeServico.equipamento.equipamento, styles: {lineWidth: 1}},{content: this.check(ordemDeServico.quilometroExecucao), styles: {lineWidth: 1}},{content: this.check(ordemDeServico.equipamento.modelo), styles: {lineWidth: 1}}]]
})
doc.save('table.pdf')
ordemDeServico 只是一个存储一些信息的对象,所以这并不重要,问题是即使我将边距设置为 0,表格本身也是分开的,所以我不知道该怎么办
解决方案
推荐阅读
- swift - 使结构列表符合 SwiftUI 协议
- android - 无法在 Android 11 上使用自定义 URI 方案从 WebViewClient 重定向到应用程序
- html - Safari 15.0 - 位置的奇怪问题:相对
- python - 在 python 中的 NorthPolarStereo 投影中绘制更少的风倒钩
- android - 将字体添加到下拉菜单
- automation - 托斯卡难题 81121 用 RBFW 解决(一次又一次)
- flutter - 如何在颤振中比较两个应用程序版本?
- regex - sed 中的正则表达式替换特定字符串
- javascript - 为 gantt.parse 构建对象任务
- performance - 使用 JMeter + Keycloak 授权流程注册用户