PaperSource setting in VB.NET Print Application

  • Thread starter Thread starter Fred Nelson
  • Start date Start date
F

Fred Nelson

Hi:

I'm trying to write a program that will print envelopes using a HP Laserjet
4 that has three trays. In the future this program will work with other
printers so I don't want to "hard code" (or send raw output) to accomplish
this.

I'm trying to figure out how to set the PaperSource property and haven't had
any luck! I've searched MSDN and Google and can't find a single example.

If anyone knows how to do this I would GREATLY appreciate it - I've tried
everything!

Thanks,

Fred
 
It's really really confusing... here are some samples... ignroe the
iPrinterType (this is something that I use specifically in the program. but
you actually have to check for the enumeration type and set it to that based
on the printers availiblity.

for Each papSource In _printDoc.PrinterSettings.PaperSources

If papSource.Kind = Printing.PaperSourceKind.AutomaticFeed Then

_printDoc.DefaultPageSettings.PaperSource = papSource

Exit For

End If

Next

If (iPrintertype = 0) Then

For Each papSize In _printDoc.PrinterSettings.PaperSizes

If papSize.Kind = Printing.PaperKind.Letter Then

_printDoc.DefaultPageSettings.PaperSize = papSize

Exit For

End If

Next

ElseIf (iPrintertype = 1) Then

For Each papSize In _printDoc.PrinterSettings.PaperSizes

If papSize.Kind = Printing.PaperKind.Ledger Or papSize.Kind =
Printing.PaperKind.Standard11x17 Then

_printDoc.DefaultPageSettings.PaperSize = papSize

Exit For

End If

Next

End If
 
CJ:

Thanks again for your help. If you have a second could you check to see if
I have this set up correctly (I'm not in the office with the 3 tray printer
or I'd test it.)

If I needed to print a document to an envelope then I would perform the
following AFTER selecting the printer:

--------------
Dim papSource As System.Drawing.Printing.PaperSource

For Each papSource In PrintDocument1.PrinterSettings.PaperSources

If papSource.Kind = PaperSourceKind.Envelope Then
PrintDocument1.DefaultPageSettings.PaperSource = papSource
Exit For
End If

Next
------------

If the user had selected a printer without an envelope feeder then it would
just default to the main tray - that is what I want it to do.

Am I correct or still missing something!

Thanks,

Fred
 
I tested mine on a 5 feeder tray printer and set my paper source to
automatic feeder, and then my paper SIZE to the envelope. Honestly, who has
an envelope feeder anymore?

Thats right... no one...

[expect many replies of 'we use one']

So, set your paper size, your feeder (esepically if its pro/copier/printer
super machine like it sounds like with 3 trays) will take care of the rest.

Thats what I did at least. =)

-CJ
 
CJ:

Thanks again for all the help. I don't have one of them here however I have
a customer with two rather large printers so I will need to road test it
with their stuff.

Fred

CJ Taylor said:
I tested mine on a 5 feeder tray printer and set my paper source to
automatic feeder, and then my paper SIZE to the envelope. Honestly, who has
an envelope feeder anymore?

Thats right... no one...

[expect many replies of 'we use one']

So, set your paper size, your feeder (esepically if its pro/copier/printer
super machine like it sounds like with 3 trays) will take care of the rest.

Thats what I did at least. =)

-CJ
Fred Nelson said:
CJ:

Thanks again for your help. If you have a second could you check to see if
I have this set up correctly (I'm not in the office with the 3 tray printer
or I'd test it.)

If I needed to print a document to an envelope then I would perform the
following AFTER selecting the printer:

--------------
Dim papSource As System.Drawing.Printing.PaperSource

For Each papSource In PrintDocument1.PrinterSettings.PaperSources

If papSource.Kind = PaperSourceKind.Envelope Then
PrintDocument1.DefaultPageSettings.PaperSource = papSource
Exit For
End If

Next
------------

If the user had selected a printer without an envelope feeder then it would
just default to the main tray - that is what I want it to do.

Am I correct or still missing something!

Thanks,

Fred


program.
but
 
Back
Top