I have set PaperOrientation and PaperFormat but I can't find where to set right,left,page margin. xPageProps always equals null.
static void setPaper(Object oDoc_To_Store, com.sun.star.view.PaperOrientation paperOrientation,com.sun.star.view.PaperFormat paperFormat) {
com.sun.star.view.XPrintable xPrintable =
UnoRuntime.queryInterface(
com.sun.star.view.XPrintable.class, oDoc_To_Store);
com.sun.star.beans.PropertyValue[] pv = new com.sun.star.beans.PropertyValue[2];
pv[0] = new PropertyValue();
pv[0].Name="PaperOrientation";
pv[0].Value=paperOrientation;//com.sun.star.view.PaperOrientation.LANDSCAPE;
// pv[0].State=pv[0].State.DEFAULT_VALUE;
pv[1] = new PropertyValue();
pv[1].Name="PaperFormat";
pv[1].Value=paperFormat;//com.sun.star.view.PaperFormat.A4;
// pv[1].State=pv[0].State.DEFAULT_VALUE;
xPrintable.setPrinter(pv)
com.sun.star.beans.XPropertySet xPageProps = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xDrawPage);
if ((xPageProps!=null)) {// Always = null,
System.out.println("++++++++ xPageProps!=null");
Property[] pp = xPageProps.getPropertySetInfo().getProperties();//
int ii =pp.length;
for (int i = 0; i < pp.length; i++) {
System.out.println(pp[i].Name+" "+pp[i].Attributes+" "+pp[i].Type);
}
}