使用objective-c从lib中提取文本(libz.dylib) [英] Extracting text from pdf using objective-c(libz.dylib)

查看:278
本文介绍了使用objective-c从lib中提取文本(libz.dylib)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的视图控制器类中导入了pdf.h文件,并尝试调用

  NSString * outPutString = convertPDF(pathToPdfFile ); 

但构建时会给我链接器错误



_convertPDFrefrenced from: - ScriptViewController中的[ScriptViewController searchBarSearchButtonClicked:] in ScriptViewController.o找不到符号



我也在我的项目中包含了libz.dylib。



我做错了什么?



在构建包含c代码的项目之前,是否有任何步骤?



还有一个问题: / p>

此搜索算法是否适用于任何PDF(简单和格式化的pdf)。

解决方案

您必须使用 pdf.h

的定义

  #if __cplusplus 
externC{
#endif

NSString * convertPDF(NSString * pathToFile);

#if __cplusplus
}
#endif

也可在实作文件中使用* pdf.m

  #if __cplusplus 
externC{
#endif
$ b b NSString * convertPDF(NSString * pathToFile);

#if __cplusplus
} // Extern C
#endif


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

解决方案

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

这篇关于使用objective-c从lib中提取文本(libz.dylib)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