Home  • Download  • Register Now!  • Benefits  • Help  • Testimonials  • Samples  • Screenshots  • Awards  • Forum  • Convert Documents Online  • Print2Flash APIs  • Print2Flash vs. FlashPaper  • Contact Us
 Help Contents

Server Object

The Server object allows you to convert documents to Flash or HTML5 format 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:

Object access

To access Server object, you need to create it using "Print2Flash5.Server" ProgID such as in the following example:

set P2F=CreateObject("Print2Flash5.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 Print2Flash 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:
SVGFileCount Integer Yes Returns the number of page SVG files generated at the last document conversion.
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 Print2Flash documents.

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 Print2Flash documents are written. If this parameter is omitted, the output document 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 to true,  the files in all subdirectories of the SourceDirName directory with any nesting level are attempted to convert as well. The output Flash documents are named after the original document with .swf extension appended to the original document name. The output HTML5 documents are named after the original document with .xml extension appended to the original document name.

Examples

The following example converts all documents in a directory named C:\Docs and stores the converted files in the same directory. Documents in subdirectories are not converted:

P2F.ConvertDir "C:\Docs"
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 document 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 Print2Flash document.

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 base full path and name of the output document file without extension. For Flash documents Print2Flash adds .swf extension to this name while for HTML5 documents it adds .xml extension.
If this parameter is omitted, the file is put into the same folder as the original file. Flash documents are named after the original document with .swf extension appended to the original document name and HTML5 documents - with .xml extension appended.
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 and saves the converted Flash document to C:\Docs\MyDoc.doc.swf file and converted HTML5 document - to C:\Docs\MyDoc.doc.xml file (and a related folder C:\Docs\MyDoc.doc_files):

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\Doc2.swf and HTML5 document - under the name C:\FlashDocs\Doc2.xml (and a related folder C:\FlashDocs\Doc2_files):
 
P2F.ConvertFile "C:\Docs\MyDoc.doc", "C:\FlashDocs\Doc2"
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 Print2Flash document 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

Name Type Description
OutputFileName String The base full path and name of the output document file without extension. For Flash documents Print2Flash adds .swf extension to this name while for HTML5 documents it adds .xml extension.
Profile Profile object The Profile object to use for conversion.
BatchProcessingOptions  BatchProcessingOptions  object The BatchProcessingOptions object to use for conversion.
PrintingPreferences PrintingPreferences  object The PrintingPreferences  object to use for conversion.

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 Print2Flash document written to the file specified by the OutputFileName parameter. See Printing Jobs help topic for more information on printing jobs