u/OstrichHot283

LibreOffice CLI: PDF conversion - Fit columns to width?

Hi everyone,

I'm trying to automate the conversion of excel files to PDF using the LibreOffice CLI.

My Goal: I want the PDF output to behave exactly like the "Fit All Columns on One Page" setting in Excel or the "Shrink to width" option in LibreOffice Calc.

Horizontally: All columns must fit into a single page width (no side-scrolling or split columns).
Vertically: The rows should flow naturally to multiple pages as needed.

The Problem: When using the standard CLI commands;

It uses the default scaling, which often cuts off columns and puts them on separate pages. I am aware of environment variable tweaks, but I haven't found a specific flag for "Fit width to 1 page / height to automatic."

What I've tried:

  1. Changing the user profile settings in the GUI before running CLI (inconsistent results).
  2. Looking for a specific --convert-to pdf:calc_pdf_Export filter configuration, but the documentation is a bit sparse on scaling parameters.

Question: Is there a way to pass scaling arguments directly via CLI, or perhaps a way to inject a "Page Style" into the document during conversion that forces the width to 1 page while allowing vertical overflow?

Any help would be greatly appreciated!

reddit.com
u/OstrichHot283 — 12 hours ago