Solved

Print without user intervention

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
creating a flowchart from an algorithm 5 30
Iterate two lists and remove inactive 11 49
Run time Error 4 34
Counting connections to SQL Server through C# 3 29
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

19 Experts available now in Live!

Get 1:1 Help Now