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 Publisher 2008: Scripting Manual

 

Scripting and Programming Support with Miraplacid Publisher


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.
Printers String Collection (Read Only) List of all printers in Publisher collection.
Printer String (Read / Write) Name of the currently selected printer
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 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.
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.
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.
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
TotalJobs Number (Read Only) Number of printed documents spooled in Publisher and waiting for processing
JobStatus Number (Read Only) Current job status. Binary flags (ORed):
  • 0 - Created, initial state just after StartJob event from driver.
  • 1 - Opened for processing. This may happen just after the job will be created, if not other jobs are in Publisher queue, or after it will be printed, when current job will be saved and cancelled.
  • 2 - Started - configuration loaded, document name set, StartJob event set to UI, set after the job is opened.
  • 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, Started and Ready first.
  • 8 - Ready - ready for save. All the job contents are pre-processed.
  • 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.
AutoSend Number (Read / Write) 0 - interactive mode; 1 - Process and Auto-send to the specified destinations
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.
MainPrinter String (Read Only) Name of the default Publisher printer. By default, its name is equal to Driver name
Method Parameters Description
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
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.
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.
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 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
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.
LoadUI None Loads user interface component if it is not already loaded.
UnloadUI None Unloads user interface component, if it supports OnUnload event.

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)

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.
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.
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.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:

Copyright © 2001 - 2024 by Miraplacid.  Legal Notices