首页 > 其他分享 >wkhtmltopdf.exe HTML转PDF

wkhtmltopdf.exe HTML转PDF

时间:2024-05-16 19:31:37浏览次数:11  
标签:-- wkhtmltopdf Options HTML PDF document options page

wkhtmltopdf.exe下载地址https://wkhtmltopdf.org/

 

wkhtmltopdf.exe --enable-local-file-access  --encoding "UTF-8" --footer-html footer.html  file.html file.pdf

                             可访问本地图文                 编码                         页脚

 

 

E:\>"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" --enable-local-file-access "E:\HFTI.html" "E:\output.pdf
Loading pages (1/6)
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done

 

 

 

C:\Program Files\wkhtmltopdf\bin>wkhtmltopdf.exe -h
Name:
wkhtmltopdf 0.12.6 (with patched qt)

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 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> 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 <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 <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, maintained for backwards
compatibility; Same as using --log-level
none
--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

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://wkhtmltopdf.org/support.html>

标签:--,wkhtmltopdf,Options,HTML,PDF,document,options,page
From: https://www.cnblogs.com/vicvicvic/p/18196590

相关文章

  • 上百页html生成pdf解决方案(bookjs-easy)简洁完整版(包含接收服务端返回路径参数)
    依靠1:客户端插件 bookjs-easy(点击直接跳转官网)2:服务端插件screenshot-api-server实测105页的pdf,生成耗时40s左右,文件大小16MB项目需求:生成一个上百页的pdf,这个pdf包含表格、折线图、图片等,且横竖幅页面交叉 bookjs-easy官网的文档对于第一次看的人来说并不友好(建议第......
  • 怎么将PPT转换为PDF?3个免费方法值得收藏
    许多人在工作和学习中需要将PPT文件转换为PDF文件,以便更好地共享和保存。那么,怎么将PPT转换为PDF呢?本文将为您介绍几种简单易行的方法,帮助您快速完成转换。方法一:使用PowerPoint软件自带的功能转换要将PPT文档转换为PDF文件,最简单的方法之一就是使用PowerPoint软件自带的功能。......
  • C# 去掉字符串中的html 标签,保留指定的标签和属性
    ///<summary>///使用示例///</summary>publicstaticvoidHtmlRemove(){stringrequestBody="<html><head><title>Test</title></head><body><alay-her='123'href=\"https://ex......
  • 如何将pdf转换成ppt?这3种方法简单实用!
    PDF是一种常见的文档格式,而PPT则是一种常见的演示文稿格式。有时候,我们需要将PDF文件转换成PPT格式,以便在演示或展示中使用。下面,介绍pdf怎么转换成ppt的3种方法。一、使用在线转换工具这种方法是最简单、最快捷的方式之一。有很多在线工具都可以免费将PDF转成PPT,例如smallpdf中......
  • 把markdown文件转换为html文件
    使用pipinstallmarkdown模块只做到了分行;表格,-,和空格还没能无缝转换代码如下:importosimportcodecsimportmarkdowndefconvert_markdown_to_html(markdown_file):withcodecs.open(markdown_file,'r',encoding='utf-8')asfile:markdown_text=fil......
  • DevExpress WinForms中文教程 - HTML & CSS支持的实战应用(一)
    DevExpressWinForms拥有180+组件和UI库,能为WindowsForms平台创建具有影响力的业务解决方案。DevExpressWinForms能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!在这篇文章中,我们将概述使用DevExpressWinFormsH......
  • 使用playwright控制浏览器在服务器端将网页转化为PDF文件
    需求在实际需要中,经常存在需要在服务器端将网页转化为PDF文件保存下来。代码requirements.txt点击查看代码playwrightconvert_pdf.py点击查看代码fromplaywright.sync_apiimportsync_playwright,Playwrightimportargparsedefrun(playwright:Playwright,url......
  • Android WebView 加载 html页面 实现 不同分辨率 不同 dpi 缩放自适应处理 解决方案
    两种情况一起使用实现不同分辨率不同dpi缩放自适应处理//webview需要配置mWebView.getWebSetting().setUseWideViewPort(true);//让webview读取网页设置的viewport,pc版网页1、同分辨率不同dpi缩放自适应处理(也可以在android端注入相关js代码)<scripttype="text/......
  • 如何将pdf文件转换成jpg图片?这3种方法超简单
    日常我们有时把会图片文件转化为PDF文件,但是有时候由于工作的需要,在对文本、图片进行处理时,可能会将PDF文件转化为图片格式文件,比如pdf怎么转换成jpg图片等。那遇到pdf转换成图片的情况该如何转换?分享3个超简单的方法。方法一、截图转换如果你的PDF文件内容不会太过复杂,且内容较......
  • PDF加密转APK大师 (支持一机一码, 无需额外安装PDF浏览器, 强力加密保护PDF文件)
    PDF加密转APK大师是一款PDF加密软件,它可以把PDF文件直接转成安卓APP,并支持一机一码加密,静态密码加密等高级功能,可以用来保护PDF文档,防止未经授权的传播,并方便向用户收费.加密生成的APK被高强度加密混淆,并且PDF文件也使用了128位加密保护,可以有效保护PDF文件. ......