fpdf自动纸张尺寸

I'm creating a pdf receipt for a POS Thermal printer, is there a way to create a custom paper size with fixed width but auto lenght?

the printer uses a roll of paper not a fixed paper size

thanks for any help.

No, it isn't possible to let the paper size just get bigger with every new Line you're inserting. As you can see in the documentation, parameter size, it's only possible to pass predefined paper sizes, like A4 and so on, OR to pass an individual paper size when you initialize FPDF.

You could try to 'guess' how much space will be needed, by creating a really long text, and see how far it gets. Then you could calculate the space per letter, and from now on calculate the paper size based on that in the beginning. Of course this will be far from perfect, but if you only have plain text in your PDF it could work out.