The PrintingPreferences object controls printing preferences settings used for document conversion.
The PrintingPreferences object allows you to control all those options that can be setup in Printer Properties window when converting documents manually but at programmatic conversion. These options include paper size, resolution and orientation. In addition, this object can be used to change default printing preferences shown in Default Printing Preferences window.
There are three possible scenarios of using PrintingPreferences object:
To create an ad hoc PrintingPreferences object, you need to create it using "Print2Flash5.PrintingPreferences" ProgID such as in the following example:
set MyPref=CreateObject("Print2Flash5.PrintingPreferences") |
Set DefPref=P2F.DefaultPrintingPreferences |
Here P2F refers to Server object instance.
Regardless of the method you obtained a PrintingPreferences object, initially it contains the default printing preferences as they have been setup in Default Printing Preferences window. After you obtained a reference to PrintingPreferences object using one of the methods above, you can access its properties and methods.
Name | Type | Read-only | Description |
---|---|---|---|
Actual | Boolean |
Yes |
Indicates if current object settings correspond to the global default printing preferences. Initially, after creating a PrintingPreferences object, it should return true. If you changed some of the object properties or global default printing preferences were changed since then, this property may return false. You can use this property to check if your PrintingPreferences instance is actual with regard to the global default printing preferences |
FormName | String | Yes | The current form selected for printing, e.g. "Letter", "A4", etc. The form name can be set using SetFormName method. If current paper size is specified using custom page width and length, this property returns an empty string |
Orientation | Integer | No | Page orientation. It should be set to one of the values from PAPER_ORIENTATION enumeration |
PaperLength | Integer | Yes | Current page length in tenths of millimeter (0.1 mm). Page length and width can be specified using SetCustomPaperSize method |
PaperWidth | Integer | Yes | Current page width in tenths of millimeter (0.1 mm). Page length and width can be specified using SetCustomPaperSize method |
Resolution | Boolean | No | Printing resolution in dots per inch (DPI). It can be any value between 96 and 600 DPI |
Method saves the default printing preferences.
ApplyChanges()
None
Method takes the object properties and saves them as the default printing preferences. If you intend to change the global default printing preferences, you need to call this method to save the changes.
The following example obtains a default printing preferences object, modifies some of its properties and save the changes back to the global default printing preferences. The example assumes that enumeration constants file P2FAPIConst.vb from Print2Flash SDK is included:
Set DefPref=P2F.DefaultPrintingPreferences DefPref.Resolution = 200 DefPref.Orientation = ORIENT_LANDSCAPE DefPref.SetFormName("Letter") DefPref.ApplyChanges |
Method specifies a custom paper size.
SetCustomPaperSize (Width, Length)
Name | Type | Description |
---|---|---|
Width | Integer | Page width in tenths of millimeter (0.1 mm) |
Length | Integer | Page length in tenths of millimeter (0.1 mm) |
Use this method to specify a custom paper size. This method is recommended to use if you want to specify a non-standard paper size. To specify a standard paper size such as "Letter" you may use SetFormName method. The current paper size can be retrieved using PaperLength and PaperWidth properties.
The following example creates an ad hoc printing preferences object and specifies custom paper size 15x20 cm.
set MyPref=CreateObject("Print2Flash5.PrintingPreferences") MyPref.SetCustomPaperSize(1500,2000) |
Method sets a standard paper size specified by form name.
SetFormName (FormName)
Name | Type | Description |
---|---|---|
FormName | String | Name of the form. The list of valid form
names depends on your computer operating system and printing settings. You
may see the list of available form names in this way:
|
Use this method to specify a standard paper size. To specify custom paper size use SetCustomPaperSize method.
The following example creates a default printing preferences object and specifies standard paper size with the form name "A4"
Set DefPref=P2F.DefaultPrintingPreferences DefPref.SetFormName("A4") |
The sample below creates an ad hoc printing preferences object, sets its properties and use it for conversion of a document named C:\Docs\MyDoc.txt
set MyPref=CreateObject("Print2Flash5.PrintingPreferences") MyPref.SetFormName("Letter") MyPref.Orientation = ORIENT_PORTRAIT P2F.ConvertFile "C:\Docs\MyDoc.txt", , , ,MyPref |
Set DefPref=P2F.DefaultPrintingPreferences DefPref.SetFormName("Legal") DefPref.Resolution=96 P2F.ConvertDir "C:\Docs" P2F.ConvertDir "C:\ReadyDocuments" |