CGPDF is an iOS and Mac OS X API for reading and writing PDF documents. CG at the start is an abbreviation of “Core Graphics”.
Questions tagged [cgpdf]
60 questions
2
votes
1 answer
iOS PDF to plain text parser
I'm quite at a lost on this subject. I've read pretty much every post about it here on SO, I would very much appreciate it if somebody would nudge me in the right direction.
I have a PDF and I would like to extract it's text, I'm only interested in…

DIJ
- 347
- 4
- 19
1
vote
2 answers
Monotouch: Render PDF page preview in separate thread crashes from time to time
I have a UISlider. It is used to navigate quickly through a PDF. Whenever the threshold for the next page is reached, I display a UIView next to the slider's knob that contains a small preview of the target page.
The slider code looks is below this…

Krumelur
- 32,180
- 27
- 124
- 263
1
vote
3 answers
How do I find the size of the margins on a PDF page in Objective-C (CGPDF)
Given a page from a pdf document, I would like to be able to find the margin for the text, using objetive-C.
I realise there are already many questions relating to CGPDF..., but I have not been able to find anything useful. I have also had a look…

lindon fox
- 3,298
- 3
- 33
- 59
1
vote
1 answer
How to get PDF Destination with CGPDF
I have a pdf file, I want to render it on ipad. But I don't know how to get a named destination and how to implementation of the GoTo Action on ipad.
Names > Dests > Kids > Names > Annots
Names > Dests > Kids > Names > Annots > A -
Names > Dests…

user476489
- 101
- 6
1
vote
1 answer
CGPDFScanner and Adobe-Japan1
I'm using CGPDFScanner to extract text from a PDF.
At the time my TJ operator callback is called, the current font has CIDSystemInfo->Registry value "Adobe" and CIDSystemInfo->Ordering value "Japan1". i.e. character set "Adobe-Japan1".
How do I use…

Ken
- 30,811
- 34
- 116
- 155
1
vote
1 answer
LZW and CGPDFScanner
Does CGPDFScanner decompress any LZW-compression it encounters? Or am I responsible for this? [I'm assuming it does because I'm picking up plenty of Tj operators etc.]

Ken
- 30,811
- 34
- 116
- 155
1
vote
0 answers
Blank View when using CGPDF for showing PDF in iOS 9/10 with Objective-C
I have used Quartz Core and CGPDF to show a zoomable PDF in my app for quite some time, but since Xcode 8 and trying to make my app compatible for iOS 9 and 10, the PDF-code seems to have broken. This is the code I have been using:
-…

Jacob
- 1,310
- 1
- 15
- 29
1
vote
2 answers
CGPDF drawPDFPage with rotation support
I'm saving a PDF file with CGPDF under iOS 10. For this I load an existing PDF page, and write it to a new file with a context. While doing so, the rotation information gets lost and the resulting PDF file has all pages re-arragend at 0°.
let…

Jim B
- 641
- 5
- 18
1
vote
2 answers
How do I draw something on a PDF in Swift?
Here is what I am doing currently.
First, I get the document. Next I create a PDF View and assign the document to the view. Then I create a view and do my drawing in the view, then add the view to the PDFView as a subview. Then I convert the PDFView…

Tom J
- 106
- 2
- 14
1
vote
2 answers
How to open Password Protected PDF/DOC in UIWebview without using a temp file?
We are trying to open a password protected PDF/DOC file in UIWebview. Due to security concern, we can only retrieve the files from server and store into memory (i.e. NSData), but cannot store as a file.
We tried to use loaddata function in UIWebiew…

Forrest
- 23
- 5
1
vote
1 answer
Parsing PDF font operator missing
I'm parsing a PDF file and it seems that a Tf operator is missing. I can see, on PDF readers like Acrobat reader or Preview, that the font changes. But during the parse I don't have the Tf operator. I still have the ET operator that marks the ending…

bob
- 382
- 2
- 17
1
vote
1 answer
How to view the code behind a PDF document in IOS
I have a PDF page that I've converted into a stream:
CGPDFContentStreamRef contentStream = CGPDFContentStreamCreateWithPage(pdfPage);
How can I view that stream as an NSString? I'd like to see the code that represents the PDF.
Thanks!

user714171
- 363
- 1
- 3
- 12
1
vote
1 answer
How does the Tm operator pass the data in a PDF document using CGPDF?
According to the "Pdf Reference Version 1.7" the text-positioning operator "Tm" is described as follows:
...Although the operands specify a matrix, they are passed to Tm as six separate numbers, not as an array.
I don't understand how I'm supposed…

Diego A. Rincon
- 747
- 1
- 8
- 25
1
vote
2 answers
Find location of objects in PDF iOS
I have a PDF that is structured like this:
________________________________________________________
| | |
| 1. This is a simple question | A B C D E F G…

random
- 8,568
- 12
- 50
- 85
1
vote
1 answer
Duplicate CGPDFStrings from a CGPDFArray generated from a TJ callback on a PDF stream
OK, so I'm parsing through the PDF content stream, discovered that the TJ callback produces an array of strings, so I grab it and start iterating through it to get the string values like so:
static void Op_TJ(CGPDFScannerRef s, void *info)
{
…

Ptemple
- 125
- 6