Scripting and Programming Support
| |
|
Miraplacid Publisher 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 Publisher Scripting Object Creation
To create component, use following constructions
- JScript:
var obj = WScript.CreateObject("Miraplacid.Publisher");
- VBScript:
set obj = WScript.CreateObject("Miraplacid.Publisher")
- Visual Basic:
Set obj = CreateObject("Miraplacid.Publisher")
To enable early binding, you have to check
"Miraplacid Publisher Type Library" in "Project References" dialog and insert the following code:
Dim obj As Miraplacid.Publisher
Set obj = CreateObject("Miraplacid.Publisher")
Unregistered version of Miraplacid Publisher 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.
Object Miraplacid.Publisher Reference
Property |
Type |
Description |
Value |
VARIANT (String Name) |
(Read / Write) All the Miraplacid Publsher 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 |
ReadyPages |
Number |
(Read Only) Amount of pages ready to process |
JobStatus |
Number |
(Read Only) Current job status. Binary flags (ORed):
- 0 - No print jobs currently in progress.
- 1 - Started - initial state just after StartJob event from driver.
- 2 - Opened for rendering. This may happen just after the job will be created, if not other jobs are in Publisher queue,
- 4 - Printed - printer driver completed all operations with current job. After that, the job may still not be available for save,
it must be Opened and Rendered first.
- 8 - Rendered - ready for save. All the job contents are processed by selected rendering plug-in.
- 16 - MixedOrientation - a bit flag. Set by Core pre-processor if the job contains pages with different page orientations or dimensions.
This flag prohibits saving multipage documents in some graphics formats.
|
TotalJobs |
Number |
(Read Only) Number of printed documents spooled in Publisher and waiting for processing |
AutoSend |
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) Selected Format Plug-in name |
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 (BMP, JPG and so on) |
Transport |
String |
(Read / Write) Selected Transport Plug-in names. If more than one transport plug-in selected, names shall be comma delimited. |
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 Publisher collection. |
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. |
Method |
Parameters |
Description |
SendPage |
Number |
Send a particular page as an image through selected Transport Plug-Ins. Returns immediately. |
SendPageWait |
Number |
Send a particular page as an image through selected Transport Plug-Ins. Waits until all pages will be saved. |
SendAll |
None |
Send All through selected Transport Plug-Ins. Returns immediately. |
SendAllWait |
None |
Send All through selected Transport Plug-Ins. Waits until page will be saved. |
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 Publisher's internal print queue and spooler queue associated with Publisher |
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 |
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.
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 saved.
If EMF image dimensions from external file are different from those used in other pages in print job, multipage saving will not work.
To set page back to original content from print job spool file, set filename to empty string or NULL value.
Special tags supported.
|
Stop |
None |
Unloads plug-ins, get ready for unloading from memory.
System will unload Miraplacid Publisher 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.
|
Miraplacid Publisher Properties Reference
All these properties accessible via default "Value" property:
obj.Value("ScaleWidth") = 1024
or just
obj("ScaleWidth") = 1024
Property |
Type |
Description |
ScaleWidth |
Number |
scale size |
ScaleHeight |
Number |
scale size |
ScaleMode |
Number |
scaling algorithm: 0 - no scaling (default), 1 - Fast, 2 - Bilinear, 3 - Bicubic |
ScalePercent |
Number |
0 - scale size in pixels (default), 1 - scale size in percents |
ScaleConstrain |
Number |
1 - constrain scaling proportions, 0 - not (default) |
BorderWidth |
Number |
leave that many pixels space left and right from the detected area (auto-detect mode only) |
BorderHeight |
Number |
leave that many pixels space top and bottom from the detected area (auto-detect mode only) |
BorderType |
Number |
0 - No (default), 1 - Auto-detect, 2 - Manual |
BorderLeft |
Number |
in Manual Mode - set left border for clipping |
BorderRight |
Number |
in Manual Mode - set right border for clipping |
BorderTop |
Number |
in Manual Mode - set top border for clipping |
BorderBottom |
Number |
in Manual Mode - set bottom border for clipping |
FlipH |
Number |
1 - flip image vertical, 0 - not (default) |
FlipV |
Number |
1 - flip image horizontal, 0 - not (default) |
Gamma |
Number |
gamma (0 .. 511, 255 is default) |
Saturation |
Number |
saturation (0 .. 511, 255 is default) |
Value |
Number |
value (0 .. 511, 255 is default) |
Hue |
Number |
hue (0 .. 359, 179 is default) |
GrayScale |
Number |
0 - color (default), 1 - force grayscale |
Invert |
Number |
1 - invert image colors, 0 - not (default) |
MultiPage |
Number |
1 - generate one multipage image of document, 0 - one image per page (default) |
BackgroundImage |
String |
Name of file which will be used as a background image |
Miraplacid Publisher Output Format (Format plug-ins) parameters
To query or modify Format plug-in parameters, use FormatParam property of Miraplacid Publisher object.
obj.FormatParam("GIF","palette")=64
Bitmap |
Property |
Type |
Description |
output |
Number |
Output Format. 0 = 32-bit, 1 = 24-bit, 2 = 16-bit, 3 = 8-bit, 4 = 4-bit, 5 = 1-bit.
|
diffusion |
Number |
0 = turn off errors diffusion algorithm, 1 = turn on
|
palette |
Number |
0 = use default palette, 1 = use custom palette
|
GIF |
Property |
Type |
Description |
palette |
Number |
Number of colors in resulting GIF file.
|
delay |
Number |
Delay in milliseconds between frames in multipage (animated) GIF.
|
loops |
Number |
Number of repetitions of frame loop in multipage (animated) GIF.
|
diffusion |
Number |
0 = turn off errors diffusion algorithm, 1 = turn on
|
JPG |
Property |
Type |
Description |
output |
Number |
Output image quality. 0 = 100% quality, 1 = 95% quality and so on up to 10%.
18 = 10% quality.
|
PDF |
Property |
Type |
Description |
output |
Number |
Output Format. 0 = 100% quality, 1 = 95% quality and so on up to 10%.
18 = 10% quality.
|
title |
String |
PDF document Title
|
creator |
String |
PDF document Creator
|
author |
String |
PDF document Author
|
PNG |
Property |
Type |
Description |
output |
Number |
Output Format. 0 = 24-bit, 1 = 8-bit, 2 = 4-bit, 3 = 1-bit.
|
compression |
Number |
0 = No Compression. 1 = Default Compression. 2 = Fast Compression. 3 = Best Compression (recommended)
|
diffusion |
Number |
0 = turn off errors diffusion algorithm, 1 = turn on
|
palette |
Number |
0 = use default palette, 1 = use custom palette
|
TGA |
Property |
Type |
Description |
output |
Number |
Output Format. 0 = 32-bit, 1 = 24-bit, 2 = 16-bit, 3 = 8-bit.
|
diffusion |
Number |
0 = turn off errors diffusion algorithm, 1 = turn on
|
palette |
Number |
0 = use default palette, 1 = use custom palette
|
TIFF |
Property |
Type |
Description |
output |
Number |
Output Format. 0 = 32-bit CMYK, 1 = 24-bit, 2 = 8-bit, 3 = 4-bit, 4 = 1-bit.
|
compression |
Number |
0 = No Compression. 1 = Packbits (RLE), 2 = LZW, 3 = CCITT Group 3, 4 = CCITT Group 4.
2 and 4 work only for 1-bit mode.
|
diffusion |
Number |
0 = turn off errors diffusion algorithm, 1 = turn on
|
palette |
Number |
0 = use default palette, 1 = use custom palette
|
Miraplacid Publisher Send To (Transport plug-ins) parameters
To query or modify Transport plug-in parameters, use TransportParam property of Miraplacid Publisher object.
obj.TransportParam("File","filename")="image_{{PAGE}}"
File |
Property |
Type |
Description |
path |
String |
Destination File Path. Special tags supported.
|
filename |
String |
Destination File Name. Special tags supported.
|
open |
Number |
Opens result image file with post-processor.
|
everypage |
Number |
0 = call post-processor once per document. 1 = call post-processor for each saved image.
Ignored if open=0.
|
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.
Ignored if open=0.
|
unilist |
Number |
Set it to 1 if you wish to get list file content in Unicode.
Ignored if open=0 or everypage = 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.
|
Mail |
Property |
Type |
Description |
mail |
String |
Semicolon-separated list of email addresses.
|
message |
String |
Email message body. Special tags supported.
|
subject |
String |
Email message subject. Special tags supported.
|
filename |
String |
Name of attachment file. Special tags supported.
|
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.
|
margins |
Number |
1 - use printer margins, 0 - not.
|
fit |
Number |
0 = Print page as-is. 1 - Fit image to printer page.
|
scale |
Number |
scale factor, in percents, for additonally adjust fit to page feature.
Ignored if fit=0.
|
Miraplacid Publisher Post-Processing System
You can setup Miraplacid Publisher to launch an
application to handle the results of image generation process.
Select Send To: File, check "Open with" checkbox and specify post-processor application.
If you check Every page checkbox below, the application will be called for
every generated page with a full filename of the generated image as argument.
If Every page checkbox is unchecked, Miraplacid Publisher will generate a special list
file containing names of files generated during the print job, one filename per line. On a print job
completion, post-processor will be called with a name of the list file in a command line.
For example, you can execute img2wp.exe, web presentation generator, using the following settings:
Open With: "c:\Program Files\Miraplacid\Publisher\PostProcessors\img2wp.exe"
Parameters: "c:\Program Files\Miraplacid\Publisher\PostProcessors\template.shtmll"
"Every Page" unchecked.
Quotation marks are necessary when file name or path contains space characters.
Or, you can set up a viewer to open result images for every printed page:
...\some_viewer_application.exe
"Every Page" checked
Notice that applications and files you use in post-processing should be specified with
full path.
Web Presentation Generator
Web Presentation Generator, img2wp.exe, is a post-processor. It is designed to be called after
print job completion.
It generates HTML files with navigation bars containing images, one page per image.
For HTML files generation process utilizes template file with following optional
pseudo-variables (placeholders):
- %PREV% - link to the previous page of the presentation
- %NEXT% - link to the next page of the presentation
- %NAVIGATION% - navigation bar with links to all the presentation pages
- %IMAGE% - placeholder to the image on the page
You can build your own templates for your web presentations and use them instead of default template.html.
Web Presentation Generator installed in PostProcessors folder together with default template,
template.html.
See also:
|
|