foliojs / pdfkit

A JavaScript PDF generation library for Node and the browser
http://pdfkit.org/
MIT License
9.89k stars 1.15k forks source link

Auto Height Mode #1398

Open touhidurrr opened 2 years ago

touhidurrr commented 2 years ago

Feature Request

Auto height or width in PDFkit

Feature description

I want to use PDFKit with Thermal Printers. As Thermal printers don't print pages but from a paper roll, I need to output single page PDFs with automatic height that fits the content. So can we have something like size: [80mm, 'auto']

Foohx commented 2 years ago

Don't know if this feature will be implemented one day.

But actually, you can write all your content in a doc then get the doc.y cursor. Now you have the size of your content, use it to create a new doc and replace your content.

touhidurrr commented 2 years ago

Don't know if this feature will be implemented one day.

But actually, you can write all your content in a doc then get the doc.y cursor. Now you have the size of your content, use it to create a new doc and replace your content.

Can you show me an example?