Kozea / WeasyPrint

The awesome document factory
https://weasyprint.org
BSD 3-Clause "New" or "Revised" License
6.84k stars 653 forks source link

Create single page pdf for thermal printer #2147

Closed erlipsa closed 1 month ago

erlipsa commented 1 month ago

Hello, I want create single page content pdf for directly print using thermal printer. Here, my print design is invoice_print_html.docx

Please provide all available solutions in your response.

liZe commented 1 month ago

Hi @erlipsa,

We use GitHub issues to track bugs, not to ask for support for HTML/CSS design.

If you want some community help about a specific design, you can ask on forums such as StackOverflow, or read some documentation about CSS on MDN for example. You can also study WeasyPrint’s samples. There are plenty of resources online to learn how to design documents with HTML and CSS!

We, at Courtbouillon, also provide professional support if you want to delegate the creation of your documents.

patbengr commented 1 month ago

This issue doesn't relate to HTML/CSS design. CSS @page rule, does not support dynamic page sizing. While CSS @page does allow specific page size declarations, it doesn't offer dynamic height adjustments.

WeasyPrint lacks support for dynamic page height adjustments. Similarly, alternatives like wkhtmltopdf also do not provide this feature. The current workarounds involve setting a large fixed height and cropping the excess, or attempting to calculate the height based on invoice items, which may not always yield accurate results.

I think it can be implemented in WeasyPrint but it will need changes in the python code.