Profile Object

The Profile object controls document interface, protection and optimization
options used for document conversion.
Remarks
The Profile object allows you to control all those options that can be setup in
Document Options window when converting documents manually but at programmatic conversion. These options include interface,
protection and optimization options. In addition, this object can be used to
change default document options shown in Default Document Options window.
There are three possible scenarios of using Profile object:
- For specifying special (ad hoc) options applied to a single conversion or
series of conversion. In such a case you should create a Profile object, setup
its properties and pass it to ConvertFile or
ConvertDir methods as a Profile
argument;
- For changing default document options applied to all document conversions
performed via a single Server object instance. In such a case you should
obtain reference to the default profile using
DefaultProfile property and
change its properties. Then you may convert files with this
Server object
instance and all the options you setup will be applied to all document
conversions via this instance;
- For changing default document options shown in
Default Document Options
window. In such a case you should obtain a reference to the default
profile using DefaultProfile property, change its properties and save the
changes using ApplyChanges method.
Object access
To create an ad hoc Profile object, you need to create it using "P2F.Profile" ProgID such as in the
following example:
set MyProfile=CreateObject("P2F.Profile")
|
If you need to get a default profile with default document options, you need to
use DefaultProfile property of
Server object:
Set DefProfile=P2F.DefaultProfile
|
Here P2F refers to Server object instance.
Regardless of the method you obtained a profile, initially it contains the
default document option settings as they have been setup in
Default Document Options
window. The difference between an ad hoc and default profile instances is that
you cannot save an ad hoc profile and that default profile settings are used if
no profile is specified at conversion. After you obtained a reference to Profile object using one of the methods
above, you can access its properties and methods.
Properties
| Name |
Type |
Description |
| FlashVersion |
Integer |
The version of Flash Player for
which document output should be optimized. Currently can be either 7 or 8
which mean "version 7 or higher" and "version 8 or higher" |
| InterfaceOptions |
Integer |
Bit mask specifying which
buttons and controls should be shown in converted document interface. Should
be an OR combination of flags from
INTERFACE_OPTION enumeration |
| JpegQuality |
Integer |
JPEG quality level to use for
compression of images in the output document. It should be a number between
1 (lowest quality) and 100 (highest quality). Note that images are
compressed as JPEG only if UseJpeg property is set to true as well. |
| Language |
String |
Specifies document toolbar hint language. Possible
parameter values are:
- "auto" - Automatic selection of language based on the user's operating
system language;
- "cs" - Czech;
- "da" - Danish;
- "en" - English;
- "fr" - French;
- "de" - German;
- "pt" - Portuguese;
- "ru" - Russian;
- "es" - Spanish.
|
| Name |
String |
Profile name. This field is
reserved for future use |
|
ProtectionOptions |
Integer |
Bit mask specifying which
protection options should be activated in the converted document. Should be
an OR combination of flags from PROTECTION_OPTION enumeration |
| UseJpeg |
Boolean |
Flag specifying whether to
compress mages in the output document to JPEG |
|
ColorAdjustment |
String |
Toolbar button and
control color adjustment parameters. This allows changing toolbar colors to
a
certain degree. You may specify either a color name from the table below or
a string in the format "Hue,Saturation,Brightness,Contrast" where Hue, Saturation, Brightness,
and Contrast are color adjustment parameter values. Hue value should be between
-180 and 180 while Saturation, Brightness, and Contrast values - between
-100 and 100. You may specify any set of values in the permitted range.
To obtain practical set of values you may use toolbar preview in the
Tune Color Window accessible from Document Options window
and use the value shown in the Color Adjustment field. Standard settings offered in
Document Options window employ these sets of
values:
|
Color name |
ColorAdjustment value |
|
Blue |
-33,100,0,0 |
|
Teal |
-91,52,-26,0 |
|
Aqua |
-88,81,15,0 |
|
Brown |
97,56,42,-14 |
|
Red |
88,79,-13,0 |
|
Green |
-180,38,-4,0 |
|
Lime |
-158,34,52,0 |
|
Yellow |
148,100,100,-30 |
|
Olive |
151,100,-27,0 |
|
Pink |
53,100,3,0 |
|
Orange |
139,100,75,-30 |
|
Darkgray |
-180,-100,-3,-18 |
|
Gray |
-180,-100,35,0 |
|
Violet |
0,100,0,0 |
|
Methods
ApplyChanges
Method saves the default profile.
Signature
ApplyChanges()
Arguments
None
Remarks
Methods saves the default profile. The method should be called only for
default profile obtained via DefaultProfile property of
Server object. If you
intend to change the global default profile properties, you need to call this
method to save the changes.
Examples
The following example obtains a default profile, modifies some of its
properties and save the changes back to default profile.
The example assumes that enumeration constants file
P2FAPIConst.vb from
Print2Flash SDK is included:
Set DefProfile=P2F.DefaultProfile
DefProfile.InterfaceOptions = INTLOGO or NTZOOMSLIDER or INTFITWIDTH or INTFITPAGE or INTPREVPAGE or INTNEXTPAGE
DefProfile.ProtectionOptions = PROTDISPRINT or PROTDISTEXTCOPY
DefProfile.FlashVersion = 8
DefProfile.UseJpeg = True
DefProfile.JpegQuality = 80
DefProfile.ApplyChanges
|
Profile Object Examples
The sample below creates an ad hoc profile, sets its properties and use it
for conversion of a document named C:\Docs\MyDoc.doc
Set MyProfile=CreateObject("P2F.Profile")
MyProfile.InterfaceOptions = INTLOGO or INTDRAG or INTSELTEXT or INTGOTOPAGE
MyProfile.ProtectionOptions = PROTENAPI
P2F.ConvertFile "C:\Docs\MyDoc.doc", , MyProfile
|
This sample obtains a default profile, sets its properties and then
converts two documents using that profile default settings:
Set DefProfile=P2F.DefaultProfile
DefProfile.InterfcaeOptions = INTDRAG Or INTZOOMBOX Or INTFITWIDTH Or INTPREVPAGE Or INTNEXTPAGE or INTPRINT
DefProfile.UseJpeg = True
DefProfile.JpegQuality = 60
P2F.ConvertFile "C:\Docs\MyDoc.doc"
P2F.ConvertFile "C:\Docs\Finance.xls"
|
Note that as ApplyChanges method is not called here, changes are not saved to
the global default profile and affect only conversions performed via the current
Server object instance (P2F).
|