Miraplacid Home Contact UsStoreDownloadsMiraplacid NewsMiraplacid ForumSearch at Miraplacid.com
Miraplacid Publisher (Image Printer Driver)Miraplacid Text Driver (Text Printer Driver)Miraplacid Data ViewerMiraplacid Form
Bookmark this pageMiraplacid PublisherMiraplacid Text DriverMiraplacid Data Viewer / Binary DOMMiraplacid Company

Miraplacid Text Driver 2007: Scripting Manual

 

Scripting and Programming Support with Miraplacid Text Driver


Miraplacid Text Driver registers itself as an ActiveX object and could be used from any scripting and OLE-compliant software.
Using this ability, you can control the printing process directly from your script or application.

Miraplacid Text Driver Scripting Object Creation

To create component, use following constructions
  • JScript: var obj = WScript.CreateObject("Miraplacid.TextDriver");
  • VBScript: set obj = WScript.CreateObject("Miraplacid.TextDriver")
  • Visual Basic: Set obj = CreateObject("Miraplacid.TextDriver")
    To enable early binding, you have to check "Miraplacid Text Driver Type Library" in "Project References" dialog and insert the following code:
    Dim obj As Miraplacid.TextDriver
    Set obj = CreateObject("Miraplacid.TextDriver")
where myscript.vbs is your script name (see sample scripts below)

Unregistered version of Miraplacid Text Driver will not show registration dialog until trial period expiration if used in autosave mode. After that, object creation will fail with appropriate message in errorinfo.

Appendix A: Object Miraplacid.TextDriver


Property Type Description
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.
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.
TransportPluginNames String Collection (Read Only) List of installed transport plug-ins (File, FTP and so on)
Charset Number (Read / Write) 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 (Read / Write) End Of Line style
0 means "Windows" EOL style (\r\n or 0x0D, 0x0A)
1 means "UNIX" EOL style (\n or 0x0A)
AutoSave Number (Read / Write) 0 - interactive mode; 1 - Process and Auto-send to the specified destinations
PageBreak Number (Read / Write) 1 - insert page break symbols (0xc) between pages; 0 - don't.
Pages String Collection (Read only) Collection of text pages extracted
TotalPages Number (Read Only) Total estimated amount of pages in current print job
DocumentName String (Read Only) Original name of the printed document
JobStatus Number (Read Only) 0 - Created, 0001b - Opened, 0010b - Printed, 0100b - RequestedPagePrepared, 1000b - Aborted
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.
UnicodePrefix Number (Read / Write) 1 - insert Unicode prefix (0xfeff) before Unicode content; 0 - don't.
Method Parameters Description
UpdatePage Number n, String s Replace contents of nth page by s.
CancelJob None Cancel current Print Job
CancelAllJobs None Cancel all jobs for this printer
SaveConfiguration String Save Current Configuration under specified name
SaveAllPages None Send All through selected Transport Plug-Ins
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.

Miraplacid Text Driver Send To (Transport plug-ins) parameters


To query or modify Transport plug-in parameters, use TransportParam property of Miraplacid Text Driver object.
obj.TransportParam("File","filename")="textout_{{PAGE}}.txt"

File
Property Type Description
path String Destination File Path. {{PAGE}}, {{JOB}}, {{IDENTITY}}, {{DATE}}, {{TIME}} supported.
filename String Destination File Name. {{PAGE}}, {{JOB}}, {{IDENTITY}}, {{DATE}}, {{TIME}} 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. Ignored if open=0.
param String additional parameters for post-processor. Ignored if open=0.
setfilename Number Set it to 0 if you wish to specify filename. Set it to 1 if you Miraplacid Text Driver to use original document name as a file name. 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.
FTP
Property Type Description
url String Destination FTP directory URL.
file String Destination File Name. {{PAGE}}, {{JOB}}, {{IDENTITY}}, {{DATE}}, {{TIME}} supported.
passive Number 0 = FTP passive mode OFF. 1 = FTP passive mode ON.
user String FTP server username.
password String FTP server password.
setfilename Number Set it to 0 if you wish to specify filename. Set it to 1 if you Miraplacid Text Driver to use original document name as a file name. Ignored if open=0.
HTTP
Property Type Description
url String Destination HTTP URL.
file String Destination File Name.
put Number 0 = use POST method. 1 = use PUT method.
user String username.
password String password.
setfilename Number Set it to 0 if you wish to specify filename. Set it to 1 if you Miraplacid Text Driver to use original document name as a file name. Ignored if open=0.
Printer
Property Type Description
printer String Printer name. Can be a real printer name or "Default" string which means default printer.
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.
Mail
Property Type Description
mail String A set of email addresses of mail recipients, separated by semicolon.
subject String Email subject.
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.
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. Ignored if open=0.
param String additional parameters for post-processor. Ignored if open=0.

