Do each form separately flattened. Assemble the forms with PdfCopy.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: jpatil [SMTP:[EMAIL PROTECTED]
> Sent: Thursday, October 16, 2003 2:36
> To:   [EMAIL PROTECTED]
> Subject:      [iText-questions] Multipage PDF generation in Servlet..
> 
> Hi,
> We have number of PDF forms. All of them are one page which can be
> assembled
> to create the result PDF.
> 
> Based on the httprequest, my J2EE application
> A.> Determine which forms need to be in result PDF
> B. > need to fetch the data
> C.> Populate the data in the forms and then return the PDF as a
> httpresponse.
> 
> These are not data entry forms. They just functions as a static template
> with fillable dynamic data.
> 
> Up until now I could generate a single page PDF using the stamper class;
> but
> I am unlucky to generate the multipage PDF.
> 
> Any examples/samples of servlet/server code to generate multipage PDF will
> be highly appriciated.
> 
> Thank You,
> 
> FYI.
> 
> Single Page PDf generation Servlet code
> 
> import java.io.*;
> 
> import java.util.*;
> 
> import javax.servlet.*;
> 
> import javax.servlet.http.*;
> 
> import java.net.URL;
> 
> import com.lowagie.text.*;
> 
> import com.lowagie.text.pdf.*;
> 
> public class FlatPDFServlet extends HttpServlet {
> 
>     public void doPost(HttpServletRequest req, HttpServletResponse res)
> throws IOException, ServletException {
> 
>     Enumeration paramNames = req.getParameterNames();
> 
>     String paramValue, paramName;
> 
>     try {
> 
>                 URL pdfurl = new
> URL("http://localhost:9080/PDFGeneration/PDFs/HTMLtoPDF.pdf";);
> 
>                 PdfReader reader = new PdfReader(pdfurl);
> 
>                 PdfStamper stamp = new PdfStamper(reader,
> res.getOutputStream());
> 
>                 stamp.setFormFlattening(true);
> 
>                 AcroFields form = stamp.getAcroFields();
> 
>                 while(paramNames.hasMoreElements()) {
> 
>                             paramName = (String)paramNames.nextElement();
> 
>                             paramValue = req.getParameter(paramName);
> 
>                             form.setField(paramName, paramValue);
> 
>                 }
> 
>         stamp.close();
> 
>         } catch (Exception e) {e.printStackTrace();}
> 
>     } /* End of doPost */
> 
> }
> 
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> SourceForge.net hosts over 70,000 Open Source Projects.
> See the people who have HELPED US provide better services:
> Click here: http://sourceforge.net/supporters.php
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to