我有一個要求,用戶要在pdf表單上填寫很多字段(文本字段,複選框,單選按鈕),他們會發郵件給我們。我需要閱讀PDF格式的每個字段並插入到Oracle表中。如何閱讀使用Java的pdf表單字段?
編輯1:我想下面的代碼,它生成的PDF,但當我雙擊它說「無效的格式」。怎麼了 ?
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.PdfWriter;
public class pdfGentest{
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter.getInstance(document, new FileOutputStream("c:\\HelloWorld.pdf"));
document.open();
document.add(new Paragraph("Hello World"));
}
catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
}
}
修正:由於我沒有關閉document..Adding document.close();修復了問題
謝謝微星,我沒有看到任何java文檔。他們只列出罐子。你知道他們是否提供文件? – Rishi 2010-09-09 01:42:27
感謝微星..看起來不錯.. – Rishi 2010-09-09 01:52:06
嘿MSI,我有一個問題..比方說,客戶端正在創建文本框,複選框和其他領域的PDF和發送給我們。我們如何知道字段名稱?我假設編碼時,我們需要知道字段名稱來處理這些字段? – Rishi 2010-09-09 02:30:11