21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The StarDesktop 84<br />

Printer selection and settings<br />

The<br />

com.sun.star.view.XPrintable<br />

interface provides the Printer property, which selects the printer. This property receives a<br />

PropertyValue data field with the following settings:<br />

Name (String)<br />

specifies the name of printer.<br />

PaperOrientation (Enum)<br />

specifies the paper orientation (<br />

com.sun.star.view.PaperOrientation.PORTRAIT<br />

value for portrait format,<br />

com.sun.star.view.PaperOrientation.LANDSCAPE<br />

for landscape format).<br />

PaperFormat (Enum)<br />

specifies the paper format (for example,<br />

com.sun.star.view.PaperFormat.A4<br />

for DIN A4 or<br />

com.sun.star.view.PaperFormat.Letter<br />

for US letters).<br />

PaperSize (Size)<br />

specifies the paper size in hundredths of a millimeter.<br />

The following example shows how a printer can be changed and the paper size set with the<br />

help of the Printer property.<br />

Dim Doc As Object<br />

Dim PrinterProperties(1) As New com.sun.star.beans.PropertyValue<br />

Dim PaperSize As New com.sun.star.awt.Size<br />

PaperSize.Width = 20000 ' corresponds to 20 cm<br />

PaperSize.Height = 20000 ' corresponds to 20 cm<br />

PrinterProperties (0).Name="Name"<br />

PrinterProperties (0).Value="My HP Laserjet"<br />

PrinterProperties (1).Name="PaperSize"<br />

PrinterProperties (1).Value=PaperSize<br />

Doc.Printer = PrinterProperties()<br />

The example defines an object named PaperSize with the

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!