Server Object

The Server object allows you to convert documents to Flash and provides
access to various default conversion options.
Remarks
The Server object is a core object of Print2Flash OLE Automation API. For
almost all tasks related to Print2Flash Server functionality you need to create
and use this object. Its primary responsibilities are:
- Conversion of documents residing in files and folders to Flash;
- Providing access to default printing profile, default printing preferences,
default batch processing options and skins;
- Providing statistic and error information on performed conversions.
Object access
To access Server object you need to create it using "Print2Flash3.Server" ProgID such as in the
following example:
set P2F=CreateObject("Print2Flash3.Server")
|
Then you can access its properties and methods using the reference to the
created Server object.
Properties
| Name |
Type |
Read-only |
Description |
| ConvertedPages |
Integer |
Yes |
Returns the number of pages
actually present in the last converted Flash document. This value may differ
from TotalPages property
value if you use PageRange property of
BatchProcessingOptions
object. |
|
DefaultBatchProcessingOptions |
BatchProcessingOptions object |
Yes |
Returns
BatchProcessingOptions
object used for document conversion by default. You can change the returned
object properties to modify default batch processing options for subsequent
document conversions. |
|
DefaultPrintingPreferences |
PrintingPreferences object |
Yes |
Returns
PrintingPreferences
object used for document conversion by default. You can change the returned
object properties to modify default printing preferences for subsequent
document conversions. |
| DefaultProfile |
Profile object |
Yes |
Returns
Profile object used for
document conversion by default. You can change the returned object
properties to modify default document options for subsequent document
conversions. |
| DirsScanned |
Integer |
Yes |
Returns the number of
subdirectories scanned at the last document conversion. |
| ErrorCount |
Integer |
Yes |
Returns the number of errors
occurred at the last document conversion. The error code and message can be
retrieved either from conversion log or, in case of single document
conversion with ConvertFile method, - from exception returned from that
method. |
| FilesConverted |
Integer |
Yes |
Returns the number of files
converted at the last document conversion. |
| FlashFileCount |
Integer |
Yes |
Returns the number of Flash
files generated at the last document conversion. |
| MetadataFileCount |
Integer |
Yes |
Returns the number of
metadata files generated at the last document
conversion. |
| Skins |
SkinCollection object |
Yes |
Returns
the collection of skins defined on this server. |
| SkippedPages |
Integer |
Yes |
Returns the number of pages
skipped at the last document conversion. In rare cases document contents can
be complex enough to fit into all requested pages into a single Flash file
(due to Flash file format limitations) so a number of trailing pages can be
truncated from it. If this happens, this property is set to the number of
such trailing pages. In such a case you may need to split the original
document in several parts and convert each part separately using, for
example, PageRange property of
BatchProcessingOptions
object. |
| ThumbnailFileCount |
Integer |
Yes |
Returns the number of thumbnail
files generated at the last document conversion. Thumbnail files generation
is controlled by the ThumbnailPageRange property of
Profile object. |
|
TotalPages |
Integer |
Yes |
Returns the total number of
pages in the last converted original document. |
| Version |
String |
Yes |
Returns Print2Flash Server
version |
Methods
CancelJob
Method cancels the current printing job.
Signature
CancelJob()
Remarks
This method reverts the Print2Flash Printer to normal mode of operation
without capturing print jobs. It is safe to call this method even if StartJob
method was not called before so you may call this method for safety in order
to be sure that printer is in normal non-capturing operation mode. See
Printing Jobs help topic for more information on
printing jobs.
ConvertDir
Method converts all specified files in a directory to Flash.
Signature
ConvertDir (SourceDirName, [SourceFileMask], [OutputDirName], [IncludeSubDirs], [Profile], [BatchProcessingOptions],
[PrintingPreferences])
Arguments
| Name |
Type |
Description |
| SourceDirName |
String |
The full path and name of the
directory where all the document to convert reside |
| SourceFileMask |
String |
The mask for the files to
convert, e.g. "*.doc". If this argument is not specified, all files are
attempted to convert |
| OutputDirName |
String |
The full path and name of the
output directory to which resulting Flash files are written. If this parameter is omitted, the
Flash files are written to the same directory as SourceDirName. |
| IncludeSubDirs |
Boolean |
Boolean indicator specifying
whether to look for files to convert in all subdirectories of the
SourceDirName directory in addition to the files located directly in
SourceDirName directory. The default is false. |
| Profile |
Profile object |
Profile object with document
options to use for conversion. If omitted, options from
DefaultProfile
property are used |
| BatchProcessingOptions |
BatchProcessingOptions object |
BatchProcessingOptions object
with batch processing options to use for conversion. If omitted, options
from DefaultBatchProcessingOptions property are used |
| PrintingPreferences |
PrintingPreferences object |
PrintingPreferences
object with printing preferences to use for conversion. If omitted,
preferences from DefaultPrintingPreferences property are used |
Remarks
At minimum you should provide only the SourceDirName argument. All other
arguments are optional.
The method tries to convert all files satisfying the SourceFileMask and
residing in SourceDirName directory. If IncludeSubDirs argument is set true,
the files in all subdirectories of the SourceDirName directory with any nesting
level are attempted to convert as well. The output Flash files are named
after the original document with .swf extension appended to the original
document name.
Examples
The following example converts all documents in a directory named C:\Docs to Flash
and stores the converted files in the same directory. Documents in
subdirectories are not converted:
This example is similar to the above except that it converts only .doc files:
P2F.ConvertDir "C:\Docs", "*.doc"
|
The next example is similar to the first one but it stores the output Flash
files in a directory named C:\FlashDocs:
P2F.ConvertDir "C:\Docs", , "C:\FlashDocs"
|
And finally this example is again similar to the first one with the only
difference it converts the documents in all subdirectories of C:\Docs directory
as well:
P2F.ConvertDir "C:\Docs", , , True
|
For usage examples of Profile, BatchProcessingOptions and PrintingPreferences
arguments refer to Profile,
BatchProcessingOptions and
PrintingPreferences
objects reference topics.
ConvertFile
Method converts a single file to Flash.
Signature
ConvertFile (SourceFileName , [OutputFileName], [Profile], [BatchProcessingOptions],
[PrintingPreferences])
Arguments
| Name |
Type |
Description |
| SourceFileName |
String |
The full path and name of the
source document file |
| OutputFileName |
String |
The full path and name of the
output Flash file. If this parameter is omitted, the file is named after the
original document with .swf extension appended to the original document name
and is put into the same folder as the original file |
| Profile |
Profile object |
Profile object with document
options to use for conversion. If omitted, options from
DefaultProfile
property are used |
| BatchProcessingOptions |
BatchProcessingOptions object |
BatchProcessingOptions object
with batch processing options to use for conversion. If omitted, options
from DefaultBatchProcessingOptions property are used |
| PrintingPreferences |
PrintingPreferences object |
PrintingPreferences
object with printing preferences to use for conversion. If omitted,
preferences from DefaultPrintingPreferences property are used |
Remarks
At minimum you should provide only the SourceFileName argument. All other
arguments are optional.
Examples
The following example converts a document named C:\Docs\MyDoc.doc to Flash
and saves the converted file to C:\Docs\MyDoc.doc.swf:
P2F.ConvertFile "C:\Docs\MyDoc.doc"
|
This example is similar to the above except that it saves the resulting Flash
file under an explicitly specified name C:\FlashDocs\MyDoc.swf:
P2F.ConvertFile "C:\Docs\MyDoc.doc", "C:\FlashDocs\MyDoc.swf"
|
For usage examples of Profile, BatchProcessingOptions and PrintingPreferences
arguments refer to Profile,
BatchProcessingOptions and
PrintingPreferences
objects reference topics.
EndJob
Method ends the current printing job.
Signature
EndJob()
Remarks
This call creates a Flash file at the location specified in the earlier StartJob
method call. After this call the Print2Flash Printer reverts to normal mode
of operation without capturing print jobs. See Printing Jobs
help topic for more information on printing jobs.
SetP2FPrinterAsDefault
Makes Print2Flash Printer a default printer in the system.
Signature
SetP2FPrinterAsDefault()
Remarks
This method call makes Print2Flash Printer a default printer in the
system. For some applications it may be necessary that Print2Flash Printer
is a default printer in order to send document output to it successfully. In
such cases this method may help you to set Print2Flash Printer as a default
printer.
StartJob
Method starts a new printing job.
Signature
StartJob(OutputFileName, Profile, BatchProcessingOptions, PrintingPreferences)
Arguments
Remarks
After this call the Print2Flash Printer switches to a special "capture"
mode at which any print job sent to it will be converted to a Flash document
written to the file specified by the OutputFileName parameter. See
Printing Jobs help topic for more information on
printing jobs
|