Apache OpenOffice (AOO) Bugzilla – Issue 47407
XPagePrintable ignores print options
Last modified: 2013-02-24 21:09:31 UTC
printing a text document through XPagePrintable ignores the FileName property and prints directly to the printer instead. Doing the same with XPrintable works correctly (writes to a file). Example snipplet: PropertyValue[] printOpts = new PropertyValue[1]; printOpts[0] = new PropertyValue(); printOpts[0].Name = "FileName"; printOpts[0].Value = "/tmp/out.ps"; xPrintable.setPrinter(new PropertyValue[0]); XPagePrintable xPagePrintable = (XPagePrintable)UnoRuntime.queryInterface(XPagePrintable.class, xPrintable); // this works (prints to /tmp/out.ps) xPrintable.print(printOpts); // this doesn't (prints to printer) xPagePrintable.printPages(printOpts);
the value for the FileName has to be a FileURL ... changing the script to PropertyValue[] printOpts = new PropertyValue[1]; printOpts[0] = new PropertyValue(); printOpts[0].Name = "FileName"; printOpts[0].Value = "file:///tmp/out.ps"; should do the trick. Generally all UNO calls that expect filenames have to work with fileurls ... if one still works with system pathes this is historically grown ;-)
closing