5
5
6
6
7
7
def from_url (url , output_path = None , options = None , toc = None , cover = None ,
8
- configuration = None , cover_first = False , verbose = False ):
8
+ configuration = None , cover_first = False , verbose = False , timeout = None ):
9
9
"""
10
10
Convert file of files from URLs to PDF document
11
11
@@ -17,18 +17,19 @@ def from_url(url, output_path=None, options=None, toc=None, cover=None,
17
17
:param configuration: (optional) instance of pdfkit.configuration.Configuration()
18
18
:param cover_first: (optional) if True, cover always precedes TOC
19
19
:param verbose: (optional) By default '--quiet' is passed to all calls, set this to False to get wkhtmltopdf output to stdout.
20
+ :param timeout: (optional) if passed, uses this timeout value (in seconds) for the wkhtmltopdf command
20
21
21
22
Returns: True on success
22
23
"""
23
24
24
25
r = PDFKit (url , 'url' , options = options , toc = toc , cover = cover ,
25
- configuration = configuration , cover_first = cover_first , verbose = verbose )
26
+ configuration = configuration , cover_first = cover_first , verbose = verbose , timeout = timeout )
26
27
27
28
return r .to_pdf (output_path )
28
29
29
30
30
31
def from_file (input , output_path = None , options = None , toc = None , cover = None , css = None ,
31
- configuration = None , cover_first = False , verbose = False ):
32
+ configuration = None , cover_first = False , verbose = False , timeout = None ):
32
33
"""
33
34
Convert HTML file or files to PDF document
34
35
@@ -41,18 +42,19 @@ def from_file(input, output_path=None, options=None, toc=None, cover=None, css=N
41
42
:param configuration: (optional) instance of pdfkit.configuration.Configuration()
42
43
:param cover_first: (optional) if True, cover always precedes TOC
43
44
:param verbose: (optional) By default '--quiet' is passed to all calls, set this to False to get wkhtmltopdf output to stdout.
45
+ :param timeout: (optional) if passed, uses this timeout value (in seconds) for the wkhtmltopdf command
44
46
45
47
Returns: True on success
46
48
"""
47
49
48
50
r = PDFKit (input , 'file' , options = options , toc = toc , cover = cover , css = css ,
49
- configuration = configuration , cover_first = cover_first , verbose = verbose )
51
+ configuration = configuration , cover_first = cover_first , verbose = verbose , timeout = timeout )
50
52
51
53
return r .to_pdf (output_path )
52
54
53
55
54
56
def from_string (input , output_path = None , options = None , toc = None , cover = None , css = None ,
55
- configuration = None , cover_first = False , verbose = False ):
57
+ configuration = None , cover_first = False , verbose = False , timeout = None ):
56
58
"""
57
59
Convert given string or strings to PDF document
58
60
@@ -65,12 +67,13 @@ def from_string(input, output_path=None, options=None, toc=None, cover=None, css
65
67
:param configuration: (optional) instance of pdfkit.configuration.Configuration()
66
68
:param cover_first: (optional) if True, cover always precedes TOC
67
69
:param verbose: (optional) By default '--quiet' is passed to all calls, set this to False to get wkhtmltopdf output to stdout.
70
+ :param timeout: (optional) if passed, uses this timeout value (in seconds) for the wkhtmltopdf command
68
71
69
72
Returns: True on success
70
73
"""
71
74
72
75
r = PDFKit (input , 'string' , options = options , toc = toc , cover = cover , css = css ,
73
- configuration = configuration , cover_first = cover_first , verbose = verbose )
76
+ configuration = configuration , cover_first = cover_first , verbose = verbose , timeout = timeout )
74
77
75
78
return r .to_pdf (output_path )
76
79
0 commit comments