esinker / DjangoTutorialByLiuJiang-HTML2PDF

Django的教程资料,将刘江的博客转化为PDF,方便阅读学习
4 stars 5 forks source link

Can't Run #1

Closed fr0nky0ng closed 4 years ago

fr0nky0ng commented 4 years ago

报错如下,我用的是Macbook,homebrew安装的python,我下载了Mac版的Wkhtmltopdf工具包,但是仍然出现下面的报错,请老大帮忙看看,谢谢

`开始将网页html合并为PDF Traceback (most recent call last): File "crawler.py", line 72, in get_content(INDEX_URL) File "crawler.py", line 65, in get_content pdfkit.from_file(htmls, '刘江的Django博客' + ".pdf", options=options) File "/usr/local/lib/python3.7/site-packages/pdfkit/api.py", line 49, in from_file return r.to_pdf(output_path) File "/usr/local/lib/python3.7/site-packages/pdfkit/pdfkit.py", line 159, in to_pdf raise IOError("wkhtmltopdf exited with non-zero code {0}. error:\n{1}".format(exit_code, stderr)) OSError: wkhtmltopdf exited with non-zero code 1. error: You need to specify at least one input file, and exactly one output file Use - for stdin or stdout

Name: wkhtmltopdf 0.12.5 (with patched qt)

Synopsis: wkhtmltopdf [GLOBAL OPTION]... [OBJECT]...

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 contents. 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 single 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 single webpage into the output document, the page does not appear in the table of contents, 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 contents object inserts a table of contents 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 contents is generated via XSLT which means that it can be styled to look however you want it to look. To get an idea 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, using wkhtmltopdf patched qt.

Global Options: --collate Collate when printing multiple copies (default) --no-collate Do not collate when printing multiple copies --copies 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 --log-level Set log level to: none, error, warn or info (default info) -l, --lowquality Generates lower quality pdf/ps. Useful to shrink the result document space -O, --orientation Set orientation to Landscape or Portrait (default Portrait) -s, --page-size Set paper size to: A4, Letter, etc. (default Letter) -q, --quiet Be less verbose, maintained for backwards compatibility; Same as using --log-level none --read-args-from-stdin Read command line arguments from stdin --title 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 Page Options: --print-media-type Use print media-type instead of screen --no-print-media-type Do not use print media-type instead of screen (default) Contact: If you experience bugs or want to request new features please visit https://github.com/wkhtmltopdf/wkhtmltopdf/issues `

esinker commented 4 years ago

该项目只是个闲时一个脚本,不再维护。如果想直接下载PDF 可将该项目clone下来。版本回退,PDF再上一个版本里,谢谢关注