Search code examples
iphonecocoa-touchios4linker-errors

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).


Solution

  • 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