Printer Properties
Printer properties are used to control printer settings used by the method SendPrint.
Printer properties are set and queried using the SIS_OT_PRINTER
constant and the GetFlt/GetInt/GetStr/GetProperty and SetFlt/SetInt/SetStr/SetProperty methods. The nObject& argument is not required with SIS_OT_PRINTER
, and should be set to 0.
Note: When the printer properties are being used then all of them must be set, because all of them are used every time the SendPrint method is called.
Printer Properties
Printer Properties
-
- Device name: _device$
The printer device name.
In Microsoft Visual Basic this is the DeviceName property of a Printer object.
- Driver name: _driver$
The printer driver. This will typically be "winspool".
In Microsoft Visual Basic this is the DriverName property of a Printer object.
- Number of copies: _copies&
The number of copies to print, in the range 1 to 100.
- Orientation: _orientation&
The printer page orientation, i.e. portrait or landscape.
In Microsoft Visual Basic this is the Orientation property of a Printer object. The Microsoft Visual Basic constants for orientation, vbPRORLandscape
and vbPRORPortrait
, should be used.
- Output port: _output$
The printer output port.
In Microsoft Visual Basic this is the Port property of a Printer object.
- Paper length: _paperLength&
The length of the printer page (in 1/10ths of a millimetre), in the range 100 to 32000 (10mm to 3.2m). This property is only used if Paper size is set to 0 or 256.
In Microsoft Visual Basic this can be calculated from the Height property of a Printer object. The Height property of a Microsoft Visual Basic Printer object is specified in twips, and should be converted to 1/10ths of a millimetre. A twip is a unit of screen measurement equal to 1/20 of a printer's point. There are approximately 1440 twips to a logical inch, or 567 twips to a logical centimetre or 5.67 twips to 1/10 of a millimetre (the length of a screen item measuring one inch or one centimetre or 1/10 of a millimetre when printed).
- Paper size: _paperSize&
The printer page size. If this is set to 0 or 256 then the Paper length and Paper width properties will be used instead.
In Microsoft Visual Basic this is the PaperSize property of a Printer object. The Microsoft Visual Basic constants for the recognised paper sizes, e.g vbPRPSA4
for A4, should be used.
- Paper width: _paperWidth&
The width of the printer page (in 1/10ths of millimetre), in the range 100 to 32000 (10mm to 3.2m). This property is only used if Paper size is set to 0 or 256.
In Microsoft Visual Basic this can be calculated from the Width property of a Printer object. The Width property of a Microsoft Visual Basic Printer object is specified in twips, and should be converted to 1/10ths of a millimetre. A twip is a unit of screen measurement equal to 1/20 of a printer's point. There are approximately 1440 twips to a logical inch, or 567 twips to a logical centimetre or 5.67 twips to 1/10 of a millimetre.(the length of a screen item measuring one inch or one centimetre or 1/10 of a millimetre when printed).
Example of an API command for another paper size:
''Compose the current map for printing
Dim uPrinterSettings As New PrintDialog
uPrinterSettings.AllowSelection = False
uPrinterSettings.AllowSomePages = False
uPrinterSettings.AllowPrintToFile = False
If uPrinterSettings.ShowDialog() = DialogResult.OK Then
Sis1.SetStr(SIS_OT_PRINTER, 0, "_device$", uPrinterSettings.PrinterSettings.PrinterName)
Sis1.SetStr(SIS_OT_PRINTER, 0, "_driver$", "winspool")
Sis1.SetStr(SIS_OT_PRINTER, 0, "_output$", "")
Sis1.SetInt(SIS_OT_PRINTER, 0, "_copies&", uPrinterSettings.PrinterSettings.Copies)
Sis1.SetInt(SIS_OT_PRINTER, 0, "_paperSize&", uPrinterSettings.PrinterSettings.DefaultPageSettings.PaperSize.RawKind)
If uPrinterSettings.PrinterSettings.DefaultPageSettings.Landscape = False Then
Sis1.SetInt(SIS_OT_PRINTER, 0, "_orientation&", 1)
Else
Sis1.SetInt(SIS_OT_PRINTER, 0, "_orientation&", 2)
End If
Sis1.DoCommand("AComPrintTemplateWizard")
End If
Send comments on this topic.
Click to return to www.cadcorp.com
© Copyright 2000-2017 Computer Aided Development Corporation Limited (Cadcorp).