Hello
Thanx to zimvbcoder / sandeep mewara / HimanshuJoshi for your advice to spell the problem more specifically.
I want to use dotmatrix printer to print documents of variable size(not width but length). Depending on length of text I must adjust paper size.
MSDN suggests following
Dim pkSize As Printing.PaperSize
For i = 0 To PrintDocument1.PrinterSettings.PaperSizes.Count - 1
pkSize = PrintDocument1.PrinterSettings.PaperSizes.Item(i)
Combopapersize.Items.Add(pkSize)
Next
Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
e.PageSettings.PaperSize.Kind = Printing.PaperKind.Custom
Dim pkCustomSize1 As New Printing.PaperSize("MySize", 100, 50)
Which can be added to a combo to be selected by user.
My Problem: How to asign this size to papersize?
I tried:
e.PageSettings.PaperSize.Height = 40
e.PageSettings.PaperSize.Width = 100
which throw error that set Kind property to custom.
I tried:
PrintDocument1.PrinterSettings.PrinterName = "Epson LX-300+"
Dim psz As New Printing.PaperSize
With psz
.RawKind = Printing.PaperKind.Custom
.Width = 120
.Height = 100
PrintDocument1.DefaultPageSettings.PaperSize = psz
End With
The above code did not report error but did not work. Changing width and height values had no effect.
I want the printer to stop printing and stop spooling the paper as soon as the last line is printer.
Hope you have faced this and solved...
Expecting your valuable solution