--print-to-pdf headless gives me a .ps file on GNU

I have an process where i look if i have print zones in an Excel file and if is so I use --print-to-file in order to have only generated the Printing Areea, it works well in windows , but in a sort of VM GNU server i get only a .ps file .

Your title says “–print-to-pdf headless gives…”, but there is no --print-to-pdf command line option. And using --print-to-file may use your default printer (my assumption, if --printer-name is ommitted), which may create a Postscript file on your system (which is quite normal on a GNU system). See the driver for your default printer, which may be based on ghostscript

First, thanks for your answers.
Yes ,the command I use is –print-to-file & !use any printe_name, so for sure it goes to a file_name.ps .
What i would like to achieve ifi possible by --convert-to pdf is " if the original document fil has defined a Print Areea" to convert only this print areea. Can this be done by ––convert-to command/some options on the command?

so for sure it goes to a file_name.ps .

I did not disagree to the statement a .ps file being created rather than stating, that I’d assume this normal. And if your default printer creates Postscript output you get a .ps file. My default printer creates PDF hence I get a PDF file:

user@system:> libreoffice7.0 --headless --print-to-file LoremPrintToFileTest.odt                        
print /tmp/LoremPrintToFileTest.odt -> /tmp/LoremPrintToFileTest.pdf using <default_printer>

In other words: If you want print-to-file creating a PDF file, you have (from my perspective) two options:

  1. Set up a printer creating PDF and set as default printer ( or use --printer-name printer_name)
  2. Postprocess the .ps file using ps2pdf, which is part of ghostscript package (on my openSUSE 15.2 system).

Yes definitivly this is the solution,than,s for teh support. In any case if you know maybe how and if possible how to trick –convert-to PDF in order to work only over the print areea defined in the document (if any).

how to trick --convert-to PDF

No way - --convert-to is designed to get a conversion of the original as close as possible to the original document. In that sense there are neither methods to change the original document nor methods to convert part of the original document.

Hello, (again)

you could check under Tools → Options → Print → Print to file …
the Settings and see if these influcence the behaviour of in headless print-to-file

Especially the option / checkbox

[ ] PDF as standard print job format

might be of interest.

Hope that helps.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

Have a nice day and let’s (continue to) “Be excellent to each other!”

–conver-to is converting all the original document, I would like to convert only PrintAreeas that are defined in it, adf if there are any … all the document

i updated my answer … maybe the UI setting also apply for the headless call.

Thanks I think this works very well on windows, but can’t do this, only if this setting could be done soemwhere in the GNU/Linux version;

My setup is on Linux and this setting should be availabe there. Isn’t it for you?