Miraplacid Text Driver Formatting Style (Rendering plug-ins) parameters


To query or modify Format plug-in parameters, use FormatParam property of Miraplacid Text Driver object.
obj.FormatParam("TWL","margins")=1

Plain Text
Property Type Description
delim String Delimiter which will be used to separate text boxes during rendering.
Formatted Text, Text with Layout
Property Type Description
margins Number 1 - use printer margins in text rendering (at top and left side); 0 - don't.
XML
Property Type Description
optimize Number 1 - merge textboxes into whole words; 0 - don't.
RSS
Property Type Description
link String Link attribute of RSS channel (document).
description String Description attribute of RSS channel (document).
br Number 1 - add <BR> tag to the end of description lines; 0 - don't.

Appendix B: Sample script on JScript


word = WScript.CreateObject("Word.Application");
word.Visible=1;
word.Documents.Open("c:\\test.doc");
word.Documents("c:\\test.doc").Activate();

word.ActivePrinter="Miraplacid Text Driver";
prn = WScript.CreateObject("Miraplacid.TextDriver");
prn.AutoSave=1;  	// Turn AutoSave ON

prn.Transport="FTP,HTTP,File";
prn.TransportParam("FTP","url")="ftp://main";
prn.TransportParam("FTP","file")="Page_{{PAGE}}";
prn.TransportParam("FTP","user")="Name";
prn.TransportParam("FTP","password")="password";
prn.TransportParam("HTTP","url")="http://site.com/puts";
prn.TransportParam("HTTP","file")="Page_{{PAGE}}";
prn.TransportParam("HTTP","user")="Name";
prn.TransportParam("HTTP","password")="password";
prn.TransportParam("HTTP","put")=1;
prn.TransportParam("File","setfilename")=0;
prn.TransportParam("File","append")=1;	   // Set append method
prn.TransportParam("File","path")="c:\\doc_{{DATE}}";
prn.TransportParam("File","filename")="Page_{{PAGE}}";

// Print Word document:
word.ActiveDocument.PrintOut();

while (0 == (prn.JobStatus & 4)) {
	WScript.Echo("Waiting for Start... "+prn.JobStatus); 
	WScript.Sleep(500);
}

while (0 != (prn.JobStatus & 4)) {
	WScript.Echo("Waiting for End... "+prn.JobStatus);
	WScript.Sleep(500);
}

WScript.Echo("Done");

word.Documents("c:\\test.doc").Close();
word.Quit();

Appendix C: PostProcessing:


You can setup Miraplacid Text Driver to launch an application to handle the results of text generation process.
Select Send To: File, check "Open with" checkbox and specify post-processor application.
For example, you can execute notepad.exe,using the following settings:


path: "c:\"
filename: "textout.txt"
Open With: "notepad.exe"
Parameters: ""


Quotation marks are necessary when file name or path contains space characters.
Or, you can set up a viewer to open result text file for every printed page.You must add tag {{PAGE}} in filename textbox.

path: "c:\"
filename: "textout{{PAGE}}.txt"
Open With: "notepad.exe"
Parameters: ""


Notice that applications and files you use in post-processing should be specified with full path.

See also:

Copyright © 2001 - 2024 by Miraplacid.  Legal Notices