Solved

Print without user intervention

Posted on 2006-07-19
5
217 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now