Question

I'm developing an Java application which prints files selected by the user. The LibreOffice SDK/Uno seems perfect for this, since it allows me to print many different file types without relying on eternal GUIs (which is a must).

However, for this framework to fully meet my needs, it also needs to provide the page count before printing the document(s). I have spent a fair amount of time researching the answer, but the examples and the API which OOo and LibreOffice provide aren't the best.

Could anyone tell me definitively whether or not this interface will provide a page count or, alternatively, suggest an replacement? Thanks!

Was it helpful?

Solution

I see this has been dormant for a while. In case you still need an answer - yes you can get the page count from Libre Office via Java.

    int nPageCount = com.sun.star.uno.AnyConverter.toInt(
            xPropertySet.getPropertyValue("PageCount"));

So you'll need to use the API to load the document, interrogate the page count. If you search for "uno" and "PageCount" you'll find complete code examples (such as OO mail archives which also apply to LibreOffice)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top