Designing your Own Document Viewer for Single File per Page Format

This approach assumes that the document is stored not in a single SWF file
but in a set of files, each document page being stored in a separate SWF file.
The number of files constituting a document corresponds to the number of pages
in the document. Your responsibility is to develop a viewer which loads document
page files into it and displays them as you need it.
The generated document page file is a regular SWF movie file containing a
single frame which, when loaded, displays page content. The movie dimensions
depend on the original document page size and on the resolution the document was
printed at. You may determine the page movie width or height using the following
formula:
Dimension (in pixels) = Dimension (in inches) * OutputResolution (in DPI)
Here Dimension (in pixels) represents a page movie width or height, Dimension
(in inches) represents the corresponding dimension of this page in inches in the
original document and OutputResolution is the value of the Output Resolution
field in the Output tab of Document Options window. For
example, if the original page height is 11 inches and OutputResolution is set to
192 DPI, the output page Flash file height will be 2112 pixels.
Besides Output Resolution there is also another Resolution setting available
in the Printer Properties window. This value
differs from the Output Resolution in that it determines the resolution at which
applications print documents on the Print2Flash Printer, and this may affect
rendering algorithms, speed and quality of those applications at printing. After
the application has printed a page, Print2Flash scales the output page to the
value specified by the Output Resolution field which may either compress or
enlarge page dimensions according to your needs.
In most cases, however, it is
better to have both these resolution settings equal to each other unless you are
concerned with printing application behavior at various resolutions. To ensure
this, OutputResolution property can be set to zero value which means that output
resolution is always equal to printing resolution so no additional scaling
occurs.
The page movie files are named according to a name template. This template
usually consists of a fixed part and a variable page number part. For example, a
three page document may consist of three files:
mydoc_1.swf
mydoc_2.swf
mydoc_3.swf
Here the first file corresponds to the first page, the second file - to the
second page and so on.
At programmatic conversion file naming is controlled by PageFileName
property of Profile
object or PageFileName option of
Enhanced Batch Processing. The
file name contains two placeholders for inserting the output document file
name and a page number. For example, to create the above set of files when
output document name is mydoc.swf, you need to have this value for the
PageFileName property:
%name%_%page%.swf
When converting documents manually, the files are named in a similar way and
stored in the folder you specify when saving the Flash document in the
Print2Flash Application.
You may determine the total number of pages in the document using TotalPages
property of Server object or from a document
metadata file.
When developing your own viewer for "Single file per page" mode you need to
load these page files in your viewer and display them in whatever way you need
it. Print2Flash SDK contains a sample of such a viewer. This sample viewer
represents a Flash movie designed in Adobe Flash CS3 Professional software using
ActionScript 3. We recommend to check this movie source code for more details,
and you may use it as a starting point for developing of your own viewer. The
sample uses the standard ScrollPane component for displaying document pages in
an area where a continuous stack of document pages can be scrolled. Of course,
you may use other methods for document display loading document pages not into ScrollPane component but
into other movie clips.
Note that in this mode no skin information
is stored in the output page Flash files. They have only actual page content in
them.
|