PDFParsing & extracting the images only in iPhone application.
- by sagar
Hello - Every one.
** : My Query : **
I want to extract only images from entire pdf document. ( Using Objective C - for iPhone Application )
: My Efforts :
I have gone through this link which has details regarding different operators of PDF Document.
( http://mail-archives.apache.org/mod_mbox/pdfbox-commits/200912.mbox/%[email protected]%3E )
I also studied this document - ( http://developer.apple.com/mac/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf_scan/dq_pdf_scan.html#//apple_ref/doc/uid/TP30001066-CH220-TPXREF101 )
I also have gone through entire document of PDFReference.pdf ( From original Adobe Site )
PDFReference.pdf (Adobe Document - says that - for image there are following operators )
q
Q
BI
EI
I have placed following table get the image
myTable = CGPDFOperatorTableCreate();
CGPDFOperatorTableSetCallback(myTable, "q", arrayCallback2);
CGPDFOperatorTableSetCallback(myTable, "TJ", arrayCallback);
CGPDFOperatorTableSetCallback(myTable, "Tj", stringCallback);
I have following arrayCallback2 method for getting image
void arrayCallback2(CGPDFScannerRef inScanner, void *userInfo) {
// how to extract image from this code
// means I have tried too many different ways. following is incorrect way & not giving image
// CGPDFStreamRef stream; // represents a sequence of bytes
// if (CGPDFDictionaryGetStream (d, "BI", &stream)){
// CGPDFDataFormat t=CGPDFDataFormatJPEG2000;
// CFDataRef data = CGPDFStreamCopyData (stream, &t);
// }
}
above arrayCallback2 method is called for operator "q", But I don't know How to extract the image from it.
In short.
What should be the solution for extracting the images from the pdf documents?
Thanks in advance for your kind help.
Sagar kothari.