Printing Jobs

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 file. This way offers some advantages:
- There is no need even to have a file on disk in order convert a print
job output to Flash. 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;
- 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
programmatically;
- 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. For example, you may convert MS PowerPoint documents
setting additional options for them such as which slides to print, output
type (notes, slides, handouts, etc.) and so on using MS PowerPoint
Automation API.
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 Flash file is accomplished in three
steps:
- Start a job by calling StartJob method of
Server object. The method needs the resulting output Flash file name as
the first parameter:
P2F.StartJob "C:\outdocs\doc1.swf"
|
Here P2F is a reference to the
Server object.
Additional parameters accepted by this method are references to the
Profile,
BatchProcessingOptions and
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 file.
- Send a document to the Print2Flash Printer. You need to use a 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 Flash file specified as the first
parameter of this method. Even a print job initiated manually will be
captured.
- Complete the job by invoking EndJob method of
Server object:
This call creates a Flash file at the location specified in the StartJob
method call earlier. 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,
ConverttFile method.
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, the output Flash file should be created
from the printed PowerPoint document at the location specified in the StartJob
method call, i.e. at "c:\outdocs\doc1.swf".
Set P2F = CreateObject("Print2Flash3.Server")
P2F.StartJob "c:\outdocs\doc1.swf"
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
P2F.EndJob
|
|