Help Contents

Profile Object

The Profile object controls various document options used at document conversion. These options include interface options, protection options, optimization options, hyperlink support options, output format control, watermark options, page thumbnail options, and metadata file options.

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. In addition this object can be used to change default document options shown in 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 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 "Print2HTML5.Profile" ProgID such as in the following example:

Set MyProfile=CreateObject("Print2HTML5.Profile")
If you need to get a default profile with default document options, you need to use DefaultProfile property of Server object:
 
Set DefProfile=P2H.DefaultProfile

Here P2H 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 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
Name String Profile name. This field is reserved for future use.

Document interface

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
Skin Skin object The default Skin object used at document conversions. You may either retrieve this object or set it to another Skin object obtained from SkinCollection collection.
If this property is set to null value, it tells Print2HTML5 that no skin is used and no skin images are stored inside the document. It is helpful for reducing of the document file size in case you either don't need the document toolbar at all or use your own custom document viewer.
Language String Specifies document toolbar hint language. Possible parameter values are listed below.
 
Value Language Value Language
auto Automatic selection of language based on the user's operating system language it Italian
bs Bosnian ja Japanese
cs Czech nl Dutch
da Danish pl Polish
de German pt Portuguese
en English ru Russian
es Spanish sr Serbian
fr French sv Swedish
hr Croatian tr Turkish
zh-CN Simplified Chinese zh-TW Traditional Chinese

Document protection

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
RestrictionDomains String Specifies from which domains (sites) the generated Print2HTML5 documents are allowed to be viewed. The value must be a comma-separated list of domains. For example, "mysite.com,Print2HTML5.com" value allows document display only if the document has been loaded from mysite.com or Print2HTML5.com domains. Mentioning a domain in the list does not include all its subdomains so allowed subdomains must be listed separately, e.g. "mysite.com,www.mysite.com". If the document is loaded from another domain, no document contents is shown to the user.
If this value is set to the empty string, no domain restriction is effective and documents can be viewed from any domain. See Restricting Access to Documents help topic for more information.

Options for HTML5 documents

HTML5Options HTML5Options object Object storing options specific for HTML5 documents.

Document optimization

UseJpeg Boolean Flag specifying whether to compress mages in the output document to JPEG
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.

Hyperlinks

ParseLinks Boolean Flag specifying if Print2HTML5 should parse hyperlinks out of document text and convert them to clickable hyperlinks in generated Print2HTML5 documents. See Hyperlinks topic for more information.
ExtractLinks Integer Specifies from which types of documents Print2HTML5 should extract hyperlinks for insertion in generated Print2HTML5 documents. Currently it could be MSWORD, MSPOWERPOINT or ACROBAT values from APPLICATIONTYPE enumeration. If you use Print2HTML5 Service and Server2 object, you cannot use MSWORD flag. To extract links from MS Word and PowerPoint documents, special application conversion method must be activated. See Hyperlinks topic for more information.
LinkTargetAuto Boolean If true, hyperlink targets are taken from source documents. If a source document does not specify a target or a link has been parsed from document text, _blank target is used.
If false, the target is specified by LinkTarget property. See Hyperlinks Tab of Document Options Window help topic.
LinkTarget String Specifies the target to be used for hyperlinks. This property is used only if LinkTargetAuto property is false.

Watermarks

WatermarkImage String Path to the graphic file of PNG format which should be placed on each document page as a watermark. See Watermarks topic for more information.
WatermarkScale Integer Specifies how the image watermark should be scaled relative to the page size. The value represents the percentage of the page size and should be between 1 and 100.
WatermarkTransparency Integer Specifies the transparency correction for the watermark image. This property affects watermark image transparency (alpha channel). The value should be between 0 (transparency of image is not affected) and 255 (full transparency).
WatermarkAnchor Integer Specifies the position on the page the watermark should be placed at. It must be a value from the WATERMARKANCHOR enumeration.
WatermarkXOffset String Specifies the horizontal offset of the watermark from the position denoted by WatermarkAnchor property. The value must be specified either in pixels or as a percentage in these formats:
  • "-10px" - for pixels;
  • "20% - for percentage. Percentage is calculated relative to page width.

