HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › General questions / FAQ › Generating editable PDF forms › Re: Re: Generating editable PDF forms
Hi,
Sorry to bring back this old topic, but i used the tutorial from pd4ml-html-css-pdf-tips-tricks-f7/pdf-forms-t422.html .
My generated PDF form isn’t editable. The input are drawn in the PDF, but i can’t interact with the field. I get the same result with or without using the attributes generatePdfForms=”true” and enable=”true”.
form.jsp
<br />
<br />
<%@ taglib uri="http://pd4ml.com/tlds/pd4ml/2.6" prefix="pd4ml" %><%@page<br />
contentType="text/html; charset=ISO8859_1"%><pd4ml:transform<br />
screenWidth="300"<br />
pageFormat="A5"<br />
pageOrientation="landscape"<br />
pageInsets="100,100,100,100,points"<br />
enableImageSplit="false"<br />
generatePdfForms="true"<br />
enable="true"><br />
<html><br />
<head><br />
<title>pd4ml test</title><br />
<style type="text/css"><br />
body {<br />
color: #000000;<br />
background-color: #FFFFFF;<br />
font-family: Tahoma, "Sans-Serif";<br />
font-size: 10pt;<br />
}<br />
</style><br />
</head><br />
<body><br />
<br />
<form action="fdf.jsp" method=get name=test><br />
<table border=0><br />
<tr><br />
<td>Field 1:</td><td><input name=field1></td><br />
</tr><br />
<tr><br />
<td>Field 2:</td><td><input name=field2></td><br />
</tr><br />
<tr><br />
<td>Popup message:</td><td><input type=checkbox name=status value=ON></td><br />
</tr><br />
<tr><br />
<td>Result:</td><td><input name=result readonly></td><br />
</tr><br />
<tr><br />
<td> </td><td><input type=submit value=ADD></td><br />
</tr><br />
</table><br />
</form><br />
<br />
</body><br />
</html><br />
</pd4ml:transform><br />
<br />
my servlet code:
<br />
import java.io.IOException;<br />
<br />
import javax.servlet.RequestDispatcher;<br />
import javax.servlet.ServletContext;<br />
import javax.servlet.ServletException;<br />
import javax.servlet.http.HttpServlet;<br />
import javax.servlet.http.HttpServletRequest;<br />
import javax.servlet.http.HttpServletResponse;<br />
<br />
<br />
public class CreatePdfForm extends HttpServlet {<br />
<br />
private static final long serialVersionUID = -8263771044288468617L;<br />
<br />
/**<br />
* Constructor of the object.<br />
*/<br />
public CreatePdfForm() {<br />
super();<br />
}<br />
<br />
/**<br />
* Destruction of the servlet. <br><br />
*/<br />
public void destroy() {<br />
super.destroy();<br />
}<br />
<br />
/**<br />
* The doGet method of the servlet. <br><br />
*<br />
* This method is called when a form has its tag value method equals to get.<br />
*<br />
* @param request the request send by the client to the server<br />
* @param response the response send by the server to the client<br />
* @throws ServletException if an error occurred<br />
* @throws IOException if an error occurred<br />
*/<br />
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<br />
<br />
ServletContext app = getServletContext();<br />
<br />
RequestDispatcher dispatcher = app.getRequestDispatcher("/jsp/form.jsp");<br />
<br />
dispatcher.forward(request, response);<br />
}<br />
<br />
/**<br />
* The doPost method of the servlet. <br><br />
*<br />
* This method is called when a form has its tag value method equals to post.<br />
*<br />
* @param request the request send by the client to the server<br />
* @param response the response send by the server to the client<br />
* @throws ServletException if an error occurred<br />
* @throws IOException if an error occurred<br />
*/<br />
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<br />
<br />
}<br />
<br />
}<br />
<br />
my web.xml :
<br />
<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<web-app version="3.0"<br />
xmlns="http://java.sun.com/xml/ns/javaee"<br />
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee<br />
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"><br />
<display-name></display-name><br />
<servlet><br />
<servlet-name>CreatePdfFormPage</servlet-name><br />
<servlet-class>CreatePdfForm</servlet-class><br />
</servlet><br />
<servlet-mapping><br />
<servlet-name>CreatePdfFormPage</servlet-name><br />
<url-pattern>/CreatePdfFormPage</url-pattern><br />
</servlet-mapping><br />
<welcome-file-list><br />
<welcome-file>index.jsp</welcome-file><br />
</welcome-file-list><br />
<jsp-config><br />
<taglib><br />
<taglib-uri>/pd4ml</taglib-uri><br />
<taglib-location>/WEB-INF/tlds/pd4ml.tld</taglib-location><br />
</taglib><br />
</jsp-config><br />
</web-app><br />
<br />
<br />