Scripting and Programming Support with Miraplacid Publisher
Contents
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 m As MP
Set m = New MP
Miraplacid Publisher loads Default configuration on start.
So, when scripting, you may set up only needed values.
Miraplacid Publisher Object 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.
|
Configurations |
String Collection |
(Read Only) List of all saved profiles, including "Defualt". |
Configuration |
String |
(Read / Write) Name of the currently selected profile |
FormatPluginNames |
String Collection |
(Read Only) List of installed format plug-ins (BMP, JPG and so on) |
Format |
String |
(Read / Write) Selected Format Plug-in name |
FormatParam |
VARIANT (String ParameterName) |
(Read / Write) Format 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) |
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.
|
DocumentName |
String |
(Read Only) Original name of the printed document |
ReadyPages |
Number |
(Read Only) Amount of pages ready to process |
TotalPages |
Number |
(Read Only) total estimated amount of pages in current print job |
JobStatus |
Number |
(Read Only) 0 - Created, 0001b - Opened, 0010b - Printed, 0100b - RequestedPagePrepared, 1000b - Aborted |
AutoSend |
Number |
(Read / Write) 0 - interactive mode; 1 - Process and Auto-send to the specified destinations |
PrinterName |
String |
(Read Only) Name of Miraplacid Publisher printer to use for switching to Publisher in scripts |
Method |
Parameters |
Description |
CancelJob |
None |
Cancel current Print Job |
CancelAllJobs |
None |
Cancel Publisher's internal print queue and spooler queue associated with Publisher |
SendAll |
None |
Send All through selected Transport Plug-Ins |
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. |
SaveConfiguration |
String |
Save Current Configuration under specified name |
DeleteConfiguration |
String |
Delete Configuration with specified name |
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 |
scalepercent |
Number |
0 - scale size in pixels, 1 - scale size in percents |
scaleconstrain |
Number |
1 - constrain scaling proportions, 0 - not |
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, 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 |
flip image vertical |
flipv |
Number |
flip image horizontal |
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, 1 - force grayscale |
invert |
Number |
invert image colors |
originalname |
Number |
do not replace {{PAGE}} with page number for the first page |
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("multipage")=0
BMP |
Property |
Type |
Description |
multipage |
Number |
0 = regular mode. 1 = multipage mode
(All the pages will be glued into a single enormous image.)
|
output |
Number |
Output Format. 0 = Color (RGB) 24 bit per pixel. 1 = Grayscale 8 bit per pixel.
|
JPG |
Property |
Type |
Description |
multipage |
Number |
0 = regular mode. 1 = multipage mode
(All the pages will be glued into a single enormous image.)
|
quality |
Number |
Output Format. 0 = 100% quality, 1 = 95% quality and so on.
18 = 10% quality.
|
PDF |
Property |
Type |
Description |
multipage |
Number |
0 = single PDF per page. 1 = multipage PDF (recommended)
|
quality |
Number |
(Read / Write) Output Format. 0 = 100% quality, 1 = 95% quality and so on.
18 = 10% quality.
|
title |
String |
PDF document Title
|
creator |
String |
PDF document Creator
|
author |
String |
PDF document Author
|
PNG |
Property |
Type |
Description |
multipage |
Number |
0 = regular mode. 1 = multipage mode
(All the pages will be glued into a single enormous image.)
|
output |
Number |
Output Format. 0 = Color (RGB) 24 bit per pixel. 1 = Grayscale 8 bit per pixel.
|
compression |
Number |
0 = No Compression. 1 = Default Compression. 2 = Fast Compression. 3 = Best Compression (recommended)
|
TGA |
Property |
Type |
Description |
multipage |
Number |
0 = regular mode. 1 = multipage mode
(All the pages will be glued into a single enormous image.)
|
output |
Number |
Output Format. 0 = Color (ARGB) 32 bit per pixel.
1 = Color (RGB) 24 bit per pixel.
2 = Color (RGB) 16 bit per pixel.
3 = Grayscale 8 bit per pixel.
|
TIFF |
Property |
Type |
Description |
multipage |
Number |
0 = regular mode, single TIFF file per page. 1 = multipage mode (multi-page TIFF will be created)
|
output |
Number |
Output Format.
0 = CCITT Group 4 fax encoding.
1 = CCITT Group 3 fax encoding
2 = CCITT Group 3 (Modified Huffman)
3 = 24 bit RGB (no compression)
4 = 24 bit RGB (packbits)
5 = Grayscale (no compression)
6 = Grayscale
7 = Black/White (no compression)
8 = Black/White
|
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. {{PAGE}}, {{JOB}}, {{IDENTITY}}, {{DATE}}, {{TIME}} supported.
|
filename |
String |
Destination File Name. {{PAGE}}, {{JOB}}, {{IDENTITY}}, {{DATE}}, {{TIME}} supported.
|
setfilename |
Number |
Set it to 1 if you wish to specify filename. Set it to 0 if you Miraplacid Publisher to use original
document name as a file name.
|
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.
Ignored if open=0.
|
param |
String |
additional parameters for post-processor.
Ignored if open=0.
|
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.
|
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.
|
Printer |
Property |
Type |
Description |
printer |
Number |
Printer number. Depends on printers installed in your system.
Please start Miraplacid Publisher and check Printer drop-down for Send To: Printer.
Default printer will have index 0, others will have further numbers, as shown in drop-down box.
|
fit |
Number |
0 = Print page as-is. 1 - Fit image to printer page.
|
Examples Download
Download sample scripts (mpscripts.zip)
Miraplacid Publisher Post-Processing System
You can setup Miraplacid Publisher 5.2 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.html"
"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:
|