最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Exporting a div's content to PDF - Stack Overflow

programmeradmin7浏览0评论

I know that there are a number of points regarding this question, but I just can't find what I'm looking for so I hope someone can answer me. So, what I'm trying to do is:

imagine you have a div that is 400 X 400 px. The user uploads an image and enters text via input[type="text"] and all of it is shown inside that div. I want to export all of the content of that div in a PDF, possibliy by JavaScript (jQuery) od PHP. What would be the best way to do it?

If anyone could show a small example (code), I would appreciate it!

I know that there are a number of points regarding this question, but I just can't find what I'm looking for so I hope someone can answer me. So, what I'm trying to do is:

imagine you have a div that is 400 X 400 px. The user uploads an image and enters text via input[type="text"] and all of it is shown inside that div. I want to export all of the content of that div in a PDF, possibliy by JavaScript (jQuery) od PHP. What would be the best way to do it?

If anyone could show a small example (code), I would appreciate it!

Share Improve this question edited Jun 25, 2017 at 11:15 ROMANIA_engineer 56.8k30 gold badges209 silver badges205 bronze badges asked Feb 16, 2014 at 9:09 gogo_rulezgogo_rulez 3892 gold badges11 silver badges25 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

You can use these jquery plugins

  1. https://github./mozilla/pdf.js

  2. https://github./MrRio/jsPDF

Maybe you could bine the PHP-Printer functions-api (http://www.php/manual/en/book.printer.php) with a software like, for example, PDF-Creator (http://sourceforge/projects/pdfcreator/). But this would imply that PDF-Creator is installed on the system of the user.

It's just a general idea ...

You can generate a PDF since a HTML page, with the WeasyPrint package. It's very easy to use and its most speed that javascript.

发布评论

评论列表(0)

  1. 暂无评论