Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Text

Status
Not open for further replies.

kingkeith

Programmer
May 8, 2002
18
GB
Hi. Can anyone tell me how to make the printer print plain text? I am writing a replacement for Microsoft's Notepad and I need to be able to print. I will also want to show the page setup dialog and use the settings they set there when printing. Any help would be greatly appricated.

Thanks in advance, Keith
sk_kdhall@hotmail.com
 
To print plain text, I would suggest looking at the Printer Object, and its various properties. Among them are a variety of Font settings that you can use and set according to your needs.

With respect to the Page Setup, I suggest that you take a look at the PageSetupDialog API as follows:

Private Declare Function PageSetUpDlg Lib "comdlg32.dll" Alias "PageSetupDlgA" (pPagesetupdlg As PAGESETUPDLG) As Long

You may also want to conssider using the PrintDialog API.

Private Declare Function PrintDialog Lib "comdlg32.dll" Alias "PrintDlgA" (pPrintdlg As PRINTDLG_TYPE) As Long Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Go to project/components and add the Microsoft Common Dialog control

Add a common dialog control to your form. Then use something like the following code:

Code:
Private Sub Command1_Click()
Dim a As Integer
'This shows the printer control dialog and changes default printer
CommonDialog1.PrinterDefault = True
CommonDialog1.ShowPrinter
'Replace this (which prints A to J) with your code
For a = 1 To 10
Printer.Print Chr$(64 + a)
Next
'This actually sends previous stuff to default printer
Printer.EndDoc

End Sub

Let me know if this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top