Choosing export page for writer_jpg_Export

I’m prototyping a REST-based service that uses LibreOffice as a background engine for document conversion to various outputs. I noticed that e.g. for a Word document, writer_jpg_Export exports the first page so I assume I would have to do the conversion a page at a time. Any pointers as to where I could set a parameter indicating which page I would like converted?

Thanks in advance,
Nik

There is no parameter to define page to export to a raster image. LibreOffice only can export the first page using raster image filter parameters.

You could instead export to PDF, and use dedicated tools like ImageMagick to post-process as required.

Ouch. Thanks for the reply. There is no option if you would go deeper into the document, iterate over the pages and call conversion in some other way for each?

Thanks in advance,
Nik

In any case, I would prefer to keep it within the JVM and avoid external programs, perhaps iText has something

You can use UNO to control LibreOffice, say, using Python or Java. This way you can do that directly from LibreOffice - you may check how Export As Images extension did that for Impress/Draw (extension is a ZIP; basic source code is inside; you may get the idea what to do out of that).

I don’t get that “I would prefer to keep it within the JVM and avoid external programs” - that is impossible with LibreOffice anyway, since it is an external program.

Thanks for the reply. Yes, I realize that LO is an external program and it’s an necessary evil since there are no(?) java libraries that come close to handling as many formats as LO does. I’m just trying to avoid the need to installing and launching further external programs (without e.g. java Process).

I tried rendering to PDF and then use PDFBox to generate the page images and merging them, it appears to be working fine.

Thanks for the help, I love to see an active community - many places noob-questions just go unanswered :wink:

Actually StoreToUrl used with the filter writer_jpg_Export exports the page containing the current PageCursor (ViewCursor).

See also: [Writer] Export to Non-searchable PDF(full content as image) (View topic) • Apache OpenOffice Community Forum .
There is a demo about aoutomating the export of a Writer document page by page to jpeg images.