Does anyone know how to select the output bin/tray when printing an OOo
document from Java?
I know how to select the input tray; PrinterPaperTray is being used.
These are my defined trays:
*INPUT TRAYS:*
Bypass Tray
Tray 1
Tray 2
*OUTPUT TRAYS*
Inner Tray 1 (Lower)
This is the code I use to set the input tray.
XTextDocument aTextDocument = (XTextDocument) UnoRuntime.queryInterface(
XTextDocument.class, xcomp);
XText xText = aTextDocument.getText();
XTextCursor xTextCursor = xText.createTextCursor();
XPropertySet xTextCursorProps = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, xTextCursor);
String pageStyleName = xTextCursorProps.getPropertyValue
("PageStyleName").toString();
XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier)
UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, aTextDocument);
XNameAccess xFamilies = (XNameAccess) UnoRuntime.queryInterface(
XNameAccess.class, xSupplier.getStyleFamilies());
XNameContainer xFamily = (XNameContainer) UnoRuntime.queryInterface(
XNameContainer.class, xFamilies.getByName("PageStyles"));
XStyle xStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class,
xFamily.getByName(pageStyleName));
XPropertySet xStyleProps = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, xStyle);
xStyleProps.setPropertyValue("PrinterPaperTray","Tray 1");
There doesn't seem to be a way to set the output tray directly, but there
must be a way to access the same driver information that is saved within the
PrintSetup section of a document. I mean, OOo Writer can access and save
this information, why can't it be done through Java for my purposes?
Thanks
-John