Resolved Direct Printing

kelum2000

New member
Joined
Oct 27, 2020
Messages
3
Programming Experience
Beginner
Hi,
I am new for vb.net. I am using 2010 on windows 7 operation system.

I need make a report and it send to directly printer.(Without Print Dialog Box). I tried it and one problem came. After give the print command printer start the printing process but black paper coming out. What is the Problem.

VB.NET:
Imports System.Drawing.Printing

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrint.Click
'Create Custom Document
PrintDocSticker.DefaultPageSettings.PaperSize = New System.Drawing.Printing.PaperSize("LblSticker", 600000, 400000)
PrintPreviewC.Document = PrintDocSticker

PrintDocSticker.Print()

End Sub

Private Sub PrintDocSticker_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocSticker.PrintPage
Dim MyRect As Rectangle

Dim LargeTitle As Font = New Drawing.Font("Arial", 14000)
Dim LargeTitleValue As Font = New Drawing.Font("Arial", 22000, FontStyle.Bold)
Dim LotNumberFont As Font = New Drawing.Font("Arial", 72000, FontStyle.Bold)
Dim BaseFont As Font = New Drawing.Font("Arial", 12000, FontStyle.Bold)
Dim BaseValueFont As Font = New Drawing.Font("Arial", 10000)
Dim BarCodeFont As Font = New Drawing.Font("Free 3 of 9 Extended", 31000)

MyRect = New Rectangle(25000, 25000, 550000, 350000)
e.Graphics.DrawRectangle(Pens.Black, MyRect)

'Count & Product
e.Graphics.DrawString("COUNT & PRODUCT :", LargeTitle, Brushes.Black, 50000, 50000)
e.Graphics.DrawString("Variable Value", LargeTitleValue, Brushes.Black, 260000, 39500)
end Sub

I am used PrintDocument and printpreviewcontrol.

Thanks and Regads.
 
Last edited by a moderator:
That's quite large numbers in your code, have you looked up the documentation to see what they mean?
 
Solution
Thank you very much. Problem solved. If you can recommend me best video series for learn vb.net I thankful to you.
 
Last edited:

Latest posts

Back
Top