Creating PDF Documents | Cordova Document Scanner
ScanbotSdk.createPdf(args: {images: string[], pageSize: PDFPageSize})
Renders the given image files into a PDF document 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 PDF 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.createPdf({
images: this.scannedPages.map(p => p.documentImageFileUri),
});
// use the PDF file URI from result, e.g.:
await uploadPdf(result.pdfFileUri);
Input args:
imageFileUris: Input images as an array of file URIs in proper order (image element 1 => page 1, etc).options: Additional configurable optionspageSize: PDF page size enum value to specify the output page size. See below.pageOrientation: Set orientation of the PDF page.metadata: Associated metadata with the created PDF.
Result:
pdfFileUri: File URI of the PDF result file ('file:///...').
Supported PDF Page Sizes
A3: represents 297 x 420 (mm) page size. The image is fitted and centered within the page.A4: represents 210 x 297 (mm) page size. The image is fitted and centered within the page.A5: represents 148 x 210 (mm) page size. The image is fitted and centered within the page.B4: represents 250 x 353 (mm) page size. The image is fitted and centered within the page.B5: represents 176 x 250 (mm) page size. The image is fitted and centered within the page.COMM10: represents 4.125 x 9.5 (inches) page size. The image is fitted and centered within the page.CUSTOM: represents a custom page size. Each page is as large as its image at 72 dpi.EXECUTIVE: represents 7.25 x 10.5 (inches) page size. The image is fitted and centered within the page.LEGAL: represents 8.5 x 14 (inches) page size. The image is fitted and centered within the page.LETTER: represents 8.5 x 11 (inches) page size. The image is fitted and centered within the page.US4x6: represents 4 x 6 (inches) page size. The image is fitted and centered within the page.US4x8: represents 4 x 8 (inches) page size. The image is fitted and centered within the page.US5x7: represents 5 x 7 (inches) page size. The image is fitted and centered within the page.
Supported PDF Page Orientations
PORTRAITLANDSCAPEAUTO
Supported PDF Metadata
authorcreatortitlesubjectkeywords
PDF with OCR
If you need to generate a searchable PDF file with a text layer, please refer to the "OCR" section.
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get free trial license