Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/07/2015, 10:49
pekas93
 
Fecha de Ingreso: febrero-2015
Mensajes: 5
Antigüedad: 9 años, 2 meses
Puntos: 0
problemas con libreria itextsharp

holaa tengo un problema al cargar un archivo pdf con la libreria itextsharp

sucede que el archivo se llena con un datatable, y se mete todo en una misma pagina y cuando le agrego otra hoja solo se corre la tabla y deja la otra hoja en blanco, dejo mi codigo para quien me pueda ayudar pliss

Dim nombre = txtnombre.Text
Dim documento As New Document(PageSize.LETTER)
Dim writerPDf = PdfWriter.GetInstance(documento, New FileStream("C:\Users\paula\Desktop\EncuestaFinal\R eportesPdf\"+NombreReporte, FileMode.Create))
documento.Open()
Dim font248 = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 24, Font.BOLD, BaseColor.BLUE)
Dim titulo As New Phrase(NombreReporte, font248)
Dim cb = writerPDf.DirectContent
Dim ct As New ColumnText(cb)
ct.SetSimpleColumn(titulo, documento.Left, 0, documento.Right, documento.Top, 24, Element.ALIGN_JUSTIFIED)
ct.Go()

Dim tabla As New PdfPTable(3)
Dim LetraTituloTabla = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12, Font.BOLDITALIC)
Dim CeldaCodigo As New PdfPCell(New Phrase("Codigo Cliente", LetraTituloTabla))
Dim CeldaNombre As New PdfPCell(New Phrase("Nombre", LetraTituloTabla))
Dim CeldaPlanta As New PdfPCell(New Phrase("Planta", LetraTituloTabla))
tabla.AddCell(CeldaCodigo)
tabla.AddCell(CeldaNombre)
tabla.AddCell(CeldaPlanta)
Dim i = 0
For Each fila As DataRow In tblEmpleado.Rows
i = i + 1
tabla.AddCell(fila.Item(0).ToString())
tabla.AddCell(fila.Item(1).ToString())
tabla.AddCell(fila.Item(2).ToString())

If i = 20 Then
documento.NewPage()
i = 0
documento.Add(New Paragraph(" "))
End If
Next
tabla.TotalWidth = 500
tabla.WriteSelectedRows(0, -1, 50, 700, writerPDf.DirectContent)
documento.Close()