Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2005

Tip: Looking for answers? Try searching our database.

PrinterSettings.PaperSource

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Todd Acheson - 28 Mar 2005 23:41 GMT
Does anyone know how to switch trays(paper source) when printing a
multi-page document?
Here is some code I have tried, but I can never get the printer to grab from
another tray during the print of a document.  If I seperate the two calls
into Page 1 and Pages 2-4, then the printer will grab from the appropriate
tray.  To do this, requires I call the objPD.Print two times.  This
seperates them in the print buffer, which we are trying to avoid doing.

Friend WithEvents objPD As System.Drawing.Printing.PrintDocument

Private Sub PrintMe()
 Dim ps As New System.Drawing.Printing.PrinterSettings
 ps.MaximumPage = 4
 ps.MinimumPage = 1
 ps.PrintRange = Printing.PrintRange.SomePages
 ps.FromPage = 1
 ps.ToPage = 4
 ps.PrinterName = printerName  'Printer name was captured eariler by user
 objPD.PrinterSettings = ps

 m_currentPrintingPage = 1
 m_lastPrintingPage = 4
 objPD.DefaultPageSettings.PaperSource =
objPD.PrinterSettings.PaperSources(1) 'goldenrod colored sheet
 objPD.Print()
End Sub

'Then in the printpage event:
Private Sub objPD_PrintPage(ByVal sender As System.Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles objPD.PrintPage
 e.HasMorePages = False

 If m_currentPrintingPage <= m_lastPrintingPage Then
   If m_currentPrintingPage = 1 Then 'first page gets a goldenrod sheet
       objPD.DefaultPageSettings.PaperSource =
objPD.PrinterSettings.PaperSources(1) 'goldenrod sheet
       e.PageSettings.PaperSource = objPD.PrinterSettings.PaperSources(1)
'goldenrod sheet
       'neither of the two above lines work, either together or seperate
   Else 'all other sheets in this document get plain white paper
       objPD.DefaultPageSettings.PaperSource =
objPD.PrinterSettings.PaperSources(5) 'White sheet
       e.PageSettings.PaperSource = objPD.PrinterSettings.PaperSources(5)
'White sheet
       'neither of the two above lines work, either together or seperate
   End If
   ReportDrawPageNET(e.Graphics) 'create the page that goes to the printer
   m_currentPrintingPage += 1
   If m_currentPrintingPage <= m_lastPrintingPage Then
       e.HasMorePages = True
   Else
       e.HasMorePages = False
   End If
   e.Graphics.Dispose()
End If
End Sub

Thanks!
Signature

Todd Acheson

Todd Acheson - 29 Mar 2005 17:43 GMT
I found my own solution

PrintDocument.QueryPageSettings Event

> Does anyone know how to switch trays(paper source) when printing a
> multi-page document?
[quoted text clipped - 54 lines]
>
> Thanks!
Todd Acheson - 29 Mar 2005 21:42 GMT
STILL NO LUCK.

Evidently, you can change some settings in the QueryPageSettings event and
the PagePrint event, but changing drawers in the printer (PaperSource) is
ignored.

Has anyone else had this problem and/or know of a workaround?

Signature

Todd Acheson

> I found my own solution
>
[quoted text clipped - 44 lines]
> > objPD.PrinterSettings.PaperSources(5) 'White sheet
> >         e.PageSettings.PaperSource =
objPD.PrinterSettings.PaperSources(5)
> > 'White sheet
> >         'neither of the two above lines work, either together or seperate
[quoted text clipped - 12 lines]
> >
> > Thanks!
Nick Malik [Microsoft] - 03 Apr 2005 00:30 GMT
before you kill yourself trying to fix this in code, make sure that the
printer driver is capable of it.  Use Word to send a three page test
document to the printer, with each of the pages coming from a different
drawer.  See what happens.  If word can do it, you should be able to, but if
word cannot, you need to update your print driver.

Sorry I'm not much help.  I just haven't done much printing in code for
about a decade.

Signature

--- Nick Malik [Microsoft]
   MCSD, CFPS, Certified Scrummaster
   http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
  I do not answer questions on behalf of my employer.  I'm just a
programmer helping programmers.
--

> STILL NO LUCK.
>
[quoted text clipped - 76 lines]
>> >
>> > Thanks!
Todd Acheson - 14 Apr 2005 21:08 GMT
Nick,
Excellent advice.
It so happens the printer I am working with does not switch drawers once a
document is sent to it.  Another printer we have which is similar but an
updated version does allow switching of drawers.  I tested in Word like you
recommended.

-Todd

Signature

Todd Acheson

> before you kill yourself trying to fix this in code, make sure that the
> printer driver is capable of it.  Use Word to send a three page test
[quoted text clipped - 85 lines]
> >> >
> >> > Thanks!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.