Nueva extensión: GenerarReportePDF. Agregar opción para Exportar PDF a RepIndicadorResumen.
- Se agregó nuevo paquete NuGet: iText7.pdfHTML
- Evolución de iTextSharp, reescrito desde cero. Se enfoca en separar las abstracciones de alto y bajo nivel.
- Soporte de HTML y CSS a la par de los navegadores actuales, esto genera PDFs que son casi idénticos al HTML original, algo que no era posible con iTextSharp
Más info: https://itextpdf.com/products/itext-7/convert-html-css-to-pdf-pdfhtml
https://itextpdf.com/blog/technical-notes/itext-7-and-itext-5-roadmaps-differences-updates
https://kb.itextpdf.com/home/it7kb/installation-guidelines/migration-guide-from-itext-5-to-itext-7#MigrationguidefromiText5toiText7-ConceptualAPIchanges
- Esto ocasionó que se actualizaran varias dependencias del sistema. **Tendrán que actualizar su web.config.**
- Se reescrbieron funciones de unos cuantos módulos para que usen iText7.pdfHTML, habrá que verificarlos que sigan generando los PDF correctamente.
- Estos módulos son:
Contabilidad/FiltraPolizas.aspx.vb
Contabilidad/RegPrePoliza.aspx.vb
Compras/PopUpVerFactura.aspx.vb
Ventas/ProductosServicios.aspx.vb
ClsPaginas.vb, NewGeneraBytesOC()
- Se agregó un HTML genérico con las hojas de estilo del sitio que se usará para la generación de reportes (Styles/ReportePDF.html)
+ ciertas modificaciones adicionales para hacer más estética la presentación de las tablas en el PDF
- Se arreglaron todos los archivos .refresh, el Visual Studio ya no debe mandar tantas advertencias al compilar.
- Se removió código huérfano
This commit is contained in:
@@ -5,8 +5,7 @@ Imports System.Data
|
||||
Imports System.IO
|
||||
Imports System.Xml
|
||||
Imports Extensiones
|
||||
Imports iTextSharp.text
|
||||
Imports iTextSharp.text.pdf
|
||||
Imports iText.Kernel.Pdf
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports Stimulsoft.Report
|
||||
Imports Stimulsoft.Report.Web
|
||||
@@ -185,7 +184,7 @@ Partial Class PopUpVerFactura
|
||||
End If
|
||||
|
||||
If Request("REPORTE") IsNot Nothing Then
|
||||
CType(Session("DTPDF"), HtmlTable).ExportToPDF("Reporte")
|
||||
CType(Session("DTPDF"), HtmlTable).GenerarReportePDF("Reporte")
|
||||
End If
|
||||
|
||||
'OPCIONES
|
||||
@@ -6573,47 +6572,37 @@ Partial Class PopUpVerFactura
|
||||
Dim PS As String = ""
|
||||
Dim All As Byte()
|
||||
Using ms As New MemoryStream
|
||||
Using d As New Document
|
||||
Using Copy As New PdfCopy(d, ms)
|
||||
d.Open()
|
||||
If ObjInventarios.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventarios.DtResultados IsNot Nothing Then
|
||||
For Each DetalleRow As DataRow In ObjInventarios.DtResultados.Rows
|
||||
Dim CvePS As Integer = DetalleRow.Item("CvePS").ToString.ToEntero
|
||||
Dim Lote As String = DetalleRow.Item("Lote").ToString
|
||||
Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate
|
||||
PS = String.Format("{0} - {1}", DetalleRow.Item("Codigo").ToString, DetalleRow.Item("PS").ToString)
|
||||
If Modalidad = "Individual" Then
|
||||
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
|
||||
Using pdfdoc As New PdfDocument(New PdfReader(ms))
|
||||
pdfdoc.InitializeOutlines()
|
||||
If ObjInventarios.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventarios.DtResultados IsNot Nothing Then
|
||||
For Each DetalleRow As DataRow In ObjInventarios.DtResultados.Rows
|
||||
Dim CvePS As Integer = DetalleRow.Item("CvePS").ToString.ToEntero
|
||||
Dim Lote As String = DetalleRow.Item("Lote").ToString
|
||||
Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate
|
||||
PS = String.Format("{0} - {1}", DetalleRow.Item("Codigo").ToString, DetalleRow.Item("PS").ToString)
|
||||
If Modalidad = "Individual" Then
|
||||
Dim reporteByte = New MemoryStream(GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS))
|
||||
|
||||
Dim reader As New PdfReader(reporteByte)
|
||||
Dim Paginas As Integer = reader.NumberOfPages
|
||||
Dim Contador As Integer = 0
|
||||
While Contador < Paginas
|
||||
Contador += 1
|
||||
Copy.AddPage(Copy.GetImportedPage(reader, Contador))
|
||||
End While
|
||||
Else
|
||||
Dim Cant As Integer = DetalleRow.Item("Cantidad").ToString.ToEntero - 1
|
||||
Dim docEtiqueta As New PdfDocument(New PdfReader(reporteByte))
|
||||
docEtiqueta.CopyPagesTo(1, docEtiqueta.GetNumberOfPages(), pdfdoc)
|
||||
docEtiqueta.Close()
|
||||
Else
|
||||
Dim Cant As Integer = DetalleRow.Item("Cantidad").ToString.ToEntero - 1
|
||||
|
||||
For contador As Integer = 0 To Cant
|
||||
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
|
||||
For i As Integer = 0 To Cant
|
||||
Dim reporteByte = New MemoryStream(GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS))
|
||||
|
||||
Dim reader As New PdfReader(reporteByte)
|
||||
Dim Paginas As Integer = reader.NumberOfPages
|
||||
Dim Cont As Integer = 0
|
||||
While Cont < Paginas
|
||||
Cont += 1
|
||||
Copy.AddPage(Copy.GetImportedPage(reader, Cont))
|
||||
End While
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Dim docEtiqueta As New PdfDocument(New PdfReader(reporteByte))
|
||||
docEtiqueta.CopyPagesTo(1, docEtiqueta.GetNumberOfPages(), pdfdoc)
|
||||
docEtiqueta.Close()
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
d.Close()
|
||||
End If
|
||||
pdfdoc.Close()
|
||||
|
||||
End Using
|
||||
End Using
|
||||
All = ms.ToArray()
|
||||
End Using
|
||||
@@ -6633,45 +6622,35 @@ Partial Class PopUpVerFactura
|
||||
|
||||
Dim All As Byte()
|
||||
Using ms As New MemoryStream
|
||||
Using d As New Document
|
||||
Using Copy As New PdfCopy(d, ms)
|
||||
d.Open()
|
||||
If ObjInventarios.GetExistenciasCaducidad(CvePS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveAlmacen.ToString) Then
|
||||
If ObjInventarios.DtResultados IsNot Nothing Then
|
||||
For Each DetalleRow As DataRow In ObjInventarios.DtResultados.Rows
|
||||
Dim Lote As String = DetalleRow.Item("Lote").ToString
|
||||
Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate
|
||||
If Modalidad = "Individual" Then
|
||||
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
|
||||
Using pdfdoc As New PdfDocument(New PdfReader(ms))
|
||||
pdfdoc.InitializeOutlines()
|
||||
If ObjInventarios.GetExistenciasCaducidad(CvePS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveAlmacen.ToString) Then
|
||||
If ObjInventarios.DtResultados IsNot Nothing Then
|
||||
For Each DetalleRow As DataRow In ObjInventarios.DtResultados.Rows
|
||||
Dim Lote As String = DetalleRow.Item("Lote").ToString
|
||||
Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate
|
||||
If Modalidad = "Individual" Then
|
||||
Dim reporteByte = New MemoryStream(GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS))
|
||||
|
||||
Dim reader As New PdfReader(reporteByte)
|
||||
Dim Paginas As Integer = reader.NumberOfPages
|
||||
Dim Contador As Integer = 0
|
||||
While Contador < Paginas
|
||||
Contador += 1
|
||||
Copy.AddPage(Copy.GetImportedPage(reader, Contador))
|
||||
End While
|
||||
Else
|
||||
Dim Cant As Integer = DetalleRow.Item("Cantidad").ToString.ToEntero - 1
|
||||
Dim docEtiqueta As New PdfDocument(New PdfReader(reporteByte))
|
||||
docEtiqueta.CopyPagesTo(1, docEtiqueta.GetNumberOfPages(), pdfdoc)
|
||||
docEtiqueta.Close()
|
||||
Else
|
||||
Dim Cant As Integer = DetalleRow.Item("Cantidad").ToString.ToEntero - 1
|
||||
|
||||
For contador As Integer = 0 To Cant
|
||||
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
|
||||
For i As Integer = 0 To Cant
|
||||
Dim reporteByte = New MemoryStream(GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS))
|
||||
|
||||
Dim reader As New PdfReader(reporteByte)
|
||||
Dim Paginas As Integer = reader.NumberOfPages
|
||||
Dim Cont As Integer = 0
|
||||
While Cont < Paginas
|
||||
Cont += 1
|
||||
Copy.AddPage(Copy.GetImportedPage(reader, Cont))
|
||||
End While
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Dim docEtiqueta As New PdfDocument(New PdfReader(reporteByte))
|
||||
docEtiqueta.CopyPagesTo(1, docEtiqueta.GetNumberOfPages(), pdfdoc)
|
||||
docEtiqueta.Close()
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
d.Close()
|
||||
End If
|
||||
pdfdoc.Close()
|
||||
|
||||
End Using
|
||||
End Using
|
||||
All = ms.ToArray()
|
||||
End Using
|
||||
|
||||
Reference in New Issue
Block a user