pdfcrowd api的python3客户端。
pdfcrowd3的Python项目详细描述
pdfcrowd api允许您轻松地从web页面或原始html创建pdf python3应用程序中的代码。
要使用该api,您需要在pdfcrowd.com上有一个帐户,如果没有,则可以注册here。这会给你一个用户名 以及一个api密钥。
例如:
import pdfcrowd try: # create an API client instance client = pdfcrowd.Client("username", "apikey") # convert a web page and store the generated PDF into a pdf variable pdf = client.convertURI('http://example.com') # convert an HTML string and save the result to a file html="<html><body>In-memory HTML.</body></html>" client.convertHtml(html, open('html.pdf', 'wb')) # convert an HTML file client.convertFile('/path/to/local/file.html', open('file.pdf', 'wb')) except pdfcrowd.Error as why: print('Failed: {}'.format(why))