Skip to main content

Extract Images from PDF | React Native Barcode Scanner

ScanbotBarcodeSDK.extractImagesFromPdf(args: ExtractImagesFromPdfArguments): Promise<ResultWrapper<string[]>>

This method allows you to extract JPEG or PNG (Android only) images from a PDF file.

Arguments

 /**
* The location of the PDF file
*/
pdfFilePath: string;
/**
* The quality that each extracted image should have.
* This tweaks the compression, affecting the final image file size.
* (100: maximum quality, 0: minimum quality)
*
* Default value is 90
*/
quality?: number;
/**
* Integer scaling factor applied to the PDF media box frame while extracting.
* Affects the output image quality.
* In most cases the recommended value is 2 or higher.
*
* Default value is 2.
*/
scaling?: number;
/**
* Compress format used for extracted images. Android only.
*
* Default value is JPEG.
*/
compressFormat?: CompressFormat;

Returned result contains the URIs for the extracted images:

try {
const result = await ScanbotBarcodeSDK.extractImagesFromPDF({
pdfFilePath: "file:///..."
});
if (result.status === "OK" && result.data) {
// do something with result.data (image file urls)
}
} catch (e) {
// ...
}

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 License

What do you think of this documentation?