Page 1 of 1

JODConverter: Convert xlsx to PDF in LANDSCAPE, all sheets

Posted: Thu Jan 14, 2021 8:57 pm
by zmotiwala
Using the following code snippet

Code: Select all

        Map<String,Object> printSettings = new HashMap<String,Object>();
            printSettings.put("PaperOrientation", PaperOrientation.LANDSCAPE);
            printSettings.put("PaperFormat", PaperFormat.TABLOID);
            PropertyValue[] printerDesc = OfficeUtils.toUnoProperties(printSettings);
            XPrintable xPrintable = OfficeUtils.cast(XPrintable.class, document);
            xPrintable.setPrinter(printerDesc);
My first sheet in the xlsx file converts to landscape mode and tabloid paper format. But the rest of the sheets print in portrait mode. Is there any way to apply this for all sheets?

I am using JODConverter and LibreOffice.

Thanks!