473,783 Members | 2,577 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I send multiple documents to print (As a printjob)?

Instead of just sending one document at a time, I need to send multiple
documents as a print job because our laserprinter will only stack and
staple one printjob it receives at a time.
I need to use some of this code:
PrinterSettings printerSettings = new PrinterSettings ();
printerSettings .MaximumPage = m_numberOfPages ;
printerSettings .MinimumPage = 1;
printerSettings .PrintRange = PrintRange.Some Pages;
printerSettings .FromPage = 1;
printerSettings .ToPage = m_numberOfPages ;
printerSettings .Copies = 3;
printerSettings .PrinterName = printerName;

PrintDocument pd = new PrintDocument() ;
m_currentPrinti ngPage = 1;
m_lastPrintingP age = m_numberOfPages ;
pd.PrinterSetti ngs = printerSettings ;
pd.PrintPage += new PrintPageEventH andler(this.pd_ PrintPage);
pd.Print();
Thanks,
Trint

Nov 16 '05 #1
9 12973
Unless I'm mistaken, you need to combine the documents into a single
PrintDocument. In the .NET Framework, PrintDocument represents a single
document, or a single print job. Because you are using the PrintPage
event, it should be straight forward to keep the HasMorePages property
set to true until you have rendered all of the actual documents that you
want to combine in to a single PrintDocument.

Bruce Johnson [.NET MVP]
http://www.objectsharp.com/blogs/bruce

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #2
Unless I'm mistaken, you need to combine the documents into a single
PrintDocument. In the .NET Framework, PrintDocument represents a single
document, or a single print job. Because you are using the PrintPage
event, it should be straight forward to keep the HasMorePages property
set to true until you have rendered all of the actual documents that you
want to combine in to a single PrintDocument.

Bruce Johnson [.NET MVP]
http://www.objectsharp.com/blogs/bruce

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3
No, HasMorePage*s is just for printing the second or so-on pages of
the first document to print (if it goes beyond one page). For example:
a multi-page Invoice...ok, I want 3 invoices (some with multiple pages,
which is already being handled by HasMorePage*s) to be sent to the
printer as a printjob. Instead, I'm only sending one document, and it
may have multiple pages, to the printer with:
pd.Print();
Thanks,
Trint

Nov 16 '05 #4
No, HasMorePage*s is just for printing the second or so-on pages of
the first document to print (if it goes beyond one page). For example:
a multi-page Invoice...ok, I want 3 invoices (some with multiple pages,
which is already being handled by HasMorePage*s) to be sent to the
printer as a printjob. Instead, I'm only sending one document, and it
may have multiple pages, to the printer with:
pd.Print();
Thanks,
Trint

Nov 16 '05 #5
What I'm suggesting is that you create a state machine within your
PrintPage event handler. Say you have three separate documents being
generated out of three instances of the same class. At the module
level, keep track of the current document instance. Then within the
PrintPage event simply invoke the PrintPage method for the current
document instance. Something like the following.

DocumentToPrint[] docs = new DocumentToPrint[3];
int currentDoc = 0;

private void PrintPage(Objec t sender, PrintPageEventA rgs e)
{
docs[currentDoc].PrintPage(send er, e)
if (!e.HasMorePage s && currentDoc < docs.Length)
{
e.HasMorePages = true;
currentDoc++;
}
}

Bruce Johnson [.NET MVP]
http://www.objectsharp.com/blogs/bruce

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #6
Bruce,
I am trying to use this info you gave me yesterday so that I can finish
up on this project...howev er, I'm not sure how to declair this in a
class and if it will really print all of my documents as one job.
Please look:

public static DocumentToPrint[] docs = new DocumentToPrint[3];

I get this error at compile:
error CS0246: The type or namespace name 'DocumentToPrin t' could not be
found (are you missing a using directive or an assembly reference?)

How will I print these documents? Can I do this?

pe.PrintReport( @"\\WEB1\Shippi ng1"); <<this sets up the first report.
docs[currentDoc] = printerSettings ;
Class1.docs[currentDoc].Print();
Class1.currentD oc++;

pe.PrintReport2 (@"\\WEB1\Shipp ing1"); <<this sets up the second report.
docs[currentDoc] = printerSettings ;
Class1.docs[currentDoc].Print();
Class1.currentD oc++;

pe.PrintReport3 (@"\\WEB1\Shipp ing1"); <<this sets up the third report.
docs[currentDoc] = printerSettings ;
Class1.docs[currentDoc].Print();

