我們的應用程序之一創建了一個HTML報告,通過瀏覽器向用戶顯示。隨後將其轉換爲PDF文件,可以通過電子郵件發送或稍後查看。該報告可以被歸類爲醫療/生活方式。我被要求允許選擇和嵌入各種PDF,例如各種飲食和/或練習到HTML中。該軟件是用Python 2.7和wxPython 2.8編寫的。我試圖找到一種方法將PDF嵌入到HTML中進行查看,然後將所有內容轉換爲最終的PDF。將PDF導入/嵌入到HTML中(For PDF)
0
A
回答
0
幾個月前,我在這方面做了一些廣泛的研究。如果你想使用HTML顯示PDF,我首先看https://github.com/mozilla/pdf.js
如果你的目標是從HTML頁面生成PDF,那麼我會推薦https://github.com/fraserxu/electron-pdf這是一個服務器端解決方案來生成和發送PDF返回給客戶。
使用electron-pdf,您可以選擇在Node.JS API服務器後面運行該服務器,以保持Electron實例以最佳延遲運行。或者,您可以使用CLI從Python代碼調用導出。
自述文件涵蓋了基本的使用場景。
0
如果在Linux上運行,檢查出wkhtmltopdf
手冊頁如下:
Name:
wkhtmltopdf 0.12.2.4
Synopsis:
wkhtmltopdf [GLOBAL OPTION]... [OBJECT]... <output file>
Document objects:
wkhtmltopdf is able to put several objects into the output file, an object is
either a single webpage, a cover webpage or a table of content. The objects
are put into the output document in the order they are specified on the
command line, options can be specified on a per object basis or in the global
options area. Options from the Global Options section can only be placed in
the global options area
A page objects puts the content of a singe webpage into the output document.
(page)? <input url/file name> [PAGE OPTION]...
Options for the page object can be placed in the global options and the page
options areas. The applicable options can be found in the Page Options and
Headers And Footer Options sections.
A cover objects puts the content of a singe webpage into the output document,
the page does not appear in the table of content, and does not have headers
and footers.
cover <input url/file name> [PAGE OPTION]...
All options that can be specified for a page object can also be specified for
a cover.
A table of content object inserts a table of content into the output document.
toc [TOC OPTION]...
All options that can be specified for a page object can also be specified for
a toc, further more the options from the TOC Options section can also be
applied. The table of content is generated via XSLT which means that it can be
styled to look however you want it to look. To get an aide of how to do this
you can dump the default xslt document by supplying the
--dump-default-toc-xsl, and the outline it works on by supplying
--dump-outline, see the Outline Options section.
Description:
Converts one or more HTML pages into a PDF document, *not* using wkhtmltopdf
patched qt.
Global Options:
--collate Collate when printing multiple copies
(default)
--no-collate Do not collate when printing multiple
copies
--copies <number> Number of copies to print into the pdf
file (default 1)
-H, --extended-help Display more extensive help, detailing
less common command switches
-g, --grayscale PDF will be generated in grayscale
-h, --help Display help
--license Output license information and exit
-l, --lowquality Generates lower quality pdf/ps. Useful to
shrink the result document space
-O, --orientation <orientation> Set orientation to Landscape or Portrait
(default Portrait)
-s, --page-size <Size> Set paper size to: A4, Letter, etc.
(default A4)
-q, --quiet Be less verbose
--read-args-from-stdin Read command line arguments from stdin
--title <text> The title of the generated pdf file (The
title of the first document is used if not
specified)
-V, --version Output version information and exit
相關問題
- 1. HTML嵌入PDF iframe
- 2. 將PDF文件嵌入到/ var/www/pdf /目錄的html中
- 3. 在HTML中嵌入PDF
- 4. 將PDF字節數據嵌入HTML中
- 5. 在pdf中嵌入的pdf閱讀pdf
- 6. 在PDF中嵌入PDF(PDF收錄:))
- 7. 在PDF中嵌入SVG(使用JS將SVG導出爲PDF)
- 8. 導出爲PDF在MVC 4(嵌入HTML PDF格式)
- 9. Java:將HTML或PDF嵌入JFrame
- 10. 將PDF嵌入到電子表格中
- 11. 將條碼嵌入到C#PDF庫中
- 12. 將活動PDF嵌入到網頁中?
- 13. OpenXML將PDF嵌入到Excel中
- 14. 將XML文件嵌入PDF
- 15. 將字體嵌入PDF
- 16. 將視頻嵌入pdf?
- 17. 如何使用PDF :: API2將EPS嵌入到PDF中?
- 18. 將Crystal正確嵌入到PDF中正確嵌入TT字體
- 19. 嵌入PDF Viewer for PhoneGap應用程序
- 20. 將PDF嵌入到HTML中而不保存實際文件
- 21. 從pdf中獲取pdf文件嵌入
- 22. 將XMP元數據嵌入到PDF
- 23. 將HTML寫入PDF文件
- 24. pdf嵌入在emacs中?
- 25. iOS中嵌入PDF字體
- 26. 在pdf中嵌入視頻
- 27. 在IE10中嵌入PDF
- 28. HTML正在嵌入pdf源(iTextSharp)
- 29. 以html格式提交嵌入式pdf
- 30. html嵌入式pdf加載指示