By Date: <-- -->
By Thread: <-- -->

Regenerate a PDF file form ServletInputStream.



Hi Bruno,
Thank you for your reply quickly,
The "regenerate" term maybe make you confuse. My problem is described below:
The PDF form is submitted to Tomcat server with PDF format, and i used the ServletInputStream (javax.servlet. to gererate the PDF file from PDF client. This is my code:
 
protected void doPost(HttpServletRequest request, HttpServletResponse response)
   throws ServletException, IOException {
   PrintFDF(request, response, "POST");
 }
 public void makePdf(HttpServletRequest request, HttpServletResponse response, String methodGetPost)
  throws ServletException, IOException {
  try {
   File tempFile = new File("c:\\test.pdf");
      FileOutputStream fout = new FileOutputStream(tempFile);
      BufferedInputStream bin = new BufferedInputStream(request.getInputStream());
      BufferedOutputStream bout = new BufferedOutputStream(fout);
      byte[] buf = new byte[8 * 1024];
      int len;
      while ((len = bin.read(buf)) > -1) {
          bout.write(buf, 0, len);
      }
      bout.close();
      bin.close();
  } catch (Exception e2) {    }
 }
The result file (test.pdf) is different with the original file in size and version.
 
Best regard,
Tuan

Bruno Lowagie <bruno (at) lowagie.com> wrote:
Nguyen Anh Tuan wrote:
> Dear itext supporter,
> I have a strange problem when i regenerate PDF from of
> ServletInputStream: the regenerated PDF file (from tomcat server) is
> different to the original PDF (client). They is both different about
> file size and version. Please help me how to sovle the problem.

Define 'regenerate'.
If you are using PdfStamper or PdfCopy,
it is normal that the PDF changes.
br,
Bruno


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com