Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to print contents of Rich Text Box in VB.NET? Is it easy?
Posted

See this walkthrough article:
http://support.microsoft.com/kb/811401/en-us[^]
or alternatively also this article from the MSDN:
http://msdn.microsoft.com/en-us/library/ms996492.aspx[^]
 
Share this answer
 
v2
Comments
Member 13658956 26-Oct-20 6:00am    
Private Sub cmdOK_Click()

'Set Orientation
'================

'If rbOrientation(0).Value = True Then
' Printer.Orientation = 1
'Else
' Printer.Orientation = 2
'End If

'Set Paper Size
'================

Dim lPaperCount As Long
Dim iNumPaper() As Integer
Dim iPaperSelected As Integer

' Get count of paper sizes supported by active printer.
lPaperCount = DeviceCapabilities(Printer.DeviceName, Printer.Port, _
DC_PAPERS, ByVal vbNullString, 0)

ReDim iNumPaper(1 To lPaperCount)

'Get papers supported
lPaperCount = DeviceCapabilities(Printer.DeviceName, Printer.Port, _
DC_PAPERS, iNumPaper(1), 0)
iPaperSelected = cbSize.ListIndex + 1
Printer.PaperSize = iNumPaper(iPaperSelected)
'Set Paper Bin
'================

Dim dwbins As Long
Dim numBin() As Integer
Dim iBinSelected As Integer

'Get count of bins supported
dwbins = DeviceCapabilities(Printer.DeviceName, Printer.Port, _
DC_BINS, ByVal vbNullString, 0)
If dwbins <> -1 Then
ReDim numBin(1 To dwbins)
'Get bins supported
dwbins = DeviceCapabilities(Printer.DeviceName, Printer.Port, _
DC_BINS, numBin(1), 0)
iBinSelected = cbSource.ListIndex + 1
Printer.PaperBin = numBin(iBinSelected)
End If
MsgBox "Page Size: " & Format(Printer.Width / 1440, "#0.0") & _
" x " & Format(Printer.Height / 1440, "#0.0")
'================



If Option1.Value = True Then
Printer.FontName = "Draft 10cpi"
Else
Printer.FontName = "Courier New"
End If

Printer.PrintQuality = vbPRPQDraft

'//Printer.ColorMode = vbPRCMMonochrome
'//Printer.ScaleMode = vbCharacters

Printer.Print Rtf.Text

Printer.EndDoc
Printer.KillDoc
End Sub
01. if i print epson printer this code fast dos printing but tvs 240 not print in draft mode fast ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900