Property | Type | Description |
Value | VARIANT (String Name) | (Read / Write) All the Text Driver properties. This is Default Property.
Meaning, it could be referred as obj("property_name") as well as obj.Value("property_name")
All the parameters are listed below. |
DocumentName | String | (Read Only) Original name of the printed document |
TotalPages | Number | (Read Only) Total estimated amount of pages in current print job |
RenderedPages | Number | (Read Only) Amount of rendered pages in current print job |
TotalJobs | Number | (Read Only) Number of printed documents spooled in Text Driver and waiting for processing |
JobProperty | VARIANT (String Name) | (Read Only) Current job various properties. All the parameters are listed below. |
AutoSave | Number | (Read / Write) 0 - interactive mode; 1 - Process and Auto-send to the specified destinations |
Identity | Number | (Read / Write) Identity value to replace {{IDENTITY}} tag |
Format | String | (Read / Write) Selects format plug-in ("Output Style"). PLug-ins should be named by their internal (short) names. The following values are valid: Formatted - "Formatted Text" TWL - "Text with Layout" XML - "XML" RSS - "RSS" Plain - "Plain Text" |
FormatParam | VARIANT(String PluginName, String ParameterName) | (Read / Write) Format Plug-in Parameters. All the parameters for all plug-ins are listed below. |
FormatParamNoCheck | VARIANT(String PluginName, String ParameterName) | (Write Only) Format Plug-in Parameters. Use this option to set only appropriate property, without updating plug-in user interface and checking value. This option is useful when you need to set all options in a batch, and some options affect others. After all options are set, call FormatCheckSettings to update plug-in state correctly. |
FormatPluginNames | String Collection | (Read Only) List of installed format plug-ins (XML, Plain Text and so on) |
Transport | String | (Read / Write) Selected Transport Plug-in names. If more than one transport plug-in selected, names should be comma delimited. The following values are valid: Clipboard, FTP, File, HTTP. Mail, Printer. |
TransportParam | VARIANT(String PluginName, String ParameterName) | (Read / Write) Transport Plug-in Parameters All the parameters for all plug-ins are listed below. |
TransportParamNoCheck | VARIANT(String PluginName, String ParameterName) | (Write Only) Transport Plug-in Parameters. Use this option to set only appropriate property, without updating plug-in user interface and checking value. This option is useful when you need to set all options in a batch, and some options affect others. After all options are set, call TransportCheckSettings to update plug-in state correctly. |
TransportPluginNames | String Collection | (Read Only) List of installed transport plug-ins (File, FTP and so on) |
Printer | String | (Read / Write) Name of the currently selected printer |
Printers | String Collection | (Read Only) List of all printers in Text Driver collection. |
RedirectPrinter | String | (Read / Write) Name of the currently selected printer for redirection. If empty, no redirection will be performed. |
SystemPrinters | String Collection | (Read Only) List of all printers installed in the system. Useful for user interface, this property allows UI to avoid using spooler API. |
DefaultPrinter | String | (Read Only) Name of the default printer in the system. |
UILoaded (hidden) | Number | (Read / Write) 0 - UI not loaded; 1 - UI loaded. UI should set this value when it loaded and initialized and clear (set to 0) on unload. When you read from this property, it returns number of UIs loaded. |
UILoadedWithEvents (hidden) | Number | (Write only) 0 - UI not loaded; 1 - UI loaded. UI should set this value when it loaded and initialized and clear (set to 0) on unload. UI chould use this value if it needs to receive all necessary print job events (StartJob, StartPage, EndJob) even if it started in the middle of print job processing (see UI working scheme). |
Listeners (hidden) | Number | (Read only) Number of processes/modules subscribed to events. Text Driver may work with several UIs and ordinary listeners. UIs, in difference of listeners, registers themselves using UILoaded. |
Method | Parameters | Description |
GetPage | Number, returns String | Get a rendered page by index. |
UpdatePage | Number n, String s | Replace contents of nth page by s. |
CancelJob | None | Cancel current Print Job. Returns immediately. |
CancelJobWait | None | Cancel current Print Job. Waits until current job will be cancelled and the new one will be opened, if any. |
CancelAllJobs | None | Cancel all jobs for this printer |
SaveConfiguration | None | Save current configuration for active user and active printer |
SaveCommonConfiguration | None | Save current configuration for all users (who do not have own configurations yet) and active printer |
SavePage | Number page_number | Send particular page through selected Transport Plug-Ins. Returns immediately. |
SaveAllPages | None | Send All through selected Transport Plug-Ins. Returns immediately. |
SavePageWait | Number page_number | Send particular page through selected Transport Plug-Ins. Waits until page will be saved. |
SaveAllPagesWait | None | Send All through selected Transport Plug-Ins. Waits until all pages will be saved. |
Stop | None | Unloads plug-ins, get ready for unloading from memory. System will unload Miraplacid Text Driver core form memory with 2-5 seconds delay. We recommend you to add this method call at the end of each script. |
FormatCheckSettings | String plug-in | Call this method after updating several plug-in settings in a batch (using FormatParamNoCheck). Some settings may affect others, and this method guarantees that they will be updated in correct order. |
TransportCheckSettings | String plug-in | Call this method after updating several plug-in settings in a batch (using TransportParamNoCheck). Some settings may affect others, and this method guarantees that they will be updated in correct order. |
Redirect | String printer, String document | This method provides an alternative way to print a copy of print job to another printer. Unlike RedirectPrinter
property, which allows to set printer for automatic redirect, this method may be used in scripts or external programs
when additional analysis needed to decide, redirect this job to that printer or not. Returns immediately. "Document" parameter allows you to provide alternative name of redirected print job. Ignored if NULL or empty string. |
RedirectWait | String printer, String document | The same as Redirect method, but waits until redirect process will be completed. |
LoadUI | None | Loads user interface component if it is not already loaded. |
UnloadUI | None | Unloads user interface component, if it supports OnUnload event. |
GetEMFPage | Number index, String filename | Extracts a page referred by index from current job and saves it as a file "filename" in EMF format. Caller is responsible for deleting this file. This method works only with print jobs in EMF format. Special tags supported. |
SetEMFPage | Number index, String filename | Assigns a file "filename" to be a content of page referred by index. File must be in EMF format. Caller is responsible for deleting this file. File must not be deleted before the job is redirected. To set page back to original content from print job spool file, set filename to empty string or NULL value. This page manipulation will affect only EMF print job intended for redirect to another printer, not text job image for save. This method works only with print jobs in EMF format. Special tags supported. |
obj.Value("Charset") = 1250
obj("Charset") = 1250
Property | Type | Description |
Charset | Number | Character set (codepage number)
5 - UNICODE 437 - OEM American DOS 850 - OEM Latin-1 DOS 852 - OEM Eastern Europe DOS 866 - OEM Cyrillic DOS 932 - Japanese 936 - Chinese (Simplified") 949 - Korean 950 - Chinese (Traditional)" 1250 - ANSI Latin-1 Windows 1251 - ANSI Cyrillic Windows 1252 - ANSI Eastern Europe Windows 1257 - ANSI Baltic Windows ...etc... |
UnixEOL | Number | End Of Line style
0 means "Windows" EOL style (\r\n or 0x0D, 0x0A) 1 means "UNIX" EOL style (\n or 0x0A) |
PageBreak | Number | 1 - insert page break symbols (0xc) between pages; 0 - don't. |
UnicodePrefix | Number | 1 - insert Unicode prefix (0xfeff) before Unicode content; 0 - don't. |
REMFMargins | Number | Value of redirection margins enumeration: 0 - Auto-compensated, 1 - Auto-normal, 2 - Custom. |
REMFTop | Number | Value of top custom margin. |
REMFBottom | Number | Value of bottom custom margin. |
REMFLeft | Number | Value of left custom margin. |
REMFRight | Number | Value of right custom margin. |
REMFCompatibility | Number | Turn on/off Save as Image mode for EMF redirection |
REMFConstrain | Number | Turn on/off constrain proportions for EMF redirection |
RTextFont | String | Name of font which will be used for text redirection |
RTextSize | Number | Text size which will be used for text redirection |
RTextWeight | Number | Font weight (100 - 900) which will be used for text redirection |
RPrinterSettings | ByteArray | One-dimentional Safearray of bytes containing printer settings (DEVMODE). To use default printer settings, set this value to the empty Safearray of bytes. |
var job_status = obj.JobProperty("Status")
Property | Type | Description |
JobID | Number | System print job ID for the current job. 0 if no active job. |
Status | Number | Current job status. Binary flags (ORed):
|
Resolution | Number | Resolution for the current job, in DPI. 0 if no active job. |
Printer | String | Printer name for the current job. Empty string if no active job. |
Document | String | Document name for the current job. Empty string if no active job. |
Format | String | Data format for the current job - TEXT / NT EMF 1.006 / NT EMF 1.007 / NT EMF 1.008. Empty string if no active job. |
SpoolFile | String | Spool file name with full path for the current job. Empty string if no active job. |
SepFile | String | Separator file name with full path for the current job. Empty string if no active job or if no separator page applied to the job. |
obj.TransportParam("File","filename")="textout_{{PAGE}}.txt"
File | ||
Property | Type | Description |
path | String | Destination File Path. Special tags supported. |
filename | String | Destination File Name. Special tags supported. |
open | Number | Opens resulting text file with post-processor. |
hide | Number | 0 = show post-processor window. 1 = hide post-processor window. Ignored if open=0. |
exec | String | Post-processor filename with full path. Special tags supported. Ignored if open=0. |
param | String | additional parameters for post-processor. Special tags supported. Ignored if open=0. |
append | Number | Set it to 0 if you wish to overwrite resulting file. Set it to 1 if you wish to append current result to a previous file. |
wait | Number | Set it to 1 if you wish to wait application termination before continue. Ignored if open=0. |
FTP | ||
Property | Type | Description |
url | String | Destination FTP directory URL. Special tags supported. |
file | String | Destination File Name. Special tags supported. |
passive | Number | 0 = FTP passive mode OFF. 1 = FTP passive mode ON. |
user | String | FTP server username. |
password | String | FTP server password. |
HTTP | ||
Property | Type | Description |
url | String | Destination HTTP URL. Special tags supported. |
file | String | Destination File Name. Special tags supported. |
put | Number | 0 = use POST method. 1 = use PUT method. |
user | String | username. |
password | String | password. |
Printer | ||
Property | Type | Description |
printer | String | Printer name. Can be a real printer name or "Default" string which means default printer. |
settings | ByteArray | One-dimentional Safearray of bytes containing printer settings (DEVMODE). To use default printer settings, set this value to the empty Safearray of bytes. |
font | String | Font family name to use in print output or "Default" string to not to use any specific font when printing. |
charset | Number | Numeric code of character set or DEFAULT_CHARSET value (equal to 1). |
weight | Number | Weight of characters to be used in print output. The following values will be accepted: 0 - DONTCARE 100 - THIN 200 - EXTRALIGHT 300 - LIGHT 400 - NORMAL 500 - MEDIUM 600 - SEMIBOLD 700 - BOLD 800 - EXTRABOLD 900 - BLACK |
height | Number | Height of characters to be used in print output. |
italic | Number | Specifies an italic font if set to 1. |
strikeout | Number | Specifies an strikeout font if set to 1. |
underline | Number | Specifies an underline font if set to 1. |
Property | Type | Description |
String | A set of email addresses of mail recipients, separated by semicolon. | |
subject | String | Email subject. Special tags supported. |
message | String | Email message body. This value will be used as a header before actual email content (printed pages). Text Driver will place this message, separator line, then printed pages. Special tags supported. |
attach | Number | Set it to 1 if you wish to send result as an attachment. |
filename | String | Name of file which will be used as an attachment. Special tags supported. |
Clipboard | ||
Property | Type | Description |
open | Number | Opens resulting text file with post-processor. |
hide | Number | 0 = show post-processor window. 1 = hide post-processor window. Ignored if open=0. |
exec | String | Post-processor filename with full path. Special tags supported. Ignored if open=0. |
param | String | additional parameters for post-processor. Special tags supported. Ignored if open=0. |
wait | Number | Set it to 1 if you wish to wait application termination before continue. |
obj.FormatParam("TWL","margins")=1
Plain Text (Plain) | ||
Property | Type | Description |
delim | String | Delimiter which will be used to separate text boxes during rendering. This value may include the following escaped special characters: \s (whitespace), \t, \r, \n, \f, \\ (backslash itself) and \xnnnn (nnnn is a hexadecimal code of Unicode symbol). |
Formatted Text (Formatted) | ||
Property | Type | Description |
margins | Number | 1 - use printer margins in text rendering (at top and left side); 0 - don't. |
usespaces | Number | 1 - use whitespace strings from document; 0 - don't. |
right | Number | 1 - use right alignment rendering; 0 - don't. |
char | Number | Character width calculation option: 0 - "Automatic, each page", 1 - "Automatic, first page", 2 - "Fixed value". |
cwidth | Number | Manual character width if char option is set to 2. |
Text with Layout (TWL) | ||
Property | Type | Description |
margins | Number | 1 - use printer margins in text rendering (at top and left side); 0 - don't. |
usespaces | Number | 1 - use whitespace strings from document; 0 - don't. |
XML (XML) | ||
Property | Type | Description |
optimize | Number | 1 - merge textboxes into whole words; 0 - don't. |
space | Number | Value in percents of average symbol width (10 - 100). |
RSS-Atom (RSS) | ||
Property | Type | Description |
author | String | Author attribute of RSS channel/Atom feed (document). |
link | String | Link attribute of RSS channel/Atom feed (document). |
description | String | Description attribute of RSS channel/Atom feed (document). |
br | Number | 1 - add <BR> tag to the end of description lines; 0 - don't. HTML content type for Atom feed. |
Event | Parameters | Description |
OnStartJob | None | Called when Core receives start job signal from driver. |
OnPageRendered | Number | Called when Core receives all text fragments for the current page and rendered it with currently selected Rendering plug-in. |
OnAllPagesRendered | None | Called when Core receives end job signal from driver and rendered all job pages. |
OnCancelJob | None | Called when Core finishes all activity with current job as an acknowledge for CancelJob call from UI or after SendAll process end. The job is removed from MTD. |
OnSavingEvent | Number event | Called on start and finish of various saving and processing stages. This event lets receiver know exactly
when and which process is going on. The following codes suported:
|
OnUnload | None | Called when AutoSend property is set to true. UI should unload upon receiving this event. |
OnProgress | String source, Number value | Called when some lengthy process is taking place. Source could be a name of transport plug-in - in this case it reflects sending progress for this particular plug-in; or special value "Redirect" which reflects the state of redirection to another printer. Value is the value of progress indicator (0 - 100). |
OnError | Number code, String message | Called when some error is happened. Message is textual representation of
the error. There are the folowing codes could be passed to this event:
|
OnPageSaving | Number | Called when Core saves particular page. Parameter is a number of page. UI may use this value to update its page number. |
OnAddRemovePrinter | Number | Core monitors printers add/remove operations and default printer change in the system. When this happen, it generates this event to let UI update lists of printers.
In responce to this event, UI must update its own printer lists and send update signal to its set of transport plug-ins to allow them update their printer lists,
by calling CheckSettings method with appropriate parameter. Parameter may have the following values:
|
OnSettingChanged | String target, String property, Variant value | When some of clients connected to particular Core object changes a property of this object, Core will
broadcast this event to all its listeners. For Core properties, target will be "Core", for plug-ins - plug-in name. Other parameters are property name and its new value. Using this mechanism, it is possible to use Text Driver with several UIs or other listeners, each will always have actual set of property values. Special case of property is a "Printer" value. It changes when Core receives print job for different printer or after initial configuration load. UI must re-read all the configuration from Core. If property changed to its current value, event will be sent with empty Variant. Please, note that client (UI) initiated the change will receive this event as well. |
OnSettingsChangeFailed | String target, String property | If some configuration parameter has been changed incorrectly, or change in one parameter changes another settings, Core fires this event. In responce to this event, UI must reload apporpriate porperty. |
Property | Type | Description |
Valid | Number | (Read Only) May be used to examine current evaluation state. Has the following values:
|
Users | String Collection | (Read / Write) List of users currently allowed to print to Text Driver. Implemented in Terminal Server version only. |
UserLicenses | Number | (Read Only) Maximum number of end user licenses. Implemented in Terminal Server version only. |
Method | Parameters | Returns | Description |
SetLicense | String RegName, String Keycode | Number | This method is intended for registering Text Driver. Application must provide Registration Name and Keycode generated by Miraplacid to this method. Resulting value is 1 if registration succeeded, 0 if not. |
LoadUI | None | None | Method LoadUI allows application to force loading UI which will ask user for registration information. This could be done if Valid property returns 2 or 3. |
Property | Type | Description |
Value | Variant | (Read/Write) Any properties that your plug-in may have. Some of them (listed in Layout) will be saved into configuration in registry and restored from it. |
ValueNoCheck | Variant | (Write Only) The same as Value, but does not check value itself or against other values and does not update UI. Use to prevent update relative settings in a wrong order. When all the settings updated, call CheckSettings method. |
Name | String | (Read Only) Plug-in name for internal use. |
Descirption | String | (Read Only) Plug-in name use in user interface or so (full name). |
Layout | String | (Read Only) This string contains a list of properties (Values) which should be saved in configuration or restored from it. Format of this string is: "Bparam1,Lparam2,EParam3", where "B", "L" and "E" are prefixes meaning type of parameter (BSTR, Long and Encrypted BSTR, which will be saved in encrypted form and decrypted on load from registry, accordingly). Parameter names should be separated by commas. Spaces are not allowed. |
Extension | String | (Read Only) File extension corresponding current rendering plug-in, without leading period, i.e. "xml", "rss". |
Method | Parameters | Description |
StartDoc | Number DPI; returns String | MTD Core call this member when it performs SaveAll procedure (saves whole document). DPI is print job resolution.
This will happen after all rendering has completed. Plug-in should return document header to Core. If document has no special header, plug-in should return E_NOTIMPL. |
EndDoc | no parameterts; returns String | MTD Core call this member when it performs SaveAll procedure (saves whole document).
This method will be called directly after StartDoc. Plug-in should return document footer to Core. If document has no special footer, plug-in should return E_NOTIMPL. |
StartPage | Number PageNo, Number Xsize, Number Ysize | MTD Core call this member before rendering each page. PageNo is page number (0-based), XSize is X dimension in "dots", Ysize is Y dimension. |
Add | Number X0, Number X1, Number Y0, Number Y1, String text, String font | With this method, MTD Core feeds rendering plug-in with textboxes for rendering. X0, X1, Y0, Y1 are textbox coordinates, "text" is a text itself, "font" is a font name. |
Render | no parameterts; returns String | MTD Core call this member when it finishes adding all textboxes of the page to rendering plug-in. Plug-in should render the text and return it to Core. |
CheckSettings | no parameterts; returns nothing | Call this method after a series of ValueNoCheck done to perform values (mutual) check and update plug-in UI state. |
InitSettings | no parameterts; returns nothing | Core calls this method when there is no configuration for current printer loaded. Plug-in must update its internal settings and UI. |
Method | Parameters | Description |
OnChangeParam | String plugin, String param, VARIANT val | When some plug-in parameter has changed via user interface, plug-in informs about that with OnChangeParam event. "plugin" is internal name of plug-in, "param" is a name of changed parameter, "val" is a new value of parameter. |
Property | Type | Description |
Value | Variant | (Read/Write) Any properties that your plug-in may have. Some of them may be saved into configuration in registry and restored from it. |
ValueNoCheck | Variant | (Write Only) The same as Value, but does not check value itself or against other values and does not update UI. Use to prevent update relative settings in a wrong order. When all the settings updated, call CheckSettings method. |
Name | String | (Read Only) Plug-in name (short). |
Layout | String | (Read Only) This string contains a list of properties (Values) which should be saved in configuration or restored from it. Format of this string is: "Bparam1,Lparam2,EParam3", where "B", "L" and "E" are prefixes meaning type of parameter (BSTR, Long and Encrypted BSTR, which will be saved in encrypted form and decrypted on load from registry, accordingly). Parameter names should be separated by commas. Spaces are not allowed. |
Method | Parameters | Description |
Start | None | MTD Core call this member when it begins saving text page(s). Plug-in may update its internal state and prepare resources. |
Process | IRenderedCollection coll, BOOL saveall, Number page_id | MTD Core calls this method once regardless of number of pages to save. "coll" parameter is an interface provided by Core which allows plug-in to retrieve pages from Core storage. "saveall" = true - save all pages into destination; otherwise plug-in must use page_id to retrieve particular page. "page_id" is current page number for save if saveall is false. |
End | None | MTD Core call this member on end of saving to let plug-in free used resources and update its state. |
CheckSettings | Number | Call this method with parameter = 0 after a series of ValueNoCheck done to perform values (mutual) check and update plug-in UI state. Other values of parameter is for plug-ins which deals with printers. If some plug-in will not need this information, it may ignore calls with values other than 0 and return immediately. If parameter = 1 - default printer changed. Plug-in may just update visual representation of its printer list. If parameter = 2 - some printer added/removed. Plug-in must reload printer list and update all settings. |
InitSettings | no parameterts; returns nothing | Core calls this method when there is no configuration for current printer loaded. Plug-in must update its internal settings and UI. |
Method | Parameters | Description |
OnChangeParam | String plugin, String param, VARIANT val | When some plug-in parameter has changed via user interface, plug-in informs about that with OnChangeParam event. "plugin" is internal name of plug-in, "param" is a name of changed parameter, "val" is a new value of parameter. |
OnError | String plugin, String error_message | When some error happens during saving the text, plug-in should raise OnError event. |
OnProgress | String plugin, Number value | Plug-in should raise this event periodically during saving process. Value is the value of progress indicator (0 - 100). |
Property | Type | Description |
Count | Number | (Read Only) Number of pages in document. |
Unicode | Number | (Read Only) Returns TRUE if the current codepage is Unicode and Unicode prefix option is ON. Plug-ins should use this property before saving all the pages, i.e. should send Unicode prefix (0xfeff) into its output stream before all other content. |
JobSize | Number | (Read Only) Size, in characters, of the whole print job, without taking into account conversions - line breaks, page breaks and encoding. Useful for plug-ins which will use GetItem method instead of Item, to have job size before saving will take place (to allocate buffer, etc). |
Method | Parameters | Description |
Item | Number index; returns VARIANT | With this method, plug-in receives page content identified by "index". Methods makes all necessary processing with page (end-of-line conversion, translation into needed codepage and page breaks insertion) and provides a result as a VARIANT containing one-dimension SAFEARRAY of bytes. |
GetItem | Number index; returns String | In some cases, plug-in does not need to have processed result. In this case, it should call GetItem method to get just Unicode string of rendered page. Examples of such plug-ins are Clipboard and Printer. |
ItemSize | Number index; returns Number | Some plug-ins need to know page size before sending actual content to destination because transport protocol requires size to be indicated before body; for example, HTTP plug-in. This method returns size of particular page in bytes, taking into account all necessary transformations. |
TranslateString | String input, Number page_id, Number translate_flag; returns Number page_flag (actually fills pointer to long) and String output (out, retval) value | Translates string possibly containing special tags and replaces these tags with their actual values. page_id provided by caller because several plug-ins may work with different pages simultaneously. If translate_flag is not 0, this method changes unsafe characters (which cannot be used in filenames) to underscores when replaces tags. |