Encode & Decode

Methods
ClearTiffCustomTag() ConvertToBase64() ConvertToBlob()
SetTiffCustomTag()
Properties
IfOpenImageWithGDIPlus IfTiffMultiPage
JPEGQuality TIFFCompressionType
Deprecated Properties
PDFAuthor PDFCompressionType PDFCreationDate
PDFCreator PDFKeywords PDFModifiedDate
PDFProducer PDFSubject PDFTitle
PDFVersion

Methods

ClearTiffCustomTag()
Clears the content of all custom tiff tags.
Syntax .ClearTiffCustomTag()
Parameters None
Return value None
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v10.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
ConvertToBase64()
Converts the images of specified indices in buffer to a base64 string.
Syntax .ConvertToBase64(indices, enumImageType, asyncSuccessFunc, asyncFailureFunc);
Parameters number indices: specifies the indices of images in buffer. The index is 0-based.
EnumDWT_ImageType enumImageType: specifies the format.

Type Numeric Value
IT_BMP 0
IT_JPG 1
IT_TIF 2
IT_PNG 3
IT_PDF 4

OnSuccess function asyncSuccessFunc: callback function triggered when the file is converted successfully.
OnFailure function asyncFailureFunc: callback function triggered when the file fails to be converted.
Return value Base64Result is returned in the callback asyncSuccessFunc()
Methods available in Base64Result object
Data Type Method Name Description
number getLength() Returns the length of the Base64 String
string getData(offset, length) Returns the string containing the extracted part of the Base64 string. The parameter offset means the position where to start the extraction. The parameter length means the number of characters to extract.
string getMD5() Returns the MD5 of the Base64 String.

The result string returned from getData is the pure base64 string with no extra info. For example, "/9j/4AAQSkZJRgABA..."
To use the string in most circumstances, you need to add extra info like data:image/png;base64,"/9j/4AAQSkZJRgABA..."
Because this method is async only, the returned value doesn't mean if the convert succeeds or not. When conversion fails, check ErrorCode or ErrorString for error information.
Example
DWObject.ConvertToBase64 ([1,3], EnumDWT_ImageType.IT_PDF, asyncSuccessFunc, 
asyncFailureFunc);
function asyncSuccessFunc (base64Result, newIndices, enumImageType, _arguments) {
     var length=base64Result.getLength();
     console.log(base64Result.getData(0,length));
     console.log(base64Result);
}
function asyncFailureFunc (errorCode, errorString, newIndices, enumImageType, _arguments) {
     alert("ErrorCode: "+errorCode +"\r"+"ErrorString:"+ errorString);
}
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v12.0 ✓ | v12.0 ✓ | v12.0 ✓ | v12.1
ConvertToBlob()
Converts the images of specified indices in buffer to a blob.
Syntax .ConvertToBlob(indices, enumImageType, asyncSuccessFunc, asyncFailureFunc);
Parameters Number[] indices: specifies the indices of images in buffer. The index is 0-based.
EnumDWT_ImageType enumImageType: specifies the format.
Type Numeric Value
IT_BMP 0
IT_JPG 1
IT_TIF 2
IT_PNG 3
IT_PDF 4
OnSuccess function asyncSuccessFunc: callback function triggered when the file is converted successfully.
OnFailure function asyncFailureFunc: callback function triggered when the file fails to be converted.
Return value Blob is returned in the callback asyncSuccessFunc()
Because this method is asynchronous, whether there is a returned value doesn't mean the success/failure of the operation. When the conversion fails, check ErrorCode or ErrorString for error information.
Example
DWObject.ConvertToBlob ([1,3], EnumDWT_ImageType.IT_PDF, asyncSuccessFunc, 
asyncFailureFunc);
function asyncSuccessFunc (_blob, newIndices, enumImageType, _arguments) {
     console.log(_blob.size);
}
function asyncFailureFunc (errorCode, errorString, newIndices, enumImageType ,_arguments) {
     alert("ErrorCode: "+errorCode +"\r"+"ErrorString:"+ errorString);
}
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v13.0 ✓ | v13.0 ✓ | v13.0 ✓ | v13.0
SetTiffCustomTag()
Sets a custom tiff tag (up to 32 tags). The string to be set in a tag can be base64 encoded.
Syntax .SetTiffCustomTag(tagIdentifier, content, UseBase64Encoding);
Parameters number tagIdentifier: specifies the identify number of custom tag in the tiff image.
string content: the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, it'll be decoded when creating the TIFF file.
Boolean UseBase64Encoding: specifies whether the content is base64 encoded.
Return value boolean
Example
DWObject.ClearTiffCustomTag();
DWObject.SetTiffCustomTag(700, "Custom Tiff Tag Value", true); 
DWObject.SaveAsTIFF("C:\\DWT.tiff", 0);
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | 10.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1

