HTML Tabel呈现为PDF。 Pdf中的内容不是表格格式
在这里,我试图使用一个HTML页面表格内容制作PDF。 对我而言,它在创建PDF和下载方面工作得很好,但问题是我没有得到我在HTML页面中使用的正确表格格式(它在网页中看起来像我在PDF中所需要的那样)。 下面给出我的代码和表结构。 我正在使用HTML表导出jQuery插件
我的HTML代码
Details Time Track user linked user's User section 08:30 - 09:30 nill 09:30 - 12:00 Inoo
smartphones a big hit in world 09:30 - 12:00 user Key
smartphones a big hit in world 12:00 - 13:30 User 13:30 - 14:30 T Track T User smartphones a big hit in world smartphones a big hit in world smartphones a big hit in world T track T user smartphones a big hit in world smartphones a big hit in worldsmartphones a big hit in world T track T user smartphones a big hit in world smartphones a big hit in worldsmartphones a big hit in worldsmartphones a big hit in world
Genrate
使用inline-css而不是外部css据我所知,只有表元素上的内联CSS才能正确导出。 我在这里找到了这个
我知道我的比赛有点晚了。 但我发布这个以防任何人最终在这里寻找答案。
我们可以使用jsPDF auto-Table插件为你的pdf添加一个格式良好的表。 要使用它,请下载并包含jspdf.plugin.autotable.js和jspdf.min.js 。
它使用简单,并具有多种表格格式。
您可以在此GitHub存储库中找到完整的文档。