Respuesta: imprimir con el PRINTDOCUMENT en vb.net HOLA AMIGO TE DEJO ESE CÓDIGO TALVEZ E SIRVA...
HASTA LUEGO QUE DIOS TE BENDIGA"
Imports System
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Printing
Imports System.IO
Private WithEvents pdoc As New PrintDocument()
Private Sub FrmFacturaXMonitor_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If WPActualizar = True Then
WPActualizar = False
FacturasPreImpresas()
Dim Dialog As New PrintDialog()
Dialog.Document = pdoc
pdoc.Print()
End If
End Sub
Private Sub pdoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pdoc.PrintPage
Dim oSrv1 As SIFAC.Datos = New SIFAC.DatosSQLServer("DBSERVER")
Dim MyLetraNormal As New Font("Microsoft Fast Draft", 10)
Dim MyLetraChiquita As New Font("Microsoft Fast Draft", 8)
Dim MyDiasVista As Integer = 0
Dim MySerieFactura As String = MyPubSerie
Dim MyNoFactura As Integer = MyPubFactura
Dim MyFechaValida = oSrv1.TraerDataSet("Fecha_Emision_TxD".Tables(0).R ows(0).Item("Fecha_Emision"))
Dim MyDiaFactura As Integer = Microsoft.VisualBasic.Left(MyFechaValida, 2)
Dim MyMesFactura = Date.Today.Month
Dim MyAñofactura As Integer = Microsoft.VisualBasic.Right(MyFechaValida, 4)
Dim MyNombres As String = TextBox4.Text
Dim MyDireccion As String = TextBox6.Text
Dim MyNit As String = TextBox11.Text
Dim MyDetalle As String = TextBox10.Text
Dim MyValorInicial = FormatCurrency(TextBox5.Text)
Dim MyDescuento = FormatCurrency(TextBox8.Text)
Dim MyGranTotal = FormatCurrency(TextBox9.Text)
Dim MyLetras = Val_let(MyGranTotal, "m", "S"
Dim MyCantidadEnLetras As String = MyLetras
Dim MyDiaPago As Date = Date.Today
Dim MyPrincipia As Date = Date.Today
e.Graphics.DrawString(MySerieFactura, MyLetraNormal, Brushes.Black, 300, 40)
e.Graphics.DrawString(MyNoFactura, MyLetraNormal, Brushes.Black, 360, 40)
e.Graphics.DrawString(MyDiasVista, MyLetraNormal, Brushes.Black, 340, 70)
e.Graphics.DrawString(MyDiaFactura, MyLetraNormal, Brushes.Black, 570, 120)
e.Graphics.DrawString(MyMesFactura, MyLetraNormal, Brushes.Black, 630, 120)
e.Graphics.DrawString(MyAñofactura, MyLetraNormal, Brushes.Black, 690, 120)
e.Graphics.DrawString(MyNombres, MyLetraNormal, Brushes.Black, 100, 185)
e.Graphics.DrawString(MyDireccion, MyLetraChiquita, Brushes.Black, 100, 220)
e.Graphics.DrawString(MyNit, MyLetraNormal, Brushes.Black, 570, 220)
e.Graphics.DrawString(MyDetalle, MyLetraNormal, Brushes.Black, 50, 300)
e.Graphics.DrawString(MyValorInicial, MyLetraNormal, Brushes.Black, 610, 300)
If MyDescuento > 0 Then
e.Graphics.DrawString(MyDescuento, MyLetraNormal, Brushes.Black, 610, 470)
End If
e.Graphics.DrawString(MyCantidadEnLetras, MyLetraChiquita, Brushes.Black, 50, 500)
e.Graphics.DrawString(MyGranTotal, MyLetraNormal, Brushes.Black, 610, 500)
e.Graphics.DrawString(MyDiaPago, MyLetraNormal, Brushes.Black, 220, 530)
e.Graphics.DrawString(MyPrincipia, MyLetraNormal, Brushes.Black, 570, 530)
Dim mydatos() As Object = {MyPubSerie, MyPubFactura} |