如何使用只有javascript的简单表生成PDF文件? [英] How to generate PDF files with simple tables using ONLY javascript?

查看:90
本文介绍了如何使用只有javascript的简单表生成PDF文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我需要使用一个没有边框的简单表生成文件,这些表应该出现在页面顶部。有谁知道怎么做?最近我开始学习javascript所以我更喜欢这个问题的解决方案不包含任何其他库,如jQuery等......



我是什么尝试过:



到目前为止,我发现了jsPDF脚本,但它不包含表选项。我找到的jsPDF的其他插件,其中包括使用表,它们实际上不起作用。

提前谢谢。

解决方案

看看同样在这个开源项目中: PDF.js [ ^ ]。



但是,首先,请想一想:你真的想要生成PDF,而不是更合理的东西,例如HTML。

PDF是不可编辑的,在电脑上阅读也不是那么令人愉快,这是一种电子纸。它对Web来说完全陌生,不属于W3标准。如果您使用HTML,您的问题将是微不足道的,结果可用于所有系统,而不是比PDF差,等等。



-SA

Hi everybody. I need to generate files with a simple table without border which should appear on top of the page. Does anyone know how to this? Recently I started learning javascript so I would prefer if the solution to this problem does not contain any other libraries such as jQuery or so...

What I have tried:

So far I discovered jsPDF script but it doesn't contain table option. Other plugins to jsPDF that I found and which include working with table, they are actually not working.
Thanks in advance.

解决方案

Look also at this open-source project: PDF.js[^].

But, first of all, think at this: do you really want to generate PDF, not something more reasonable, for example, HTML.
PDF is not editable, and not so pleasant to read on a computer, this is rather a kind of electronic paper. It is totally foreign to the Web, is not a part of W3 standards. If you used HTML, your problem would be trivial, the result usable on all systems, not worse than PDF, and so on.

—SA


这篇关于如何使用只有javascript的简单表生成PDF文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