Printing on a Custom Paper Size

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
 
A

Anne DeBlois

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top