is there some kind of limitant when itext adds an image to a pdf document?, i am making an application which uploads a GIF o JPG, and i am using itext to create a dynamic PDF to show to the users what information has entered and what image has been uploaded before all this data is saved within the BD, some images are added to the pdf document, i have tried with different sizes ,

this is the code that i made

public ActionForward toUpload(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
 {
   String destino="exito";
   UploadForm upload=(UploadForm)form;
   FormFile file = upload.getBim_imagen();

   ActionForward forward = null;
   InputStream input = null;

   try
   {
     int fileSize = file.getFileSize();
     String fileName = file.getFileName();
     System.out.println(fileName);
     input = file.getInputStream();
     FileStorageDAO dao = DAOFactory.getFileStorageDAO();
     dao.saveFile(fileName, input, fileSize,"01");

     Document doc=new Document(new Rectangle(1024,768));
     ByteArrayOutputStream out=new ByteArrayOutputStream();
     PdfWriter writer=PdfWriter.getInstance(doc,out);
     doc.open();
     /*doc.add(new Paragraph("Verificando datos del balance"));
     doc.add(new Paragraph(upload.getSer_codigo()));*/
     Image img=Image.getInstance(file.getFileData());
     //img.setAbsolutePosition(10,10);
     doc.add(img);

     doc.close();
     response.setContentType("application/pdf");
     response.setContentLength(out.size());
     out.writeTo(response.getOutputStream());
     response.getOutputStream().flush();
   }
   catch(Exception e)
   {
     System.out.println(e);
   }
   finally
   {
     if (input != null)
     {
       input.close();
     }
     file.destroy();
   }
   return mapping.findForward(destino);
 }

_________________________________________________________________
Las mejores tiendas, los precios mas bajos, entregas en todo el mundo, YupiMSN Compras: http://latam.msn.com/compras/



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to