473,320 Members | 2,020 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,320 software developers and data experts.

How to create and print a two page document

Mo
Hi,
I have two tiff images which present the front and back of a card. I
need to send these to images to a printer that has a two sided
printing capabilities. I need to send these two images to the print as
page 1 and two of the same document in order for the printer to print
it on the front and back of the document. how do you combine these
images so that they present page 1 and 2 of a document for printing?
The following code shows how far I got but I have a feeling this is
not the best way to go about it. Any ideas is greatly appreciated.

StreamReader streamToPrintFront = new StreamReader(@"C:\front.tif");
StreamReader streamToPrintBack = new StreamReader(@"C:\Back.tif");
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.Print();
streamToPrint.Close();
PrintImage.Dispose();
PrintObject.Dispose();

private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
// Draw a picture.
Rectangle Rect = new Rectangle();
Rect.Width = 350;
Rect.Height = 530;
ev.Graphics.DrawImage(Image.FromFile("C:\\dd.tif") , Rect);

// Indicate that this is the last page to print.
ev.HasMorePages = false;
}

Apr 25 '07 #1
1 5299
http://msdn2.microsoft.com/en-us/lib...gs.duplex.aspx

"Mo" <le******@yahoo.comwrote in message
news:11**********************@r35g2000prh.googlegr oups.com...
Hi,
I have two tiff images which present the front and back of a card. I
need to send these to images to a printer that has a two sided
printing capabilities. I need to send these two images to the print as
page 1 and two of the same document in order for the printer to print
it on the front and back of the document. how do you combine these
images so that they present page 1 and 2 of a document for printing?
The following code shows how far I got but I have a feeling this is
not the best way to go about it. Any ideas is greatly appreciated.

StreamReader streamToPrintFront = new StreamReader(@"C:\front.tif");
StreamReader streamToPrintBack = new StreamReader(@"C:\Back.tif");
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.Print();
streamToPrint.Close();
PrintImage.Dispose();
PrintObject.Dispose();

private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
// Draw a picture.
Rectangle Rect = new Rectangle();
Rect.Width = 350;
Rect.Height = 530;
ev.Graphics.DrawImage(Image.FromFile("C:\\dd.tif") , Rect);

// Indicate that this is the last page to print.
ev.HasMorePages = false;
}

Apr 25 '07 #2

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

Similar topics

21
by: Steel | last post by:
Hi at all, I have a very long html page with many photo. Therefore the best to print this page is to print the some page as PDF. Therefore I maked a PDF file like my page to print best. I'ld want...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
2
by: Tigger | last post by:
Dear Experts, I've got a trouble problem that I need your help. The scenario is the following: 1) I need to add a "Print" button to my web page; 2) by clicking this button, the web page should...
6
by: CSharpguy | last post by:
In my gridview I have 2 -3 template fields which are hyperlinks. I allow the user to print this grid. When the grid prints it also prints the links, how can I take the user to a print preview page...
10
by: jon | last post by:
I'm trying to use a hidden iframe to print the contents of one div seamlessly. Currently I can create the hidden iframe, copy the contents of the div to the iframe, and print it. I even have a...
4
by: DeWittds | last post by:
Had no luck in the visual basic group maybe someone here can give me a hand. I have been tring to recreate a simple program that I wrote many years ago in quick basic. The program get name and...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
10
by: SM | last post by:
Hello I'm trying to create a multi dimensional array in JavaScript, but after some reading i still can't figure out how to apply it to my model. Here it is: I have a list A and for each item...
0
by: 5anelli | last post by:
Hi to everyone, I need to create and print (from within a c# application) a MS Word document starting from an Access db. Half of this document must be written and printed in, let's say, January,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.