Skip to content

Blocked access to file  #164

@CapAllen

Description

@CapAllen

Error:

OSError: wkhtmltopdf reported an error:
Loading pages (1/6)
Warning: Blocked access to file /home/jiashengjie/workspace/Tongweici_app/static/style.css
Warning: Blocked access to file /home/jiashengjie/workspace/Tongweici_app/pics/rank.png
Warning: Blocked access to file /home/jiashengjie/workspace/Tongweici_app/result_pics/position.png
Warning: Blocked access to file /home/jiashengjie/workspace/Tongweici_app/pics/onfire.png
Warning: Blocked access to file /home/jiashengjie/workspace/Tongweici_app/pics/offfire.png
Warning: Blocked access to file /home/jiashengjie/workspace/Tongweici_app/pics/quxiang.png
Warning: Blocked access to file /home/jiashengjie/workspace/Tongweici_app/result_pics/geo_lines_chart.png
Warning: Blocked access to file /home/jiashengjie/workspace/Tongweici_app/static/watermark.js
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Counting pages (2/6)                                               
Resolving links (4/6)                                                       
Loading headers and footers (5/6)                                           
Printing pages (6/6)
Done                                                                      
Exit with code 1 due to network error: ProtocolUnknownError

Environment:

Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-111-generic x86_64)
pdfkit 0.6.1
wkhtmltopdf 0.12.6-1.bionic_amd64

My Code Example:

html:

<head>
    <meta http-equiv="content-type" content="text/html charset=utf-8">
    <link rel="stylesheet" media="all" href="./static/style.css" />
</head>

pdfkit:

path_wkthmltopdf = '/usr/local/bin/wkhtmltopdf'
config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
#  https://stackoverflow.com/questions/62315246/wkhtmltopdf-0-12-6-warning-blocked-access-to-file
options = {"disable-local-file-access":""}
pdfkit.from_file(html, to_file, configuration=config,options=options)

Thanks for your help! THX!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions