Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/10/2008, 04:27
Mirador
 
Fecha de Ingreso: abril-2007
Mensajes: 82
Antigüedad: 18 años
Puntos: 0
vb.2003 imprimir un html

Buenas, estoi intentando imprimir un htm que tengo situado en c:\imprimir.htm para lo que utilizo el siguiente codigo:

Código:
Private Sub prtDocument_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles prtDocument.PrintPage
        
        'Esta linea me exporta un bitmap de un objeto axMap
Me.AxMapa.ExportMap2(ESRI.MapObjects2.Core.ExportMapConstants.moExportBMP, "c:\borrame.bmp", 1)
        Dim Doc = New System.IO.StreamReader("C:\imprimir.htm")
        
        Dim linesPerPage As Single = 0
        Dim yPos As Single = 0
        Dim count As Integer = 0
        Dim leftMargin As Single = e.MarginBounds.Left
        Dim topMargin As Single = e.MarginBounds.Top
        Dim line As String = Nothing
        Dim PrintFont As Font = New Font("Arial", 10)

        linesPerPage = e.MarginBounds.Height / PrintFont.GetHeight(e.Graphics)

        While count < linesPerPage
            line = Doc.ReadLine()
            If line Is Nothing Then
                Exit While
            End If
            yPos = topMargin + count * PrintFont.GetHeight(e.Graphics)
            e.Graphics.DrawString(line, PrintFont, Brushes.Black, leftMargin, yPos, New StringFormat)
            count += 1
        End While

        If (Not line Is Nothing) Then
            e.HasMorePages = True
        Else
            e.HasMorePages = False
        End If
    End Sub
El problema, es que me imprime el codigo html y no el contenido (imagen en este caso) del html.

Espero que me puedan ayudar.

Saludos!