Solved

Print without user intervention

Posted on 2006-07-19
5
219 Views
Last Modified: 2010-04-16
We have an application that creates log files throughout the day.  I need to print the contents of each log file as soon as its created.  I have written a program that uses a FileSystemWatcher to catch the file, and I can read the contents, but how do I print to a printer without any user intervention?  The report is very simple, basicaly I am just listing out six(6) text fields - I don't need graphics, or font control, just need to print the text.
0
Comment
Question by:MGothelf
  • 3
  • 2
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17141426
Printing within C# is not as simple operation as it could, but it can be accomplished with a PrintDocument instance.

Bob
0
 

Author Comment

by:MGothelf
ID: 17141836
What is a printDocument, and how do I use it???
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17141988
Here read this article, and if it doesn't help or doesn't make sense, let me know.

Master Everyday Printing in .NET
http://www.ftponline.com/vsm/2002_11/magazine/features/eaton/

Bob
0
 

Author Comment

by:MGothelf
ID: 17147051
Thanks, that did the trick.  I will award the points but maybe you can answer a related question.  The text file in question is a fax transmission log.  The fax is also stored as a TIFF file.  The user now would like to print a mini copy of the first page of the TIFF file.  Any ideas how to do that?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 17151043
1) Load the TIFF from the file with the Image class:

   Image img = Image.FromFile(fileName);

2) Draw the image on the PrintDocument, in the PrintPage event handler, using the Graphics object

   e.Graphics.DrawImage(img, 100, 100);

Bob
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question