Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RTF - Set Printer Page Margins in code
Message
From
23/08/2002 07:44:31
Aman Bains
Jaguar Computers
Jalandhar, India
 
 
To
All
General information
Forum:
Visual Basic
Category:
ActiveX controls
Title:
RTF - Set Printer Page Margins in code
Miscellaneous
Thread ID:
00692830
Message ID:
00692830
Views:
44
I am using Rich Text Box control to print a formatted letter (mail merged).
The user should be able to specify the printable area width, but the printer always picks page width from default setting.

I tried the following code:-

Private Sub cmdPrint_Click()
' The CommonDialog control is named "dlgPrint".
' The RichTextBox control is named "rtfData".

dlgPrint.Flags = cdlPDReturnDC + cdlPDNoPageNums
If rtfData.SelLength = 0 Then
dlgPrint.Flags = dlgPrint.Flags + cdlPDAllPages
Else
dlgPrint.Flags = dlgPrint.Flags + cdlPDSelection
End If

dlgPrint.ShowPrinter

Printer.PaperSize = 256 ' Custom/User defined
Printer.Width = 150
Printer.Height = 150

rtfData.SelPrint Printer.hDC ' PRINTS the Control content
End Sub

Following commands do not show any effect !!! Please HELP.
Printer.PaperSize = 256 ' Custom/User defined
Printer.Width = 150
Printer.Height = 150

Setting PaperSize in Printer dialog helps, but is too cumbersome.
I DO NOT want to use WORD Mail merging as i need to distribute the application.
I have Visual Basic 6.0 Enterprise Edition running on Windows 98.

Thanks
Aman Bains
Aman
-------
Lets fly away to the Land where there is Love & Peace
Reply
Map
View

Click here to load this message in the networking platform