Check if the PdfPainter destructor is called due to an exception before, so wrap everything else into a try catch block. Maybe you need also a newer PoDoFo version. The newest SVN version contains a fix so that no exceptions are thrown in the PdfPainter destructor.
On Thu, Sep 22, 2011 at 5:46 PM, [email protected] <[email protected]> wrote: > Hello i write this: > using namespace PoDoFo; > PdfStreamedDocument documento(nomefile.toStdString().c_str()); > PdfPage *pPagina; > PdfPainterMM painter; > PdfFont *pFont; > pPagina = documento.CreatePage(PdfPage::CreateStandardPageSize > (ePdfPageSize_A4,true)); > painter.SetPage((pPagina)); > pFont = documento.CreateFont("Arial"); > pFont->SetFontSize(12); > painter.SetFont(pFont); > QString cliente; > cliente = ui->plainTextEdit_2->toPlainText(); > int x, y; > x = 10000; > y = 200000; > QStringList lista_cliente; > lista_cliente = cliente.split("\n"); > painter.DrawTextMM(10000,200000,"To:"); > x = 20000; > if (lista_cliente.count()>0){ > for (int t=0; t < lista_cliente.count();t++){ > painter.DrawTextMM(x,y,lista_cliente[t].toStdString().c_str()); > y = y-4000; > } > } > else { > painter.DrawTextMM(x,y,cliente.toStdString().c_str()); > y = y-4000; > } > QString or_num; > or_num = ui->plainTextEdit_3->toPlainText(); > QStringList lista_ordine; > lista_ordine = or_num.split("\n"); > x = 10000; > painter.DrawTextMM(x,y,"Order Number:"); > x = 45000; > if (lista_ordine.count()>0){ > for (int tt=0; tt < lista_ordine.count();tt++){ > painter.DrawTextMM(x,y,lista_ordine[tt].toStdString().c_str()); > y = y-4000; > } > } > else { > painter.DrawTextMM(x,y,or_num.toStdString().c_str()); > y = y-4000; > } > x= 10000; > QString note; > note = ui->plainTextEdit->toPlainText(); > QStringList lista_note; > lista_note = note.split("\n"); > painter.DrawTextMM(x,y,"Note:"); > x = 25000; > if (lista_note.count()>0){ > for (int ttt = 0; ttt<lista_note.count();ttt++){ > painter.DrawTextMM(x,y,lista_note[ttt].toStdString().c_str()); > y = y-4000; > } > } > else { > painter.DrawTextMM(x,y,note.toStdString().c_str()); > y = y-4000; > } > PdfTable tabella(9,ui->tableWidget->rowCount()+2); > PdfSimpleTableModel modello(9,ui->tableWidget->rowCount()+2); > PdfSimpleTableModel *pmodello = &modello; > QStringList lista_tab; > lista_tab<<"Package"<<"Dimension"<<"Net"<<"Gross"<<"Q.ty"<<"Description"<<" > Detailed"<<"Lot"<<"Id"; > for (int a=0; a<lista_tab.count();a++){ > modello.SetText(0,a,lista_tab[a].toStdString().c_str()); > } > QStringList lista_tab_rdue; > lista_tab_rdue<<"Q.ty"<<"cm"<<"Wt.Kg"<<"Wt.Kg"<<" "<<" "<<"Packing"<<"N." > <<"Packages"; > for (int aa=0;aa<lista_tab_rdue.count();aa++){ > modello.SetText(1,aa,lista_tab_rdue[aa].toStdString().c_str()); > } > for (int b=0;b< ui->tableWidget->rowCount();b++){ > for (int c = 0; c<ui->tableWidget->columnCount();c++){ > QString valore; > if (c !=5){ > valore = ui->tableWidget->item(b,c)->text(); > modello.SetText(c,b+2,valore.toStdString().c_str()); > } > else { > QString valore_one; > valore_one = selezionati[b]; > modello.SetText(c,b+2,valore_one.toStdString().c_str()); > } > } > } > tabella.SetModel(pmodello); > PdfRect rettangolo(10,10,150,150); > PdfPainterMM *ppainter = &painter; > tabella.Draw(10000,195000,ppainter,rettangolo); > painter.FinishPage(); > documento.Close(); > > But i get this error: > PdfPainter::~PdfPainter(): FinishPage() has to be called after a page is > completed!packing_NSW: /home/luca/Scrivania/Luca/Pacchetti_C++/podofo-0.9.0 > /src/doc/PdfPainter.cpp:105: virtual PoDoFo::PdfPainter::~PdfPainter(): > Asserzione `!m_pCanvas' fallita. > The program has unexpectedly finished. > > Where is the error? > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Podofo-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/podofo-users > ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2 _______________________________________________ Podofo-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/podofo-users
