Creating TIFF Documents | Capacitor Document Scanner
ScanbotSDKwriteTIFF(args: WriteTIFFArguments): Promise<ResultWrapper<WriteTIFFResult>>
export interface WriteTIFFArguments {
imageFileUris: string[];
options?: {
oneBitEncoded?: boolean;
dpi?: number;
compression?: TIFFCompression;
};
}
Renders the given image files into a multi-page TIFF and stores it as a file. For each image, a separate page is generated.
Typically, the final hi-res document image files of the scanned Page
s (documentImageFileUri
)
are used to generate the TIFF file.
import { ScanbotSDK, Page } from 'capacitor-plugin-scanbot-sdk';
// Always make sure you have a valid license on runtime via ScanbotSDK.getLicenseInfo()
if (!licenseCheckMethod()) { return; }
const result = await ScanbotSDK.writeTIFF({
imageFileUris: this.scannedPages.map(p => p.documentImageFileUri),
options: {
oneBitEncoded: true,
dpi: 300,
compression: 'CCITT_T6'
}
});
// use the TIFF file URI from result, e.g.:
await uploadTiff(result.tiffFileUri);
Input arguments:
imageFileUris
: Input images as an array of file URIs in proper order (image element 1 => page 1, etc).options
:oneBitEncoded
: Optional boolean flag. Iftrue
, the input images will be binarized and the output TIFF file will be saved with one bit per pixel. Iffalse
, the input images will be stored as-is. The default value is false.dpi
: Optional integer value for Dots Per Inches. The default value is200
dpi.compression
: Optional TIFF compression type. The default value depends on theoneBitEncoded
flag.CCITT_T6
(CCITT Fax 4) is the default value for binarized (oneBitEncoded=true
) images. For color images (oneBitEncoded=false
) the default value isADOBE_DEFLATE
(ZIP).
Result:
tiffFileUri
: File URI of the TIFF result file ('file:///...'
).
Supported TIFF Compression Types
NONE
: No compression.CCITT_T6
: "CCITT Fax 4" compression type. Most common and recommended type for binarized (1-bit) black and white images to achieve a small TIFF file size.ADOBE_DEFLATE
: "ZIP" compression type. Most common type for color images.CCITTRLE
CCITTFAX3
CCITT_T4
CCITTFAX4
CCITTRLEW
LZW
PACKBITS
DEFLATE
caution
We recommend using the default compression type for optimal results (refer to the Input Arguments above).
Please note that the following compression types are only compatible for binarized images (1-bit encoded black & white images):
CCITTRLE
, CCITTFAX3
, CCITT_T4
, CCITTFAX4
, CCITT_T6
, CCITTRLEW
.
Want to scan longer than one minute?
Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.
Get your free Trial LicenseWhat do you think of this documentation?
What can we do to improve it? Please be as detailed as you like.