Forum How do I...?

How to remove page breaks?

ariel
Hi guys. I'm converting HTML to PDF to be printed via Linux's lp command.

I'm using Prince version 11.3 and my printer is a thermal 80mm roll.

Though width is fixed (80mm), height is never known. It varies. Too much data to be printed is causing page breaks. As the paper is a roll, I do NOT want page breaks. From the docs, the only way I've seen to circumvent it was to inform, in @page, the property "size" with a height big enough. As I've stated that height changes, this is not an ideal solution. Also, if I do not fix a height size, the property "page-break-inside(or after or before): avoid;" has no effect.

Is there a parameter that I can pass to prince to FORBID page breaks?

Is there a command to remove page breaks?

What can I do?
mikeday
Currently Prince always requires a page size, so you would need to check if the output has more than one page and try running Prince again with a larger page size until it all fits.

We might be able to find a way to determine the total height automatically in the future, but most downstream processing software does have limits as to how big a page they will accept.
mikeday
One approach would be to make the page height very large so that everything fits on one page, then trim the PDF down to fit the actual content, or run Prince a second time with the correct page height. You can use the box tracking API to determine the total content height.
ariel
How can I trim the PDF with Prince?
mikeday
Prince cannot trim PDF files, but PDF processing tools may be able to automate this.

The way to do it with Prince would be to run Prince twice: once with a big page size and using JavaScript to measure the content size, then the second time specifying the page size measured the first time.
mikeday
The first time you would use JavaScript to check the content size, and the second time you would apply a modified CSS style sheet specifying that size in the @page rule.