Printing on a Custom Paper Size

  • Thread starter Thread starter Anne DeBlois
  • Start date Start date
A

Anne DeBlois

Hi,

I want to programatically set the paper size of a print document. I created
a class that inherits PrintDocument, so I can print some database records on
8" x 10" paper.

I added this line to my class constructor:

Dim customPaperSize As New Printing.PaperSize("8x10", 800, 1000)

But now I am looking for the proper code lines so that any instance of my
class sends the proper size information to the printer, without user
intervention. How do I do it with VB.NET (with .NET 2.0)?

Thank you in advance,

Anne
 
I noticed the following code line:

mDoc.DefaultPageSettings.PaperSize.Kind = PaperKind.Custom

But I got an error message stating that this property is readonly.

So, I can have my code behave like this:
Dim customPaperSize As New Printing.PaperSize("8x10", 800, 1000)

If mDoc.DefaultPageSettings.PaperSize.Kind = PaperKind.Custom Then
mDoc.DefaultPageSettings.PaperSize = customPaperSize
End If

But how can I change the PaperSize.Kind to Custom programmatically? I don't
want the user to worry about setting up the printer properly with the right
paper size. I only want the user to load their printer's manual feed tray
with the custom paper and then click on the Print button.

Any clue??????

Thanks in advance,

Anne
 
Back
Top