Normally for conversion of documents using
Print2Flash Automation API you need to provide a document file on disk and
then invoke ConvertFile or ConvertDir methods of
Server object specifying the path to the document file. However, there is
another approach called "printing jobs". Using this approach you may "capture"
any print job sent to the Print2Flash Printer and convert job output into
a Flash or HTML5 file. This method offers some advantages:
- There is no need even to have a file on disk in order convert a print
job output to a Print2Flash document. You may capture any print job sent to the Print2Flash Printer without any connection with a file. For example, if you designed an
application that can send some output to a printer, you may easily convert
this output to Flash or HTML5;
- You may convert documents of any types besides those that have an
application registered for printing of this kind of files in the operating
system provided that you can send this file to the Print2Flash Printer
- You may convert documents with more conversion options provided that you
can send this file to the Print2Flash Printer programmatically and can
control those options.
The drawback of printing jobs is you have to know how to send a document to
the printer or create a print job with which you do not have to bother yourself
if you use ConvertFile or ConvertDir methods. For documents there may be an API
allowing you to print them, for example, MS Office has Automation API for
accessing and printing of MS Office documents. Print jobs may be created by your
application when you send any output from it to a printer.
Using Printing Jobs
The capturing of a print job into a Print2Flash document is accomplished in three
- Start a job by calling StartJob method of
Server object. The method needs the base output document file name as
the first parameter:
The first parameter should specify the base output document name without
Here P2F is a reference to the
Additional parameters accepted by this method are references to the
PrintingPreferences objects similar to ConvertFile or ConvertDir
methods. 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 and an HTML5 document.
- Send a document to the Print2Flash Printer. You need to use special
API for printing the documents or creating print jobs as mentioned above.
The first print job sent to the Print2Flash Printer after StartJob method call
will be captured and converted to a Print2Flash document file specified as the first
parameter of this method. Even a print job initiated manually will be
- Complete the job by invoking EndJob method of
This call creates a Flash and an HTML5 document file at the location specified in the StartJob
method call earlier. The Flash document file name will be
"C:\outdocs\doc1.swf"; the HTML5 document file name will be "C:\outdocs\doc1.html"
(it will also create a document-related folder "C:\outdocs\doc1_files"). After this call the Print2Flash Printer reverts to normal
mode of operation without capturing print jobs. To convert another document,
you may use ConvertFile or ConvertDir methods of
Server object or start another printing job using StartJob method.
If you called StartJob method and switched Print2Flash to capture mode but
later decided not to send a document to the printer, you may cancel this mode
using CancelJob method. 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 before calling, for example,
The following example demonstrates using printing jobs. It starts a job,
sends a PowerPoint document to the Print2Flash Printer using PowerPoint
Automation API setting some printing options and finally completes the job.
After this code execution is completed, an output Flash file and an HTML5
document should be created
from the printed PowerPoint document at the location specified in the StartJob
method call, i.e. Flash file will be written to "c:\outdocs\doc1.swf" file,
and HTML5 file - to "c:\outdocs\doc1.html" file and "C:\outdocs\doc1_files"
Set P2F = CreateObject("Print2Flash4.Server")
Set PowerPoint = CreateObject("PowerPoint.Application") ' Launch MS PowerPoint
PowerPoint.Visible = true
Set Presentation = PowerPoint.Presentations.Open("c:\docs\doc1.ppt", true) ' Open a presentation
Presentation.PrintOptions.ActivePrinter = "Print2Flash 3 Printer" ' Set active printer
Presentation.PrintOptions.FitToPage = true ' Make slides fill the full page area
Presentation.PrintOptions.PrintInBackground=False ' Turn off background printing
Presentation.PrintOut ' Send the document to the printer
Presentation.Close ' Close the presentation
PowerPoint.Quit ' Close MS PowerPoint