I have a requirement when the user will fill in many fields (text box, check box, radio button) in pdf format, and they will send us by mail. I need to read all fields in pdf form and paste into oracle table.
Edit1: I am trying to use the following code. It generates a PDF, but when I double-click it, it says โinvalid formatโ. What's wrong?
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());
}
}
}
Fixed: Due to the fact that I did not close the document. Adding document.close (); fixed problem
source
share