我来帮你:1、我刚好做过类似的活,如果你的系统跑在wondwos下,可以考虑,使用vb写一个exe
2、可以考虑不使用jacob,写一个exe,其实vb的exe也是可以接收参数的(不懂可以问我)
3、参照一下代码,将exe整合到java里面去:(不过,在在这里
String[] cmd = new String[] { PATH_TO_XPDF, "-enc", "UTF-8", "-q", filename, "-"};
Process p = Runtime.getRuntime().exec(cmd);
之后,要加一个类似的:
p.waitfor()的语句,以使exe的结果返回一个值
)
http://www-900.ibm.com/developerWorks/cn/java/l-java-tips/index.shtml
×××××××××××××××××××××××××××××××××
—————————————————— 抽取支持中文的pdf文件-xpdf————————————————
xpdf是一个开源项目,我们可以调用他的本地方法来实现抽取中文pdf文件。 下载xpdf函数包: http://www.matrix.org.cn/down_view.asp?id=15 同时需要下载支持中文的补丁包: http://www.matrix.org.cn/down_view.asp?id=16 按照readme放好中文的patch,就可以开始写调用本地方法的java程序了 下面是一个如何调用的例子:
import java.io.*;
/**
* <p>Title: pdf extraction</p>
* <p>Description: email:[email protected]</p>
* <p>Copyright: Matrix Copyright (c) 2003</p>
* <p>Company: Matrix.org.cn</p>
* @author chris
* @version 1.0,who use this example pls remain the declare
*/
public class PdfWin {
public PdfWin() {
}
public static void main(String args[]) throws Exception
{
String PATH_TO_XPDF="C:\\Program Files\\xpdf\\pdftotext.exe";
String filename="c:\\a.pdf";
String[] cmd = new String[] { PATH_TO_XPDF, "-enc", "UTF-8", "-q", filename, "-"};
Process p = Runtime.getRuntime().exec(cmd);
BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
InputStreamReader reader = new InputStreamReader(bis, "UTF-8");
StringWriter out = new StringWriter();
char [] buf = new char[10000];
int len;
while((len = reader.read(buf))>= 0) {
//out.write(buf, 0, len);
System.out.println("the length is"+len);
}
reader.close();
String ts=new String(buf);
System.out.println("the str is"+ts);
}
}good luck!!!!!
2、可以考虑不使用jacob,写一个exe,其实vb的exe也是可以接收参数的(不懂可以问我)
3、参照一下代码,将exe整合到java里面去:(不过,在在这里
String[] cmd = new String[] { PATH_TO_XPDF, "-enc", "UTF-8", "-q", filename, "-"};
Process p = Runtime.getRuntime().exec(cmd);
之后,要加一个类似的:
p.waitfor()的语句,以使exe的结果返回一个值
)
http://www-900.ibm.com/developerWorks/cn/java/l-java-tips/index.shtml
×××××××××××××××××××××××××××××××××
—————————————————— 抽取支持中文的pdf文件-xpdf————————————————
xpdf是一个开源项目,我们可以调用他的本地方法来实现抽取中文pdf文件。 下载xpdf函数包: http://www.matrix.org.cn/down_view.asp?id=15 同时需要下载支持中文的补丁包: http://www.matrix.org.cn/down_view.asp?id=16 按照readme放好中文的patch,就可以开始写调用本地方法的java程序了 下面是一个如何调用的例子:
import java.io.*;
/**
* <p>Title: pdf extraction</p>
* <p>Description: email:[email protected]</p>
* <p>Copyright: Matrix Copyright (c) 2003</p>
* <p>Company: Matrix.org.cn</p>
* @author chris
* @version 1.0,who use this example pls remain the declare
*/
public class PdfWin {
public PdfWin() {
}
public static void main(String args[]) throws Exception
{
String PATH_TO_XPDF="C:\\Program Files\\xpdf\\pdftotext.exe";
String filename="c:\\a.pdf";
String[] cmd = new String[] { PATH_TO_XPDF, "-enc", "UTF-8", "-q", filename, "-"};
Process p = Runtime.getRuntime().exec(cmd);
BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
InputStreamReader reader = new InputStreamReader(bis, "UTF-8");
StringWriter out = new StringWriter();
char [] buf = new char[10000];
int len;
while((len = reader.read(buf))>= 0) {
//out.write(buf, 0, len);
System.out.println("the length is"+len);
}
reader.close();
String ts=new String(buf);
System.out.println("the str is"+ts);
}
}good luck!!!!!
既然不是跨平台的,就写一个vb的exe好了。
vb接受参数的代码已经找出来了,请看(关键是Command$() ,一定要在这个函数中:)
Sub Main()
If Command$() = "" Then
MsgBox "Please drop a PDF file onto this application.", vbOKOnly, "PDF Extract"
Else
If Dir(Command$()) = "" Then
MsgBox "The specified file does not exist.", vbOKOnly, "File Not Found"
ElseIf UCase(Right(Command$(), 4)) <> ".PDF" Then
MsgBox "The specified file is not an Adobe Acrobat file.", vbOKOnly, "Invalid File Type"
Else
ExtractPDF (Command$())
End If
End If
End Sub
去www.cn-java.com再找点启发