Reading text and images from a pdf in iOS

I am showing a locally saved pdf in my iPad application. Here is the code:

NSString *path = [[NSBundle mainBundle] pathForResource:@"About Downloads" ofType:@"pdf"]; NSURL *targetURL = [NSURL fileURLWithPath:path]; NSURLRequest *request = [NSURLRequest requestWithURL:targetURL]; [pdfWebView loadRequest:request]; 

Now, by default, you cannot copy text or images from a PDF file that is displayed in UIWebView. Is there a way to allow users to copy text and / or images from PDF?

I am not familiar with CATitledLayer, so I'm just wondering if this can help in this case?

+4
source share
2 answers

There is no simple answer to this question. PDFs are nested dictionaries consisting of more dictionaries and arrays. You will have to dig into CGPDFDocument . Voyeur is a great tool to use while copying to PDF files. Reader is a good starting point for rendering PDF files.

+2
source

To get the text in a PDF, I use PDF Kitten (https://github.com/KurtCode/PDFKitten). It works quite well, but, as the author notes, is incomplete and does not support all types of fonts.

+1
source

All Articles