Hallo,
ich drucke mit VB.net ein Bild aus, und dazu einen Text.
[highlight=vbnet]
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim PrintFont As Font = New System.Drawing.Font("Courier New", 11.25)
Dim gr As Graphics = e.Graphics
For Each datei As Druckuebergabe In Prints
'Verweis auf das Bild festlegen
Dim oImage As Image = Image.FromFile(datei.Path)
Dim Faktor As Double = oImage.Height / oImage.Width
Dim Bildgroesse As Integer = CInt(e.PageSettings.PrintableArea.Width - 100)
'Rechteck für den Ausdruck festlegen
'Position(+Originalgröße)
Dim p As New Point(e.PageBounds.Left + 50, e.PageBounds.Top + 100)
Dim r As New Rectangle(p.X, p.Y, Bildgroesse, CInt(Bildgroesse * Faktor))
Dim Informations() As String = frmSmartcopy.GetInformations(datei.Path)
'Bild drucken im angegebenen Rechteck drucken
gr.DrawString(" Ausdruck vom: " & Informations(0), PrintFont, Brushes.Black, p.X - 13, p.Y - 60)
gr.DrawString(" Computername: " & Informations(2), PrintFont, Brushes.Black, p.X - 13, p.Y - 45)
gr.DrawString(" Benutzername: " & Informations(1), PrintFont, Brushes.Black, p.X - 13, p.Y - 30)
r = New Rectangle(r.X, r.Y, r.Width + 1, r.Height + 1)
gr.DrawRectangle(Pens.Black, r)
gr.DrawImage(oImage, r)
gr.Dispose()
Next
End Sub[/highlight]
Der Code ist relativ schnell durchlaufen aber der Druckauftrag,
ist 1,43 MB Groß!! und außerdem dauert er 1-2 Minuten bis er gedruckt wird.
Wenn ich das Bild mit Paint ode rwas ausdruck dann hat es ein paar kb,
und dauert vll 2 Sekunden bis der Drucker druckt.
Das Bild ist ein .gif und ist 100kb groß
Weiß jemand Rat?
Grüße
ich drucke mit VB.net ein Bild aus, und dazu einen Text.
[highlight=vbnet]
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim PrintFont As Font = New System.Drawing.Font("Courier New", 11.25)
Dim gr As Graphics = e.Graphics
For Each datei As Druckuebergabe In Prints
'Verweis auf das Bild festlegen
Dim oImage As Image = Image.FromFile(datei.Path)
Dim Faktor As Double = oImage.Height / oImage.Width
Dim Bildgroesse As Integer = CInt(e.PageSettings.PrintableArea.Width - 100)
'Rechteck für den Ausdruck festlegen
'Position(+Originalgröße)
Dim p As New Point(e.PageBounds.Left + 50, e.PageBounds.Top + 100)
Dim r As New Rectangle(p.X, p.Y, Bildgroesse, CInt(Bildgroesse * Faktor))
Dim Informations() As String = frmSmartcopy.GetInformations(datei.Path)
'Bild drucken im angegebenen Rechteck drucken
gr.DrawString(" Ausdruck vom: " & Informations(0), PrintFont, Brushes.Black, p.X - 13, p.Y - 60)
gr.DrawString(" Computername: " & Informations(2), PrintFont, Brushes.Black, p.X - 13, p.Y - 45)
gr.DrawString(" Benutzername: " & Informations(1), PrintFont, Brushes.Black, p.X - 13, p.Y - 30)
r = New Rectangle(r.X, r.Y, r.Width + 1, r.Height + 1)
gr.DrawRectangle(Pens.Black, r)
gr.DrawImage(oImage, r)
gr.Dispose()
Next
End Sub[/highlight]
Der Code ist relativ schnell durchlaufen aber der Druckauftrag,
ist 1,43 MB Groß!! und außerdem dauert er 1-2 Minuten bis er gedruckt wird.
Wenn ich das Bild mit Paint ode rwas ausdruck dann hat es ein paar kb,
und dauert vll 2 Sekunden bis der Drucker druckt.
Das Bild ist ein .gif und ist 100kb groß
Weiß jemand Rat?
Grüße
Comment