Creating TIFF Documents | Cordova Document Scanner
ScanbotSdk.writeTiff(args: {images: string[], 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 Pages (documentImageFileUri)
are used to generate the TIFF file.
import ScanbotSdk, { Page } from 'cordova-plugin-scanbot-sdk';
private SDK = ScanbotSdk.promisify();
public scannedPages: Page[] = ...;
// Always make sure you have a valid license on runtime via SDK.getLicenseInfo()
if (!licenseCheckMethod()) { return; }
const result = await this.SDK.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 args:
images: Input images as an array of file URIs in proper order (image element 1 => page 1, etc).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 is200dpi.compression: Optional TIFF compression type. The default value depends on theoneBitEncodedflag.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.CCITTRLECCITTFAX3CCITT_T4CCITTFAX4CCITTRLEWLZWPACKBITSDEFLATE
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 a free trial license to test the Scanbot SDK thoroughly.
Get free trial licenseScanbot SDK is part of the Apryse SDK product family
A mobile scan is just the start. With Apryse SDKs, you can expand mobile workflows into full cross‑platform document processing. Whether you need to edit PDFs, add secure digital signatures, or use a fast, customizable document viewer and editor, Apryse gives you the tools to build powerful features quickly.
Learn more
