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

Using Print2Flash OLE Automation API

To make use of Print2Flash OLE Automation API you need to consult your programming language or tool documentation to learn how to create and access OLE Automation objects from it. After you learn how to create OLE Automation objects in your language or tool, you can start using Print2Flash OLE Automation API. Basically this involves importing of Print2Flash OLE Automation API type library (TLB) file (p2fserver.tlb) or Interface Definition Language (IDL) file (p2fserver.idl). These files are located in Print2Flash SDK directory.

One of the problems using Print2Flash OLE Automation API from web page server scripts may be the fact that such scripts usually run under very restricted user account which may prevent the printing applications from proper working and sending document output to Print2Flash printer. In such a case it may be necessary to make Print2Flash server work under another user or administrator account with proper rights. This may be achieved with Setting up Automation Object User Account.

Below is the instruction on how to use Print2Flash Automation API from VBScript but this discussion and involved API usage technique pertains to other languages as well. The Print2Flash Automation API Reference contains comprehensive documentation for all languages and API usage samples for VBScript.

Using Print2Flash Automation API from VBScript

Using Print2Flash Automation API from VBScript is, perhaps, the easiest and fastest way to start using this API as it does not involve using type libraries. VBScript can be used in Windows Script Host environment to run script directly from Windows Shell, from web pages or from ASP scripts. Below we'll consider creating scripts for Windows Script Host as the simplest way to explore Print2Flash Automation API.

First, you need to create a Print2Flash Server object in this way:

set P2F=CreateObject("Print2Flash5.Server")
Then you may convert a single document to Flash using a simple call such as this:
P2F.ConvertFile "C:\Docs\MyDoc.txt"
To test this functionality, create a file named testp2fapi.vbs, put those two lines there (changing the path to the document to a real document path), save the file and launch it by double clicking it in Widows Explorer. The script should convert the specified file and save resulting Flash and HTML5 documents to the same folder where original file resides under the name of the original document but with .swf or .xml extension appended to it. For example, for the document name above, you'll get files named C:\Docs\MyDoc.txt.swf and C:\Docs\MyDoc.txt.xml (as well as the related folder C:\Docs\MyDoc.txt_files) as output.

Similarly, you may write additional code using Print2Flash Automation API Reference documentation and samples from there and test it by saving the code as .vbs files and launching the script.