Foros del Web » Programando para Internet » ASPX (.net) »

problema imprimir documento

Estas en el tema de problema imprimir documento en el foro de ASPX (.net) en Foros del Web. hola, tengo que imprimir un texto (que es combinacion de varios label.text) y lo hago con el siguiente codigo, el problema , es que me ...
  #1 (permalink)  
Antiguo 04/07/2007, 09:38
 
Fecha de Ingreso: marzo-2007
Mensajes: 55
Antigüedad: 17 años, 1 mes
Puntos: 0
problema imprimir documento

hola,
tengo que imprimir un texto (que es combinacion de varios label.text) y lo hago con el siguiente codigo, el problema , es que me imprime bien en local, pero luego cuando lo cuelgo , la barra de estado se queda "pensando" todo el tiempo y no imprime...
El codigo es:

Private Sub VistaPrevia(ByVal TipoFuente As String, ByVal TamañoFuente As Byte, _
ByVal TextoImpresion As String, ByVal e As System.Drawing.Printing.PrintPageEventArgs)

Dim Fuente As New Drawing.Font(TipoFuente, TamañoFuente)
Dim AreaImpresion_Alto, AreaImpresion_Ancho, MargenIzquierdo, MargenSuperior As Integer

With Me.PrintDocument1.DefaultPageSettings
'Area Neta de Impresion (se descuenta los margenes)
AreaImpresion_Alto = .PaperSize.Height - .Margins.Top - .Margins.Bottom
AreaImpresion_Ancho = .PaperSize.Width - .Margins.Left - .Margins.Right
MargenIzquierdo = .Margins.Left
MargenSuperior = .Margins.Top

'Verificar si se ha elegido el modo horizontal
If .Landscape Then
Dim NroTemp As Integer
NroTemp = AreaImpresion_Alto
AreaImpresion_Alto = AreaImpresion_Ancho
AreaImpresion_Ancho = NroTemp
End If
Dim Formato As New Drawing.StringFormat(Drawing.StringFormatFlags.Lin eLimit)
Dim Rectangulo As New Drawing.RectangleF(MargenIzquierdo, MargenSuperior, _
AreaImpresion_Ancho, AreaImpresion_Alto)
Dim NroLineasImpresion As Integer = CInt(AreaImpresion_Alto / Fuente.Height)
Dim NroLineasRelleno, NroLetrasLinea As Integer
Static CaracterActual As Integer

e.Graphics.MeasureString(Mid(texto, +1), Fuente, _
New Drawing.SizeF(AreaImpresion_Ancho, AreaImpresion_Alto), Formato, NroLetrasLinea, _
NroLineasRelleno)
e.Graphics.DrawString(Mid(TextoImpresion, CaracterActual + 1), Fuente, _
Drawing.Brushes.Black, Rectangulo, Formato)
CaracterActual += NroLetrasLinea
If CaracterActual < TextoImpresion.Length Then
e.HasMorePages = True
Else
e.HasMorePages = False
CaracterActual = 0
End If
End With

End Sub


'PrintDocument.PrintPage (Evento): Se produce cuando se necesita el
'resultado que se va a imprimir para la página actual.

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, _
ByVal e As System.Drawing.Printing.PrintPageEventArgs) _
Handles PrintDocument1.PrintPage
texto = "TEXTO DE HOY DIA: " & Calendar1.SelectedDate.ToShortDateString & vbCrLf & vbCrLf & Label3.Text & vbCrLf & vbCrLf & Label1.Text & vbCrLf & vbCrLf & "COMENTARIO DEL TEXTO:" & vbCrLf & vbCrLf & Label2.Text & vbCrLf & vbCrLf & Label4.Text
VistaPrevia("Tahoma", 11, texto, e)

End Sub


'Es aquí donde se pone en marcha la impresión del documento.
Protected Sub ibPrint_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibPrint.Click

Dim PrintDocument1 As New PrintDocument
' Dim PrintDialog1 As PrintDialog
'PrintDialog1.Document = PrintDocument1
'Dim result As DialogResult = PrintDialog1.ShowDialog()
'If PrintDialog1.ShowDialog = DialogResult.OK Then
PrintDocument1.Print()
'End If
Label4.Visible = True
Label2.Visible = True
End Sub

P.D: he comentado los printdialog porque no me los reconoce al ser de windowsforms y ya digo, me imprime como yo quiero en local, pero al colgarlo nada... ¿Alguien sabe que puede pasar?
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:35.