import java.io.*; import javax.servlet.ServletException; import javax.servlet.http.*; import com.justformspdf.pdf.*; public class JustFormsPDFExample02Servlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { FileInputStream fis = new FileInputStream("C:\\JustFormsPDF\\examples\\AddressForm32A2.pdf"); PDF pdf = new PDF(new PDFReader(fis)); Form form = pdf.getForm(); FormText name = (FormText) form.getElement("Name"); name.setValue("John K. Baker"); FormCheckbox addressType = (FormCheckbox) form.getElement("AddressTypePerm"); addressType.check(true); FormComboBox suffix = (FormComboBox) form.getElement("Suffix"); //suffix.setValue("5"); suffix.setValueByIndex(5); FormRadioGroup ethnic = (FormRadioGroup) form.getElement("ethnic"); //ethnic.setValue("ETH02"); ethnic.setValueByIndex(2); pdf.render(); resp.setContentType("application/pdf"); pdf.writeTo(resp.getOutputStream()); } catch (Exception e) { e.printStackTrace(); } } }