Batch convert only selected pages

I need to convert several pptx and odp presentations to pdf format but only selected pages. I found out that libreoffice --convert-to pdf my_file.odp converts my_file to pdf but it converts all slides. Is there any efficient way to tell libreoffice to only convert i.e. pages/slides 1, 2 and 5?

You should really add what operating system you are on for questions like this. It makes a lot of difference if you’re on Windows or Linux.

I use Linux, debian stretch.

One obvious solution is to print to PDF, something you can easily do in Windows. Just select Print, select the General tab of the Print window, select Print to PDF. The rest is simple.

EDIT I found this link:
Apparently you should play with the PageRange property and figure out how to include things like “1;4-12;56-59”.

Yeah, I can do it via GUI but I have quite a lot of presentations so I wrote script that would select the pages I need but now I need to pass this information to the libreoffice from terminal. I tried to look for a filter that would select only the pages I need during libreoffice conversion however I didn’t find any.

It seems that we have to tear out essential information from you to be able to help you. You should be more forthcoming. Don’t leave us guessing. Tell us what you got so far, and where exactly you are stuck. Post part of the script if necessary. All that I can say right now is that if you call the Export command in Writer to do the conversion, you won’t be able to set a pages range because IIRC the Export command works only on entire files.

I am able to convert entire presentation to pdf. However I only need to convert certain pages. I can convert the entire presentation and then use other tool to export only the pages I need. But if the presentations are big then the conversion takes quite a lot of time. So I am looking for a way to batch convert only certain pages to pdf.