Christoph Zwerschke wrote:
> marcelo ametller wrote:
> 
>> I have a servlet, with a form, a button with label "generate".
>> When the user press the button, de "action" run a function, it generate
>> a pdf (reportlab).
>> When the pdf have 200 items, that's ok. But when the pdf have 6000
>> items, the appserver crash. The dmesg inform that there isn't memory...
> 
> 
> Does this crash immediately after you start the appserver and generate
> the very first pdf? Or does it only happen after some time when more
> users have been on the server?

it only crash after some time... the time for generate de pdf is 20min.

> 
> What do you get in the Webware logfile?
nothing...


> 
> Do you create the pdf in memory only or do you write it to a file?
i not know that...
i paste de code here:

action for the botton:

        def generar(self):              
                fecha1=self.form.field('fecha1').value()
                fecha2=self.form.field('fecha2').value()
                
                self.session().setValue('fecha1', fecha1)
                self.session().setValue('fecha2', fecha2)               
                url='/menu/fac/inf/v/libFactR1'
                self.response().sendRedirect(url)
                self.writeBody()        

part of the servlet:

def writeHTML(self):
                req=self.request()              
                self.fecha1=self.session().value('fecha1')
                self.fecha2=self.session().value('fecha2')
                self.empresa = empresa.nombre   
                self.titulo = "Resumen Libro Facturacion - Facturas generadas 
entre %s
- %s" % (self.fecha1,self.fecha2)

                fact= Fact1()
                #consulta sql (return 6000 regs for 10 columns)
                self.listado= fact.lisLibFactR1(self.fecha1,self.fecha2)
                
                buffer=StringIO()
                doc = SimpleDocTemplate(buffer,pagesize=A4,leftMargin=3*cm)
                doc.setTitle=self.titulo
                doc.setAuthor='operador'
                
                Story = []
                data=self.listado       
                colwidths=(10*cm,2*cm)
                t=Table( data, colwidths)
                t.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),'MIDDLE'),       
                                
('GRID',(0,0),(-1,-1),  0,colors.grey),                                         
('BOX', (0,0), (-1,-1),
1, colors.black),                                               ]))

                Story.append(t)
                Story.append(Spacer(1,0.2*cm))
                        
                doc.build(Story, onFirstPage=self.myFirstPage,
onLaterPages=self.myLaterPages)
                pdf=buffer.getvalue()
                buffer.close()
                
                self.response().setHeader('Content-Type', 'application/pdf')
                self.response().setHeader('Content-Length', str(len(pdf)))
                self.response().setHeader('Content-Disposition', 'inline;
filename="ReslibFact.pdf"')
                self.write(pdf)


thanks for you time...

Marcelo



-------------------------------------------------------
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://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to