PDF/Print from Calc always has a blank right margin

I’m trying to create PDFs from LibreOffice Calc spreadsheets. To match the company’s style, the header and footer have background colors set and should cover the whole width of the resulting PDF.

The footer is an actual LO footer to display the page numbers. It stretches correctly to both sides and to the bottom of the PDF, no margin is visible.

The “header” is actually the first four rows of the sheet set to repeat, because it needs to reference cells in other sheets (author, date, version, classification, etc). This one clearly has a white margin to the right.

I set all margins in the page style dialog to zero. I got a warning when I did that about being outside the printable area, but since this document will never actually be printed (only exported as PDF), I went ahead and ignored the warning. The print range is properly defined, and the sheet is set to fit the width in 1 page (the height limit is left unset). The paper size is also correct; following the advice of another post in this forum, I tried using “Custom” instead of A4, but that had no effect.

I was wondering if the “printable area” warning could be the reason, so I installed a virtual PDF printer (via cups-pdf) with no margin requirements from the printer hardware. I set it as the default printer for this document, but that did not solve the problem.

I have added a minimal example document. The margin is visible in the “print preview” display and in the exported PDF: test2.ods (20.9 KB)

I am using LibreOffice 7.3.7.2 on Kubuntu Linux.

How can I get rid of this margin?


ed 1: added LO version
ed 2: better example document without custom font

apparently no easy way yet : tdf#90588

but apparently too can be tweaked a bit :wink:
test2x.ods (21.7 KB)

1 Like

Thanks for the bugtracker link. Bummer though.

Tweaked looks good. I assume you did that by adjusting the margins or column widths in print preview? That’s the only way I ever managed it. The obvious thing - move the right margin left - doesn’t work in my version, but I can randomly change col widths until the margin disappears.

That “works” until a column is added/deleted/resized and the margin is back. Then it’s back to rolling the dice with column widths… :roll_eyes:

yep :expressionless:

I guess, that it is caused by the “shrink to number of pages” algorithm doing some discrete reduction based on font size, which would decrease in steps of, say, 0.1pt. The resulting ratio will not be the exact ratio needed to fill the width completely, but some possibly smaller number.

1 Like