Import Images from PDF
The SBSDKPDFPagesExtractor
class provides methods that can be used to extract images from a PDF.
Exmaple of Importing Images from PDF
- Swift
- Objective-C
// The path where the pdf is stored.
guard let pdfURL = URL(string: "<path_to_pdf>") else { return }
// Creates an instance of `SBSDKPDFPagesExtractor`
let pageExtractor = SBSDKPDFPagesExtractor()
// Extracts pages from the pdf and returns an array of UIImage
let images = pageExtractor.images(from: pdfURL)
// You can also use `images(fromPDF:scaling)` method to extract images with a scaling applied
let scaledImages = pageExtractor.images(from: pdfURL, scaling: 2.0)
// The path where the pdf is stored.
NSURL *pdfURL = [[NSURL alloc] initWithString:@"<path_to_pdf>"];
// Creates an instance of `SBSDKPDFPagesExtractor`
SBSDKPDFPagesExtractor *pageExtractor = [[SBSDKPDFPagesExtractor alloc] init];
// Extracts pages from the pdf and returns an array of UIImages
NSArray<UIImage *> *images = [pageExtractor imagesFromPDF:pdfURL];
NSArray<UIImage *> *scaledImages = [pageExtractor imagesFromPDF:pdfURL scaling:2.0];
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.