Skip to content
Guides

Text Reflow

Text reflow refers to reorganizing the text to fit the device screen size and display a layout suitable for reading on different devices.

This example shows how to set text reflow:

swift
let url = URL(fileURLWithPath:pdfPath)
if let document = CPDFDocument(url: url),
   let page = document.page(at: 0) {

    let range = NSRange(location: 0, length: Int(page.numberOfCharacters))
    if let string = page.string(for: range) {

    }
}
objective-c
NSURL *url = [NSURL fileURLWithPath:pdfPath];
CPDFDocument *document = [[CPDFDocument alloc] initWithURL:url];
CPDFPage *page = [document pageAtIndex:0];

NSRange range = NSMakeRange(0, page.numberOfCharacters);
NSString *string = [page stringForRange:range];