Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Generating editable PDF forms
    #28824

    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

    <%@ taglib uri="https://pd4ml.com/tlds/pd4ml/2.6" prefix="pd4ml" %><%@page
    contentType="text/html; charset=ISO8859_1"%><pd4ml:transform
    screenWidth="300"
    pageFormat="A5"
    pageOrientation="landscape"
    pageInsets="100,100,100,100,points"
    enableImageSplit="false"
    generatePdfForms="true"
    enable="true">
    <html>
    <head>
    <title>pd4ml test</title>
    <style type="text/css">
    body {
    color: #000000;
    background-color: #FFFFFF;
    font-family: Tahoma, "Sans-Serif";
    font-size: 10pt;
    }
    </style>
    </head>
    <body>
    
    <form action="fdf.jsp" method=get name=test>
    <table border=0>
    <tr>
    <td>Field 1:</td><td><input name=field1></td>
    </tr>
    <tr>
    <td>Field 2:</td><td><input name=field2></td>
    </tr>
    <tr>
    <td>Popup message:</td><td><input type=checkbox name=status value=ON></td>
    </tr>
    <tr>
    <td>Result:</td><td><input name=result readonly></td>
    </tr>
    <tr>
    <td> </td><td><input type=submit value=ADD></td>
    </tr>
    </table>
    </form>
    
    </body>
    </html>
    </pd4ml:transform>

    my servlet code:

    import java.io.IOException;
    
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    
    public class CreatePdfForm extends HttpServlet {
    
    private static final long serialVersionUID = -8263771044288468617L;
    
    /**
    * Constructor of the object.
    */
    public CreatePdfForm() {
    super();
    }
    
    /**
    * Destruction of the servlet. <br>
    */
    public void destroy() {
    super.destroy();
    }
    
    /**
    * The doGet method of the servlet. <br>
    *
    * This method is called when a form has its tag value method equals to get.
    *
    * @param request the request send by the client to the server
    * @param response the response send by the server to the client
    * @throws ServletException if an error occurred
    * @throws IOException if an error occurred
    */
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
    ServletContext app = getServletContext();
    
    RequestDispatcher dispatcher = app.getRequestDispatcher("/jsp/form.jsp");
    
    dispatcher.forward(request, response);
    }
    
    /**
    * The doPost method of the servlet. <br>
    *
    * This method is called when a form has its tag value method equals to post.
    *
    * @param request the request send by the client to the server
    * @param response the response send by the server to the client
    * @throws ServletException if an error occurred
    * @throws IOException if an error occurred
    */
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
    }
    
    }

    my web.xml :

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name></display-name>
    <servlet>
    <servlet-name>CreatePdfFormPage</servlet-name>
    <servlet-class>CreatePdfForm</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>CreatePdfFormPage</servlet-name>
    <url-pattern>/CreatePdfFormPage</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <jsp-config>
    <taglib>
    <taglib-uri>/pd4ml</taglib-uri>
    <taglib-location>/WEB-INF/tlds/pd4ml.tld</taglib-location>
    </taglib>
    </jsp-config>
    </web-app>
    

Viewing 1 post (of 1 total)