0

I'm trying to create an invoice in A4 format dynamically using airium in python. The creation of the HTML page works as expected. HTML page

the porblem comes with the conversion to a .pdf, I tried many tools but the best results I had where with weasyprint, but a part of the invoice is cut out, and with pdfkit and wkhtmltopdf, but the invoice number move on it's own. How can I fix the issue, knowing that the HTML and the PDF must be to the A4 format and render the same no matter the file type ?

from weasyprint import HTML path = "C:\\Users\\Administrateur\\data\\Dev\\" input_html = path + "invoice.html" output_pdf = path + "invoice.pdf" HTML(input_html).write_pdf(output_pdf) 
import pdfkit path = "C:\\Users\\Administrateur\\data\\Dev\\" input_html = path+"invoice.html" output_pdf = path+"invoice.pdf" path_wkhtmltopdf = "C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe" config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf) pdfkit.from_file(input_html, output_pdf, configuration=config) 
2
  • I don't see anything wrong about the place where the invoice number is located. Could you point us what the problem is? I also don;t see any part of the invoice cut down Commented Oct 7, 2024 at 16:22
  • it is under the company detail section creating a gap, instead of at it's right like on the HTML. See the hyperlinked images for the cut in weasyprint Commented Oct 7, 2024 at 16:42

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.