Properties

IfOpenImageWithGDIPlus
Returns or sets whether to use GDI+ library to decode images when loading them.
Type boolean
Accessors Get Set
Usage notes Windows GDI+ is a class-based API for C/C++ programmers. It enables applications to use graphics and formatted text on both the video display and the printer. Applications based on the Microsoft Win32 API do not access graphics hardware directly. Instead, GDI+ interacts with device drivers on behalf of applications. GDI+ is also supported by Microsoft Win64.
With GDI+, you can load some images which are not supported otherwise. However, please note that GDI+ library might be different on different OS. So an image might load on Win 7 but not Win XP.
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v10.0 ✓ | v10.0
IfTiffMultiPage
Return or sets whether it's allowed to save many images as one TIFF file.
Type boolean
Accessors Get Set
Usage notes When you save a new image in the same name of an existing TIFF file
  • If this property is true, the new image will be added to the existing file
  • If this property is false, the new image will replace the existing file
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v3.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
JPEGQuality
Returns or sets the quality of JPEG files or JPEG-encoded PDF files.
Type number
Accessors Get Set
Usage notes

The default value of JPEGQuality property is 80.

The valid range is 0-100. The higher the JPEGQuality property, the better the quality and the bigger the size of the file.

Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
TIFFCompressionType
Returns or sets the compression type for TIFF files.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v4.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
Usage notes
Allowed Values EnumDWT_TIFFCompressionType Description Supported image format
0 TIFF_AUTO Auto mode 1, 4, 8, 24 bit
1 TIFF_NONE Dump mode 1, 4, 8, 24 bit
2 TIFF_RLE CCITT modified Huffman RLE 1 bit
3 TIFF_FAX3 CCITT Group 3 fax encoding 1 bit
TIFF_T4 CCITT T.4 (TIFF 6 name) 1 bit
4 TIFF_FAX4 CCITT Group 4 fax encoding 1 bit
TIFF_T6 CCITT T.6 (TIFF 6 name) 1 bit
5 TIFF_LZW Lempel-Ziv & Welch 1, 4, 8, 24 bit
7 TIFF_JPEG JPEG encoding 24 bit
32773 TIFF_PACKBITS Macintosh RLE 1, 4, 8, 24 bit
When set to TIFF_AUTO (0), 1-bit images will be compressed in TIFF_T6 (4) while images with other bit depth will be compressed in TIFF_LZW (5).

When set to TIFF_JPEG (7), 1-bit images will be compressed in TIFF_T6 (4), color images or grey images (8-bit or higher) in TIFF_JPEG (7) standard, and other images by TIFF_LZW (5).

TIFF_T4 (3) and TIFF_FAX3 (3) are two names for the same compression type. So are TIFF_T6 (4) and TIFF_FAX4 (4)

When TIFF_JPEG (7) is used, you can use JPEGQuality to further reduce the size of the TIFF file.

As of version v14.2, TIFF_JPEG (7) and TIFF_PACKBITS (32773) are only supported on Windows.
PDFAuthor
Returns or sets the name of the author that creates the PDF document.
Type string
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
PDFCompressionType
Returns or sets the compression type for PDF files.
Type string
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
Usage notes
Allowed Values EnumDWT_PDFCompressionType Description Supported image format
0 PDF_AUTO Auto mode 1, 4, 8, 24 bit
2 PDF_FAX4 CCITT Group 4 fax encoding 1 bit
3 PDF_LZW Lempel-Ziv & Welch 1, 4, 8, 24 bit
5 PDF_JPEG JPEG encoding 8, 24 bit
6 PDF_JP2000 JPEG 2000 encoding 8, 24 bit
7 PDF_JBig2 JBig2 encoding 1 bit
PDFCreationDate
Returns or sets the date when the PDF document is created.
Type string
Accessors Get Set
Usage notes The default value is current date.
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
PDFCreator
Returns or sets the name of the application that created the original document (used when the PDF document is converted from another form);
Type string
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
PDFKeywords
Returns or sets the keywords associated with the PDF document.
Type string
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
PDFModifiedDate
Returns or sets the date when the PDF document is last modified.
Type string
Accessors Get Set
Usage notes The default value is current date.
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
PDFProducer
Returns or sets the name of the application that generated the PDF document.
Type string
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
PDFSubject
Returns or sets the subject of the PDF document.
Type string
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
PDFTitle
Returns or sets the title of the PDF document.
Type string
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
PDFVersion
Returns or sets the version number for PDF files.
Type string
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1

results matching ""

    No results matching ""

    results matching ""

      No results matching ""