Converter1.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title of document</title>
</head>
<body>
<h1>Hello World</h1>
<b>Name:</b>
<input type="text" name="usrname" ></input>
</body>
</html>
Converter.java
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.xhtmlrenderer.pdf.ITextRenderer;
import com.lowagie.text.DocumentException;
public class Convertor {
public static void main(
String[] args) throws IOException,
DocumentException {
String inputFile = "C:/Documents and Settings/ADMIN/workspace/Html_to_PDF/WebContent/Converter1.xhtml";
String url = new File(inputFile).toURI().toURL().toString();
String outputFile = "C:/Documents and Settings/All Users/Desktop/Converted.pdf";
OutputStream os = new FileOutputStream(outputFile);
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(url);
renderer.layout();
renderer.createPDF(os);
os.close();
}
}
I have use this example for creating PDF (example is available in internet) but textbox part doesn't appear. So, help me how to create the textbox in PDF for entering the data and also tell me how to save this PDF (I have use online passport application so i'm trying to built PDF as like passport application).