Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Classic Troubles with Python PDFKit

Hello everyone

I'm working on a simple python script which should be able to download a html page to a pdf file. For this I'm using the PDFKit module.

Everytime I do an export I get troubles with the line endings in the text of the right site. The text is cutted and the letters are not fully printed a.k.a. no more readable as full words.

I tested some different options with margins width etc. but everytime I get the page the letters are cutted.

Code
import pdfkit

options = {
    'page-size': 'A4',
    'margin-top': '10mm',
    'margin-right': '10mm',
    'margin-left': '10mm',
    'margin-bottom': '10mm',
    'encoding': "UTF-8",
}

url = "enter here a random medium platform link" # example page

pdfkit.from_url(url, 'out.pdf', options=options)

Does anyone have the same troubles or a quick fix for that?

Thank you!


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 631 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[C] by asteriskJun 16, 2019 09:52 PM 7 198 Jun 16, 2019 09:52 PM
Last Post: Irritiable
[Python] by Magpi3Jun 9, 2019 04:28 AM 1 127 Jun 9, 2019 04:28 AM
Last Post: FoxBlood