Limit number of pages to convert

Issues with installing under all GNU/Linux Distributions
Post Reply
mortelekim
Posts: 2
Joined: Tue Dec 01, 2020 10:27 am

Limit number of pages to convert

Post by mortelekim »

Hi,

for our application we're using the CLI to convert Office documents into PDF's followed by ImageMagick converting those PDF's to preview-images for each page. This is all fine, but for extensive xls-files this results in a very though process.
So I was wondering if it's possible to already restrict the amount of pages to be converted from xls(x) to PDF by Open Office? Off course we have the option to restrict the number of pages via ImageMagick, but the sooner in the process, the better.
Command we're using is : soffice --headless --convert-to pdf --outdir [somedir] [somefile.xlsx]

Thanks in advance
K.
LibreOffice 6.3.4.2 30(Build:2)
Ubuntu 18.04.3 LTS
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Limit nrof pages to be converted

Post by Villeroy »

You can load the document and restrict the print area. Then export to PDF and close without saving. I'm not sure if this would work in headless mode.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
mortelekim
Posts: 2
Joined: Tue Dec 01, 2020 10:27 am

Re: Limit nrof pages to be converted

Post by mortelekim »

Villeroy wrote:You can load the document and restrict the print area. Then export to PDF and close without saving. I'm not sure if this would work in headless mode.
And this is possible through the CLI?
LibreOffice 6.3.4.2 30(Build:2)
Ubuntu 18.04.3 LTS
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Limit nrof pages to be converted

Post by Villeroy »

It is possible to run the office in some kind of server mode listening on a port. Then you could write a program in Python, Java or Cpp connecting to the office, loading the file, calling the right API for the print area and file export. I have no experience with this kind of stuff. I know that many such programs suffered from memory leaks.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply