Miraplacid Publisher SDK 2009: Programming
| |
|
|
Miraplacid Publisher SDK Programming Guide
Miraplacid Publisher is actually a collection of ActiveX objects which communicate with
each other trough
well-defined COM interfaces. This model allows us to keep the system highly scalabe
and extensible.
Every component could be developed independently and base on different technologies
as long as it supports COM.
All examples provided in two separate folders: "examples.vb" containing project written in VB 6.0, and "examples.net" containing projects written in C#.
There are 5 different types of software modules in Publisher:
- Driver components. These are system dll modules and settings files.
This is mandatory part of Publisher.
- Core component (mp_core.exe). This is the heart of the whole system.
It takes data from the driver,
keeps it in internal queue and manages all other components - plug-ins and UI.
- UI (mp_ui.exe). This is User Interface component. This is COM client of Core component;
it uses Core methods and receives
COM events from Core. UI interacts with Core only; it have no direct access to other components.
User Interface module is not required for Publisher Core and Driver, they can work fine without UI.
To display transport and rendering plug-ins user interfaces, UI loads its own set of plug-ins as an ActiveX components.
- Format plug-ins. Inproc dll ActiveX modules which performs conversion
from internal graphics representation into particular graphics format.
Core component manages these modules.
- Transport plug-ins. Inproc dll ActiveX modules which allows to save resulting files to some locations.
Core component manages these modules.
This manual describes only Core and UI interaction details and registration services.
Transport and Rendering plug-ins interfaces are still subject of change and will be presented in the next version os SDK.
For simple solutions like scripting support or object creation from VB, please, refer to Scripting manual.
Miraplacid Publisher Object Model
Publisher Core component consists of two COM objects (coclasses):
- coclass MP (MiraplacidSE.Publisher {C9828C82-2136-4e25-894F-399109583971}). This is the main part of Publisher.
The folowing interfaces included:
- IMP (default interface). Includes all methods and properties which control Publisher functionality, including plug-ins.
- _IMPEvents (default, source interface). This interface is collection of COM events and provided for Core and UI interoperability.
- Some other internal interfaces which are out of scope of current document. You do not have to learn them to build your system.
- coclass MP_Register (MiraplacidSE.PublisherRegistrator {235836F3-0079-4067-98B9-7F2E8FFE5876}).
This objects includes single interface IMP_Register, which manages registration and verification services.
MP_Register object will be always created and its interface will allow calling program
to verify Publisher registration status and to register Publisher.
MP object will not be created successfully if trial period is expired.
Unlimited version of SDK does not contain MP_Register coclass and object
MP will be created always.
For C++ users: Number means long and String means BSTR in this guide.
Do not forget to add get_ (read) and put_ (write) prefixes for properties.
Miraplacid Publisher IMP Object Reference
This is a main Publisher interface. Its IID is {D5FD471D-BAEC-4dfa-8C3C-CCD09050B3AA}.
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 |
ValueNoRedraw (hidden) |
VARIANT (String Name) |
(Write Only) Does the same as Value except that ValueNoRedraw does not force image re-processing after changing value.
To prevent processing overhead when you need to change several parameters at once, you may use ValueNoRedraw to set all parameters exacept the last,
and Value for last parameter to let Core re-process the page once with cumulative changes.
|
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.
|
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.
Publisher may work with several UIs and ordinary listeners. UIs, in difference of listeners, registers themselves using UILoaded.
|
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. |
PreparePage (hidden) |
Number |
UI should call this method to force Core prepare page (load, make processing according current settings) for displaying to user.
Parameter mean number of page to prepare, staring from 1. Core will return immediately and provide the page with OnPageReady event.
|
Miraplacid Publisher Properties Reference
All these properties accessible via default "Value" property:
obj.Value("scalewidth") = 1024
or just
obj("scalewidth") = 1024
In C language, this will be:
_bstr_t pname;
pname=L"scalewidth";
mp_core->put_Value(pname,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 _IMPEvents Events Reference.
This is connection point interface which UI uses to catch printing events from Core component.
Its IID is {BCDAF6C5-8CA2-4eea-A299-45F0FE0365F5}.
Event |
Parameters |
Description |
OnStartJob |
None |
Called when Core receives start job signal from driver.
|
OnPagePrinted |
Number |
Called when Core receives next job from driver with page number as a parameter.
|
OnAllPagesPrinted |
None |
Called when Core receives end job signal from driver.
|
OnPageReady |
Number page_id, String object |
Called when Core prepared a page for displaying in responce to PreparePage
method call.
Page_id is a number of prepared page.
Object parameter is a name of Windows FileMapping object which contains ready-to-display
Windows bitmap.
UI may use this object as a memory object with OpenFileMapping/MapViewOfFile API calls.
|
OnCancelJob |
None |
Called when Core finishes all activity with current job as an acknowledge
for CancelJob call from UI or after SendAll process end.
|
OnRewindJob |
None |
Called instead of OnCancelJob when SendAll finished with errors.
|
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 "process" which reflects the state of image
processing. Special value of "convert" reflects state of image conversion process (from internal representation to perticular image format).
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:
- General errors - code = 1
- If Value is wrong - code = 0x400
- Name errors: configuration, unknown transport or format selected - code = 0x600
- Range 0x100 - 0x1ff has a special meaning - these are transport plug-in errors.
Source transport plug-in may be located by its index which is equal to error_code - 0x100;
these errors may happen only during saving procedure.
|
OnSetDocName |
String |
Called when Core sets document name to let UI update its status line, etc.
|
OnChangePrinter |
String |
Called when Core receives print job for different printer or after initial configuration load. UI must re-read all the configuration from Core.
|
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:
- 0 - Default printer changed.
- 1 - Some printer added/removed, not from Publisher family and not redirect printer.
- 2 - Some printer from Publisher family added/removed.
|
Miraplacid Publisher IMP_Register Object Reference.
When evaluation period is expired, object of the main interface (IMP) will not be created
successfully.
Application should use IMP_Register interface to register Publisher.
Its IID is {90D08213-5B6D-4103-96A7-297AA8EC4DEB}.
Examples of registration utility are located at examples.vb\register and examples.net\MP_SE_Reg folders at this package.
Property |
Type |
Description |
Valid |
Number |
(Read Only) May be used to examine current evaluation state. Has the following values:
- <=0 - Internal error happened in verification code. This could be caused by corrupted .key file, wrong permissions of .key file, etc.
- 1 - Publisher is registered.
- 2 - Publisher is unregistered but trial period is not expired.
- 3 - Trial periond is expired.
|
Users |
String Collection |
(Read / Write) List of users currently allowed to print to Publisher. 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 FirtsName, String LastName, String Keycode |
Number |
This method is intended for registering Publisher. Application must provide FirstName,
LastName and Keycode generated by Miraplacid to this method.
Resulting value is 1 if registration succeeded, 0 if not.
After 3 unsuccessful registration attempts this method will always return CLASS_E_NOTLICENSED
and will not actually try to register. Application should re-create the object to continue
registering.
|
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.
|
Miraplacid Publisher UI working scheme.
You can see a live custom UI examples in examples.vb\customui and examples.net\MP_SE_UI folders of SDK package.
- UI is launched by Core when it receives a new job and AutoSend property is in false state
or by user when he clicks on Publisher icon
on Desktop or Programs folder.
- UI loads MP object and obtains IMP interface pointer.
- UI establishes a connection with Core and loads configuration (by reading properties).
After initialization steps (when it will be ready to receive events), UI must set UILoaded
property to 1 (true). This property counts active UIs, and, if UI was loaded and the last UI sets UILoaded=0, core
will save configuration automatically.
When Core launches UI, it looks for "WaitUILoaded" parameter in its registry folder (HKLM).
If WaitUILoaded = 0 (default value), Core does not wait for UI to be loaded. So, when UI will be ready to listen events, it will appear
in the middle of print job (OnStartJob + some page or whole job events may be missed).
And, even if user starts UI from Desktop, it may connect to Core with current print job already waiting for user input
(save or cancel).
To avoid this situation and get current status correctly, there are two possibilities exists:
- Get the current job status from core before subsribing to events, as did in .Net UI example. This is the most correct method.
- Use UILoadedWithEvents = 1 construction. This property will feed UI with all needed events for current job automatically, if Core has active job.
This is the most simple method, but it has one side-effect: if you use several applications listens events from Core, all them will receive
print job events missed by this UI. This is the only way for applications written in languages like VB, which creates objects and subscribes to events in one operation (Dim WithEvents).
In this case, you need to set UILoadedWithEvents right after object creation.
We recommend to use this method for UIs intended for interactive job with user.
If WaitUILoaded = 1, Core waits UI to be loaded (on StartJob) for 60 seconds maximum, then continues job processing. This method is convenient for UIs which perform job data processing
in automatic mode, without significant user intervention. UI should use any method of events subscription and UILoaded=1 and it will not miss any events from Core.
If you wish to use this mode, do not forget to set WaitUILoaded parameter to 1 in your installer.
Further steps (4 - 7) make an event-driven loop.
Core generates events in two modes: syncronous and asyncronous. To control this mode, installer may set "AsyncEvents" parameter in Publisher registry folder (HKLM).
When Core users asyncronous events mode, it sends events from separate thread and does not wait for UI to return. So, if your UI performs some
processing on events (not just mirror Core state), we recommend you to use asyncronous mode - the printing process will be faster.
Core may collect print jobs with its maximal speed, and UI will process them with its own speed.
But, please, be careful when your UI works in asyncronous mode and Core is in autosend mode. If your UI slower than Core and it makes
some actions with print job (saving particular pages/all pages, etc), these actions in autosend mode may affect
wrong print job because in autosend mode Core does not wait the job to be calcelled from UI - it saves a job automatically and get the next one from queue.
In this case, you need to ensure that Core is not in autosend mode.
- OnStartJob: On this event UI may read document name and examine print job status.
Job may already be completed (printed) if next job was printed on background before finalizing
previous one.
- OnPagePrinted: If the job was already completed, this event will not be generated. On this
event, its possible to ask for a page by calling PreparePage method.
Calling this method will force Core to start processing of the page. It makes sense to ask only
for page which is currently displayed.
- OnAllPagesPrinted: This is informational event which allows UI to update its internal state
(and interface elements like SaveAll button).
- OnPageReady: Core sends this event if UI asked for a page and it is ready for displaying. UI
may read the picture and display it. This event may be generated not only in responce to PreparePage call;
Core will fire it when it saves all job, in page-by-page or multipage mode. The order of pages may be reverse
in this case, depending from image format, so page_id parameter is important.
The following stage is interactive job with end user.
- User can change settings.
Appropriate Core properties must be set by UI. During this process, OnError event might be raised
in response to incorrect property change.
- User can change active printer, save its configuration for current user or for all users.
- User can save current page. UI shall call SendPage method.
- User may want to save all pages. UI shall call SendAllPages method.
In response to this call, Core will notify UI by raising OnCancelJob event when job is done.
On this event, UI must get ready for the next job.
If some transports fail, Core raises OnRewindJob event (but does not cancels the
job). On this event UI can rewind the job to the first page,
show some (additional) error message, etc.
- User can cancel the job. UI must call CancelJob method. In response,
Core generates OnCancelJob event.
- During saving process, Core will generate OnProgress events or OnError if some error happened.
At any time, Core may send OnAddRemovePrinter event if some printer configuration changed in the system.
Dependent from this event argument, UI should take appropriate measures - reload printer lists, configuration, etc.
Miraplacid Publisher Format plug-ins.
Format plug-ins are Publisher components intended for image conversion from internal image representation (bitmap) to particular graphics format file.
Format plug-ins are AcitveX components which implements all standard visual ActiveX component interfaces.
Additionally, it must obey the following requirements:
- It must be included into "Miraplacid Publisher Format Plug-ins" COM category (FBFE9C5A-8D40-46bd-99C1-93F162E30AE7), but not create it.
- It must implement IMP_FPLUGIN interface (69E3226F-C540-4829-9CB4-88738766C9E4) and realize _IMP_FPlugin_Events connection point dispinterface (20B34C58-2EE5-4f87-AC73-F8080DA8ABE1).
- It must not register its own type library. Ready for use type library provided in imp_fplugin.dll.
IMP_FPLUGIN interface:
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 for internal use.
|
Layout |
String |
(Read Only) This string contains a list of properties (Values) which should be saved inconfiguration or restored from it.
Format of this string is: "Bparam1,Lparam2,BParam3", where "B" and "L" are prefixes meaning type of parameter (BSTR and Long 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. "gif", "bmp".
|
SafeForMultipage |
Number |
(Read Only) Returns 1 if this plug-in is able to support multipage images with pages of different dimensions.
For example, TIFF, GIF and PDF have internal paged stucture, while other plug-ins assemble "multipage" images by glueing pages together, and
this prevents them from accepting pages with different dimensions.
Core analyses this property and prohibits saving multipage documents with this format if it does not supprt this feature.
|
Method |
Parameters |
Description |
Convert |
IImageCollection *images, String filename |
Conversion procedure. Plug-in sohuld obtain images from images, convert it to appropriate format and save to filename.
|
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.
|
_IMP_FPlugin_Events interface:
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.
|
OnProgress |
String plugin, long value |
During conversion process, plug-in may fire this event to provide information about the progress of image conversion.
|
IImageCollection Core interface:
Property |
Type |
Description |
Count |
Number |
(Read Only) Number of images in image set.
|
Method |
Parameters |
Description |
Item |
Number index; returns String |
With this method, plug-in receives page content identified by "index".
Method returns name of system filemapping object containing image for conversion.
|
Format plug-in working scheme
- UI starts and loads plug-ins. It subscribes to _IMP_FPlugin_Events events interface.
- UI gets Layout property. According to Layout parameters, it reads appropriate FormatParam properties from Core and sets
as a Values of plug-in (using ValueNoCheck property and calls CheckSettings).
- Core creates plug-ins too and subscribes to their events (to get OnProgress event).
- Core gets Layout property. According to Layout parameters, it reads saved values from configuration (registry) and sets
as Values of plug-in (using ValueNoCheck property and calls CheckSettings). If configuration for current printer does not exist, Core calls InitSettings.
Remark: UI and Core may start each other, but the final situation does not change: Core reads settings and sets plug-in properties first, then
UI reads these properties and sets them to its "own" plug-ins.
There are two sets of plug-ins exists in the scheme, because UI and Core are separate processes.
Interactive job cycle:
- User changes settings of plug-in. Plug-in updates its internal state and raises OnChangeParam to UI.
- In responce, UI sets appropriate Core property with FormatParam. In result, all parameters are in sync.
Rendering job cycle. Job of rendering plug-in is page-oriented.
- When Core needs to convert (and save) current page or all pages in a single miltipage file, it calls Convert method.
- Plug-in calls Count property of IImageCollection imterface provided as paramter. If count = 1, plug-in calls Item method and get a name of filemapping obect.
Then, it just converts an image containing in this object to appropriate image fomat and saves it to file.
Format of filemapping image is bitmap (BimapInfoHeader + bitmap bits, in 24-bit format).
- If count > 1, that means plug-in need to save several images to a single multipage file. Formats which support multipage images (TIFF, animated GIF) may use these possibilities;
other formats should just make one lenghty contiuous image file.
Miraplacid Publisher Transport plug-ins.
Transport plug-ins are Publisher components intended for saving converted images to some destination (file, URL) using some transport protocol (file, FTP, HTTP).
Transport plug-ins are AcitveX components which implements all standard visual ActiveX component interfaces.
Additionally, it must obey the following requirements:
- It must be included into "Miraplacid Publisher Transport Plug-ins" COM category (92D23852-D793-4251-83C2-9D577A779DFB), but not create it.
- It must implement IMP_TPLUGIN interface (A24B0942-EDCC-47c5-AF3C-82A6A2E4FD11) and realize _IMP_TPlugin_Events connection point dispinterface (DD69A786-C884-410a-B27B-DECA265042C9).
- It must not register its own type library. Ready for use type library provided in imp_tplugin.dll.
- Default write-only properies docname and extension may be used in transport plug-in to capture this setting from UI.
IMP_TPLUGIN interface:
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 inconfiguration or restored from it.
Format of this string is: "Bparam1,Lparam2,BParam3", where "B" and "L" are prefixes meaning type of parameter (BSTR and Long accordingly). Parameter names should be separated by commas. Spaces are not allowed.
|
UsesRawImage |
Number |
(Read Only) Plug-in should return 1 if it does not need to convert image to particular format; it uses internal representation (bitmap) directly.
Example of such a plug-in could be printer plug-in which prints bitmap to a printer and does not need converted image.
|
Method |
Parameters |
Description |
Start |
None |
Publisher Core call this member when it begins saving text page(s). Plug-in may update its internal state and prepare resources.
|
Process |
ITransportHelper object |
Publisher Core calls this method when it needs to send converted file to selected location.
"object" parameter is an interface provided by Core which allows plug-in to retrieve input file name needed for save and translate strings.
|
End |
None |
Publisher 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.
|
_IMP_TPlugin_Events interface:
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, Number error_code, String error_message |
When some error happens during saving the text, plug-in should raise OnError event.
"error_code" provided mainly for debugging purposes, to watch this value in Publisher log file; "error_message" is what user will see as an error description.
|
OnProgress |
String plugin, Number value |
Plug-in should raise this event periodically during saving process.
Value is the value of progress indicator (0 - 100).
|
ITransportHelper Core interface:
Property |
Type |
Description |
Source |
String |
(Read Only) Name of the source object to save.
For raw plug-ins (UsesRawImage == 1) this will be a name of file mapping object; for other plug-ins this is a name of graphics file.
|
Method |
Parameters |
Description |
TranslateString |
String input; Number translate_flag; returns String output |
Translates string possibly containing special tags and replaces these tags with their actual values.
If translate_flag is not 0, this method changes unsafe characters (which cannot be used in filenames) to underscores when replaces tags.
|
Transport plug-in working scheme
- UI starts and loads plug-ins. It subscribes to _IMP_TPlugin_Events events interface.
- UI gets Layout property. According to Layout parameters, it reads appropriate TransportParam properties from Core and sets
as a Values of plug-in (using ValueNoCheck property and calls CheckSettings).
- Core creates plug-ins and subscribes to events. UI listens OnParamChange event; Core listens other events: OnError and OnProgress.
- Core gets Layout property. According to Layout parameters, it reads saved values from configuration (registry) and sets
as Values of plug-in (using ValueNoCheck property and calls CheckSettings). If configuration for current printer does not exist, Core calls InitSettings.
Remark: UI and Core may start each other, but the final situation does not change: Core reads settings and sets plug-in properties first, then
UI reads these properties and sets them to its "own" plug-ins.
There are two sets of plug-ins exists in the scheme, because UI and Core are separate processes.
Interactive job cycle:
- User changes settings of plug-in. Plug-in updates its internal state and raises OnChangeParam to UI.
- In responce, UI sets appropriate Core property with TrandportParam. In result, all parameters are in sync.
Saving job cycle.
- In response to Save or SaveAll method call, Core initiates saving procedure. Several plug-ins may work at the same time.
Care calls Start method of each plug-in.
- After that, it calls Process method with appropriate parameters. During this call, plug-ins may call TranslateString method provided by Core.
- Finally, Core calls End method.
See also:
|
|
|