Webpage to pdf conversion python

214 Views Asked by At

I'm quite new to python and programming in general so please forgive any naivety.

I would like to convert this webpage into a pdf: http://www.ukmt-resources.org.uk/JMC16.html

I am using pdfkit and wkhtmltopdf on my Mac via terminal. It does the job, but the pdf that is produced is useless as the pdf ends up looking like this

Is there any way/are there any settings I could add that would convert it into some form of readable format where there are a reasonable number of questions per page?

Thanks for any help!

1

There are 1 best solutions below

0
On BEST ANSWER

It looks like your page consists of a number of

<p> 

tags with single images in them. Perhaps you need to pre-process the page, breaking it up into multiple pages prior to processing.

You have to make the decision about page placement, because it's difficult to have the PDF generator make decisions about how to break up something that doesn't have pages (HTML) - into pages (PDF).