Snehal
Snehal

Reputation: 597

Extracting text from pdf using objective-c(libz.dylib)

I have imported the pdf.h file in my view controller class and tried calling

NSString *outPutString = convertPDF(pathToPdfFile);

but while building it gives me linker error:

_convertPDF" refrenced from: -[ScriptViewController searchBarSearchButtonClicked:] in ScriptViewController.o Symbol(s) not found

I have also included libz.dylib in my project.

What am I doing wrong?

Is there any step to be followed before building the project which includes c code?

Also one more question:

Will this search algorithm work on any PDF(simple and formatted pdfs).

Upvotes: 1

Views: 2187

Answers (2)

abaraga
abaraga

Reputation: 118

Your must use the definition in the pdf.h

#if __cplusplus
extern "C" {
#endif

NSString* convertPDF(NSString * pathToFile);

#if __cplusplus
}   
#endif

also in the implementation file *pdf.m*m use:

#if __cplusplus
extern "C" {
#endif

 NSString* convertPDF(NSString * pathToFile); 

#if __cplusplus
} //Extern C
#endif

Upvotes: 3

nkmrtsyk
nkmrtsyk

Reputation: 41

What if you change the name of the .m file that calls pdf.h to xxxx.mm ? It's a c++ file. I tested it and found out it works only with simple ascii pdfs.

Upvotes: 4

Related Questions