By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,550 Members | 908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,550 IT Pros & Developers. It's quick & easy.

PaperSource setting in VB.NET Print Application

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
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

Nov 20 '05 #2

P: n/a
CJ:

Thanks very much for your help - I will study this code intently!

Thanks,

Fred
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...
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

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
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


Nov 20 '05 #3

P: n/a
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
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...
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

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
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


Nov 20 '05 #4

P: n/a
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" <fr**@smartybird.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...
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

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
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



Nov 20 '05 #5

P: n/a
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" <no****@blowgoats.com> wrote in message
news:10************@corp.supernews.com...
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" <fr**@smartybird.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...
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

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
> 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
>
>



Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.