Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jfalexvijay

macrumors newbie
Original poster
Jul 14, 2010
9
0
Hi,

I tried to read the content from PDF file. But I am getting error.
Example code:


-----
CGPDFDocumentRef document =
CGPDFDocumentCreateWithURL(
CFURLCreateWithFileSystemPath(NULL,
CFStringCreateWithCString(NULL, [filename UTF8String],
kCFStringEncodingUTF8), kCFURLPOSIXPathStyle, 0));
CGPDFPageRef page;
totalPages=CGPDFDocumentGetNumberOfPages(document);
page = CGPDFDocumentGetPage (document, 3);

CGPDFScannerRef myScanner;
CGPDFOperatorTableRef myTable;
myTable = CGPDFOperatorTableCreate();
CGPDFOperatorTableSetCallback (myTable, "MP", &op_MP);
CGPDFOperatorTableSetCallback (myTable, "DP", &op_DP);
CGPDFOperatorTableSetCallback (myTable, "BMC", &op_BMC);
CGPDFOperatorTableSetCallback (myTable, "BDC", &op_BDC);
CGPDFOperatorTableSetCallback (myTable, "EMC", &op_EMC);
-----
static void op_MP (CGPDFScannerRef s, void *info) {
const char *name;
if (!CGPDFScannerPopName(s, &name))
return;
printf("MP /%s\n", name);
}


error:

/Alex/Alex/Test/samples/PDF/Classes/ReadContents.m: In function '-[ReadContents readPDF]':
/Alex/Alex/Test/samples/PDF/Classes/ReadContents.m:34: error: 'op_MP' undeclared (first use in this function)
/Alex/Alex/Test/samples/PDF/Classes/ReadContents.m:34: error: (Each undeclared identifier is reported only once
/Alex/Alex/Test/samples/PDF/Classes/ReadContents.m:34: error: for each function it appears in.)
/Alex/Alex/Test/samples/PDF/Classes/ReadContents.m:35: error: 'op_DP' undeclared (first use in this function)
/Alex/Alex/Test/samples/PDF/Classes/ReadContents.m:36: error: 'op_BMC' undeclared (first use in this function)
/Alex/Alex/Test/samples/PDF/Classes/ReadContents.m:37: error: 'op_BDC' undeclared (first use in this function)
/Alex/Alex/Test/samples/PDF/Classes/ReadContents.m:38: error: 'op_EMC' undeclared (first use in this function)
/Alex/Alex/Test/samples/PDF/Classes/ReadContents.m:31: warning: unused variable 'myScanner'
{standard input}:49:non-relocatable subtraction expression, "L_OBJC_IVAR_$_ReadContents.name$non_lazy_ptr" minus "L00000000001$pb"
{standard input}:49:symbol: "L_OBJC_IVAR_$_ReadContents.name$non_lazy_ptr" can't be undefined in a subtraction expression
{standard input}:unknown:Undefined local symbol L_OBJC_IVAR_$_ReadContents.name$non_lazy_ptr


Please help me to resolve it.

Thanks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.