0

I have a website that has a url that ends in jobs/jif/id/1 - jobs/jif/id/1298. I need to print each one of those pages to pdf. There is a catch. The website information is protected by logging into the website. That issue I am ignoring until I figure out how to print to pdf given a url.

I have tried to use curl but that was a dead end for me. I am now using pdfkit to print each page. I am not married to using pdfkit or python. If I can just right a bat file for this that would be fine.

import pdfkit

url = 'https://registration.vtbigevent.org/committee/jobs/jif/id/'
config = pdfkit.configuration(wkhtmltopdf="C:/Program Files/wkhtmltopdf/bin")
for ids in range(1,1298):
    new_url = url + str(ids)
    pdf = str(ids) + '.pdf'
    pdfkit.from_url(new_url, pdf, configuration=config)

It should create 1298 pdfs in a folder.

Actual results is a compilation error with wkhtmltopdf.

PermissionError: [Errno 13] Permission denied: 'C:/Program Files/wkhtmltopdf/bin'

Another issue is that i know this will not save the pdf to the intended folder but that is low priority right now.

I edited my code to add configuration = config in the pdfkit line. Does that do what I think it does? I still get the permission error.

Byrge
  • 9
  • 4
  • As you mentioned, it is probably due to the compilation error with wkhtmltopdf. At first glance, the code looks fine for your use case. I think https://stackoverflow.com/q/27673870/3554071 is a great starting point. – engineercoding Apr 03 '19 at 20:33
  • 1
    "_Actual results is a compilation error with wkhtmltopdf. I can not post an image because I do not have 10 rep._" The error message is text and you can copy it here, no image required for anything. – takendarkk Apr 03 '19 at 20:34

0 Answers0