如何在自动表中定义宽度和高度

萨拉斯

我的代码

$("#button1").on('click', exportOne);
function exportOne()
 {
 var pdf = new jsPDF("p", "pt","a4");

 var res = pdf.autoTableHtmlToJson(document.getElementById("table2"));

 pdf.autoTable(res.columns, res.data);

var res2 = pdf.autoTableHtmlToJson(document.getElementById("table"));
pdf.autoTable(res2.columns, res2.data, {
startY: pdf.autoTableEndPosY() + 16.6
});

pdf.fromHTML($("#otherdivcontent").get(0), 70, 300, {
'width': 500
});

// pdf.autoPrint();

pdf.save('Report.pdf');
};

生成的pdf是这个 输出

我该如何解决这个问题?我想在页面内部打印整个表格...

萨拉斯
 pdf.autoTable(res2.columns, res2.data, {
     startY: false,
     theme: 'grid',
     tableWidth: 'auto',
     columnWidth: 'wrap',
     showHeader: 'everyPage',
     tableLineColor: 200,
     tableLineWidth: 0,
     columnStyles: {
         0: {
             columnWidth: 50
         },
         1: {
             columnWidth: 50
         },
         2: {
             columnWidth: 50
         },
         3: {
             columnWidth: 50
         },
         4: {
             columnWidth: 50
         },
         5: {
             columnWidth: 'auto'
         },
         6: {
             columnWidth: 50
         },
         7: {
             columnWidth: 50
         },
         8: {
             columnWidth: 'auto'
         }
     },
     headerStyles: {
         theme: 'grid'
     },
     styles: {
         overflow: 'linebreak',
         columnWidth: 'wrap',
         font: 'arial',
         fontSize: 10,
         cellPadding: 8,
         overflowColumns: 'linebreak'
     },
 });

pdf格式pdf格式

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

插入后如何在自定义ImageView中获取位图的宽度和高度

如何在WPF中根据窗口的宽度和高度调整控件的宽度和高度

如何在图像C#中设置宽度和高度

如何在OpenCV Python中设置框架的高度和宽度

如何在xml中交换ImageView的高度和宽度

如何在Flutter中调整IconButton的大小(高度和宽度)

如何在Android中获得可用的屏幕宽度和高度

如何在OpenCV中获取图像的宽度和高度?

如何在WebRTC中获取远程视频的宽度和高度

如何在js中设置图像对象的高度和宽度

如何在Android中获取弹出菜单的高度和宽度?

如何在PowerPoint中从LoadImage()指向宽度和高度

如何在Flutter中确定图像的宽度和高度?

如何在指令和组件中获取元素的宽度/高度?

如何在vuetify中填充窗口的高度和宽度

如何在iOS中获取屏幕的宽度和高度?

如何在SwiftUI中按比例设置高度和宽度?

如何在Flutter中更改列的宽度和高度?

如何在AvalonDock中设置高度和宽度

如何在iOS 8中设置UIAlertController的高度和宽度

如何在Android中获取显示图像的宽度和高度?

如何在代码中传递图像的宽度和高度

如何在引导程序中获取窗口的高度和宽度

如何在SwiftUI中设置图像的宽度和高度?

如何在SwiftUI中获取视图或屏幕的高度和宽度

如何在BindingAdapter中访问视图的宽度和高度?

如何在 Kotlin 中更改 AlertDialog 的宽度和高度

如何在Libgdx中设置屏幕的宽度和高度?

如何在反应中获得正确的画布宽度和高度?