If the unit is not specified, the default unit is percentage. The numeric value may be either positive or negative.

WatermarkYOffset String Specifies the vertical offset of the watermark from the position denoted by WatermarkAnchor property. The format of the value is similar to WatermarkXOffset property except that if it is specified as a percentage, it is calculated relative to page height.

Page thumbnails

ThumbnailPageRange String String describing the pages for which page thumbnails must be created. The acceptable values are the following:
  • "" (empty string) - no thumbnails are generated;
  • "All" - thumbnails are generated for each page;
  • Arbitrary page range. The string should be in the following format:

    [Range1Start[-][Range1End]] [,Range2Start[-][Range2End]] [, ... ]
See documentation on PageRange property of BatchProcessingOptions object.
ThumbnailFileName String The template of the name and path of page thumbnails files. If it includes the path, it is interpreted relative to the output folder (see ConvertDir and ConvertFile methods). The template format may include these placeholders:
  • %name% - main output document full path and name without extension;
  • %page% - page number (this is a required placeholder);
  • %ext% - file format extension (for example, "jpg" or "png").

In order to create page thumbnails, ThumbnailPageRange property should specify which thumbnails should be created.

ThumbnailFormat Integer Page thumbnail image file format. It should be set to one of the values from IMAGEFORMAT enumeration.
ThumbnailJpegQuality Integer JPEG quality level to use for compression of thumbnails images if the image format is JPEG. It should be a number between 1 (lowest quality) and 100 (highest quality).
ThumbnailImageHeight Integer Page thumbnail image file height. See Page Thumbnails topic for more information.
ThumbnailImageWidth Integer Page thumbnail image file width. See Page Thumbnails topic for more information.

Metadata file

CreateMetaDataFile Boolean If true, metadata file is created at conversion. The name and path to the file is specified by the MetaDataFileName property.
MetaDataFileFormat Integer Format of the metadata file. It should be set to one of the values from METADATAFORMAT enumeration.
MetaDataFileName String The template of the name and path of metadata file. If it includes the path, it is interpreted relative to the output folder (see ConvertDir and ConvertFile methods). The template format may include these placeholders:
  • %name% - main output document full path and name without extension;
  • %ext% - file format extension (for example, "xml" or "txt").

For example, if the output document name is c:\test\mydoc.xml, template is "%name%_files\metadata%ext%" and metadata file format is XML, the metadata file name will be c:\test\mydoc_files\metadata.xml.
In order to create metadata file, CreateMetaDataFile property should be set to true.


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 P2HAPIConst.vb from Print2HTML5 SDK is included:

Set DefProfile=P2H.DefaultProfile
DefProfile.InterfaceOptions = INTLOGO or NTZOOMSLIDER or INTFITWIDTH or INTFITPAGE or INTPREVPAGE or INTNEXTPAGE
DefProfile.ProtectionOptions = PROTDISPRINT or PROTDISTEXTCOPY
DefProfile.UseJpeg = True
DefProfile.JpegQuality = 80
DefProfile.ApplyChanges
Here P2H refers to a Server object instance.
 

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("Print2HTML5.Profile")
MyProfile.InterfaceOptions = INTLOGO or INTDRAG or INTSELTEXT or INTGOTOPAGE
MyProfile.ProtectionOptions = PROTENAPI
P2H.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=P2H.DefaultProfile
DefProfile.InterfaceOptions = INTDRAG Or INTZOOMBOX Or INTFITWIDTH Or INTPREVPAGE Or INTNEXTPAGE or INTPRINT
DefProfile.UseJpeg = True
DefProfile.JpegQuality = 60
P2H.ConvertFile "C:\Docs\MyDoc.doc"
P2H.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 (P2H).