Pdfkit - A4 html page does not print in A4 pdf format
I reproduced my problem below:
-
I am drawing a 210x297 rectangle on a webpage
<!DOCTYPE html> <html> <style> div.rectangle { border: solid 1px; width: 210mm; height: 297mm; } </style> <head> </head> <body> <div class="rectangle"> <img/> </div> </body> </html>
-
I am converting this html document to pdf using pdfkit in Python
import pdfkit options = { 'page-size':'A4', 'encoding':'utf-8', 'margin-top':'0cm', 'margin-bottom':'0cm', 'margin-left':'0cm', 'margin-right':'0cm' } pdfkit.from_file('test.html', 'test.pdf', options=options)
-
I am getting a pdf with a rectangle in the upper left corner, which is about 5 times smaller ...
I would really appreciate it if you could take a look!
+3
source to share