473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

PaperSource setting in VB.NET Print Application

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
5 14409
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Devesh Aggarwal | last post by:
I developed reports in Crytsal Reports 9.0 in landscape mode. When i print the same from crystal reports it prints perfectly in Landscape even if the printer setting is set to potrait by default. ...
0
by: Matthew | last post by:
on papersource.Kind... I get a string that says it's custom, what I really want is the tray id, which I see is stored in rawkind, but that's private, so I can't access it. Anyone know another way...
5
by: Maurice Mertens | last post by:
Hi all, having troubles with printing a crystal reports report to a specific tray in a printer. By means of System.Drawing.Printing.PrinterSettings.PaperSources it's possible to find out how...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
1
by: trint | last post by:
When PrinterSettings.Copies fires, I need to somehow get it to select three separate papersources...one for each of 3 defaultpagesettings.copies. PrinterSettings printerSettings = new...
0
by: Paul Fredlein | last post by:
Hi, I writing a simple label printing programme just for my own use. It needs to print in "Landscape" with the paper source from the "Multi-purpose Tray" which I want to set programatically - I...
0
by: Richard | last post by:
Some printers "tray id's" does not correspond to .NET framworks System.Drawing.Printing.PaperSourceKind enumerator, such as "hp color LaserJet 2550L". this is what the "tray id's" actually is ...
1
by: jeem | last post by:
I am using ActiveState Komodo 3.5 to work on a large python 2.4 application with an extensive UI... I am attempting to debug the application and am setting breakpoints in 4 different *.py files.....
0
by: ChrisM | last post by:
I'm using VS2003 withthe built in version of CrystalReports. I'm trying to write a module that will allow a user to send Crystal Reports directly to the printer, without using the ReportViewer....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.