[英]Exporting web page as PDF
I have SVG images, and lot of text with inline CSS, in an HTML page. 我在HTML页面中有SVG图片,以及带有嵌入式CSS的大量文本。 I need to export all of them into PDF.
我需要将它们全部导出为PDF。 Suggest to me proper technology which caters to my need.
向我建议适合我需要的适当技术。 I am using JavaScript and jQuery as front end and Python as backend.
我使用JavaScript和jQuery作为前端,使用Python作为后端。
UPDATE: 更新:
I have tried jsPDF, but it is not preserving the CSS styling and I am not able to export images also. 我已经尝试过jsPDF,但是它不能保留CSS样式,因此也无法导出图像。
If you want to do it server-side , there's a python package for that: 如果要在服务器端执行此操作,则有一个python软件包:
Otherwise, you can do it in the browser but you will loose the CSS . 否则,您可以在浏览器中执行此操作,但是将丢失CSS 。 jsPDF appears to have experimental support for converting HTML to a PDF, or you can programmatically populate a PDF document with similar content.
jsPDF似乎具有将HTML转换为PDF的实验性支持,或者您可以以编程方式填充具有相似内容的PDF文档。 SVG is supported via plugin.
通过插件支持SVG。
Demo: 演示:
Github: Github:
Do you know the wkhtmltopdf command line tools? 您知道wkhtmltopdf命令行工具吗? I was in a project where I also needed to convert a web page to PDF and I used this library (I used PHP as backend) and it worked very well for me.
我当时在一个项目中,我还需要将网页转换为PDF,并且我使用了这个库(我使用PHP作为后端),并且对我来说非常有效。
I hope I have helped :D 我希望我有所帮助:D
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.