unoconv / unoserver

MIT License
596 stars 81 forks source link

Possibility to get page count and page sizes of a document? #10

Closed mara004 closed 3 years ago

mara004 commented 3 years ago

Is there any way to obtain the number of pages + page sizes a LibreOffice-compatible document has, before converting it?

For some background, I am working on a private Python PDF tool that follows a concept of importing documents into a custom data model (currently PDFs or images), applying transformations and then crafting a new PDF according to this model. I would like to use unoserver to integrate importing/conversion support for LO-compatible documents. However, a key requirement for my data model is that information on page count and page sizes is available before actually performing the conversion.

mara004 commented 3 years ago

After looking into the internals of uno a bit, it seems difficult to extract this information... I therefore convert to PDF on the importer stage now - that's not optimal, but it works and probably is the easiest solution for now.