///and how do send these all to the printer at one time?
///like this?:
Class1.docs[currentDoc].Print();

Thanks for any help,
Trint

.Net programmer
tr***********@g mail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #7
I can't tell for sure, because I don't know what the pe object or the
PrintReportn methods do. In the code that I provided, the
'DocumentToPrin t' class was a dummy one that would have include the
method that supported the PrintPage event handler.

From what it appears, you have created three separate PrintReport
methods, each of which take a path as a parameter. Inside each of these
methods, I assume that you are using the PrintDocument class to do the
printing. If so, where is/are the methods that support the PrintPage
event?

Bruce Johnson [.NET MVP]
http://www.objectsharp.com/blogs/bruce

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #8
Bruce,

I'm helping Trint out on a completely different thread with what I
think is the same problem in the same program. (Correct me if I'm
wrong, Trint.) If you want to get into the fray, you can find the
other thread here.

If we keep it all together in one place we can probably produce a
solution more quickly. (Or make a bigger mess... one or the other. :)

Nov 16 '05 #9
You're correct. I just followed the other thread and it sounds like you got
much deeper into the problem than I have to this point. With a solution that
is grounded in the same place, the PrintPage method. Wonderfully patient,
you are. And feel free to keep going with the thread. I'll keep an eye out
and kick in if I have anything useful to contribute.

"Bruce Wood" wrote:
Bruce,

I'm helping Trint out on a completely different thread with what I
think is the same problem in the same program. (Correct me if I'm
wrong, Trint.) If you want to get into the fray, you can find the
other thread here.

If we keep it all together in one place we can probably produce a
solution more quickly. (Or make a bigger mess... one or the other. :)

Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1266
by: CS | last post by:
Dear all, I would like to know whether it is possible to send multiple files in 1 fax? I noticed from some sample code, I can only specify 1 faxdocument.body in the code. Is there a workaround? Any help is appreciated.
0
339
by: trint | last post by:
Instead of just sending one document at a time, I need to send multiple documents as a print job because our laserprinter will only stack and staple one printjob it receives at a time. I need to use some of this code: PrinterSettings printerSettings = new PrinterSettings(); printerSettings.MaximumPage = m_numberOfPages; printerSettings.MinimumPage = 1; printerSettings.PrintRange = PrintRange.SomePages; printerSettings.FromPage = 1;...
3
1745
by: sham | last post by:
Hi to all, I am using XALAN processor and xslt 2.0 and I have managed to take an XML file and split it into multiple documents. This is done via the Oxygen editor. I now need to write a C# program that will take the XML and XSLT file as inputs and transform the XML file. Any clues on how to get started would be appreciated.
2
1822
by: marklawford | last post by:
I've been prototyping a reporting solution using XSLT and Java to transform a number of XML files into different formats (PDF and CSV mainly). The XML comes from a legacy system where a number of report instances are all combined into a single XML file (each separate "document" contained within an element below the root node). I've been using the xsl:result-document instruction and the SAXON processor to split these. As part of the next...
6
4667
by: shantanu | last post by:
Hi All, I have a requirement to develop a search engine based on some search criteria that will search for the string or statement in all the documents uploaded in the website. The search result will be displayed same as the Google Group search, with highlighted texts. I have few questions: 1. What will be the logic to implement? 2. The documents that will be uploaded in the website will be saved in the datbase or not?
1
1778
by: kashib | last post by:
What I am looking for is a C# example that can send multiple documents of different formats (eg pdf, doc, docx, jpeg etc)to the printer as one print job, I am not sure of the best approach. Can you help?
11
17740
by: londres9b | last post by:
I want to send multiple emails from php with one unique script. The emails are from a mysql database table. How can I achieve this?
7
4183
by: MyWaterloo | last post by:
I am currently using this code to send an appointment to Outlook. It sends the info to a form called "frmAppointments" and then to Outlook. This code works great to send the record that is in focus. I would like to be able to have the ability to send multiple records as appointments. How do I do more than one at a time?Form_frmAppointments!ApptDate = . 'Form_frmAppointments!ApptTime = Me! Form_frmAppointments!Appt = Me.Text80...
0
1441
by: metalheadstorm | last post by:
I have a tcp client - server implementation running in the same program, on different background worker threads. There will be instances of this program on multiple computers so they can send and receive files between each other. I can send files sequentially between computers using network stream, but how would I send multiple files at the same time from computer A to B. Sending multiple files over one connection ( socket ) is fine, but...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.