471,120 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,120 software developers and data experts.

Printing on a Custom Paper Size

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
Nov 14 '06 #1
1 9540
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

"Anne DeBlois" <an*********@community.nospama écrit dans le message de
news: Ow**************@TK2MSFTNGP02.phx.gbl...
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

Nov 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Desmond | last post: by
reply views Thread by jiatiejun | last post: by
reply views Thread by Sukh | last post: by
reply views Thread by KevinM | last post: by
reply views Thread by Nickneem | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.