Hi Fabian, On Mon, May 21, 2012 at 11:26:25AM +0200, fabian wrote: > Hi Fernand, > > Thanks for replying! These comments are related to the XPrintable > Interface, which will work fine for direct printing I guess. In my > case I still want the user to select his printer and printer settings > therefore I need the OO print dialog.
You can use XPrintable to set the printer, this will have influence in printing the document, even if you don't invoke XPrintable.print() but dispatch .uno:Print Properties are described in http://www.openoffice.org/api/docs/common/ref/com/sun/star/view/PrinterDescriptor.html Read-only properties cannot be set, of course. And there is a settable property missing in the docs: "Name" "PaperOrientation" "PaperFormat" "PaperSize" "PrinterPaperTray" <-- undocumented Info taken from void SfxPrintHelper::impl_setPrinter() in sfx2/source/doc/printhelper.cxx Sub Main Dim oDoc as Object oDoc = ThisComponent Dim oDispatchProvider as Object Dim oDispatchHelper as Object oDispatchProvider = oDoc.getCurrentController().getFrame() oDispatchHelper = CreateUnoService("com.sun.star.frame.DispatchHelper") '=================================================================== ' Printer Settings Dim aPrintSettings(1) as new com.sun.star.beans.PropertyValue aPrintSettings(0).Name = "Name" aPrintSettings(0).Value = "Cups-PDF" aPrintSettings(1).Name = "PaperOrientation" aPrintSettings(1).Value = com.sun.star.view.PaperOrientation.LANDSCAPE oDoc.setPrinter(aPrintSettings) '=================================================================== 'Now notice that the paper orientation is reflected on the dialog! oDispatchHelper.executeDispatch(oDispatchProvider,".uno:Print","_self",0,Array()) End Sub Regards -- Ariel Constenla-Haile La Plata, Argentina
pgpOa7CfZkEHK.pgp
Description: PGP signature
