美文网首页
html、txt转pdf

html、txt转pdf

作者: e26f55e7ec23 | 来源:发表于2018-06-12 22:27 被阅读0次

html转pdf

url = 'https://www.linuxidc.com/Linux/2018-02/151063.htm'
#url

pdf_name = ' '
#生成文件名称 eg:pdf_name = 'linux.pdf'

pdfkit.from_url(url, pdf_name)
#生成pdf文件名称

txt转pdf

film = ' '
#目标txt文件地址 eg:film = 'I:\\AALLTEST\\17365.txt'

gener_pdf = ' '
#生成pdf文件名称

options = {
   'page-size': 'Letter',#页面尺寸
   'margin-top': '0.75in',#上边距
   'margin-right': '0.75in',#右边距
   'margin-bottom': '0.75in',#底边距
   'margin-left': '0.75in',#左边距
   'encoding':'GBK'#编码方式
}

pdfkit.from_file(film,gener_pdf,options=options)

相关文章

网友评论

      本文标题:html、txt转pdf

      本文链接:https://www.haomeiwen.com/subject/yyxdeftx.html