Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Capture text sent to a printer to a file.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Graves - 19 Mar 2008 04:17 GMT
Does any one know how to caputer text data sent to a printer to a file. I
have seen a window service that captures text data sent to a printer on the
server and save it to a file. I would like to know how to do this. I have
many reports that are produced on an IBM mainframe as text that I would like
to send to a Windows' sever as printer output but capture to a text file.
Currently we use an FTP process and a print to printer would reduce new
report setup time by a few hours each and reduce the mess.

Thansk,
Signature

John Graves

Peter Duniho - 19 Mar 2008 04:47 GMT
> Does any one know how to caputer text data sent to a printer to a file. I
> have seen a window service that captures text data sent to a printer on  
> the
> server and save it to a file. I would like to know how to do this.

Depending on what degree of robustness you want this, it would involve at  
a minimum writing your own printer driver, all the way up to hooking into  
the print spooler and interpreting various printer-level languages  
(Postscript, HP's PCL, and others) in order to extract the text.

As far as I know, none of those are things you can do directly from  
.NET/C#.

Of course, there is in fact already a built-in "text-to-file" printer  
driver you could use, as well as Microsoft's XPS printer driver, and even  
drivers that produce PDF.  If you can deal with requiring the printouts to  
be sent to a specific printer driver, I think those would be a much better  
solution.

If you need to capture all text sent to any printer, that's quite a bit  
more complicated (per hooking into the print spooler).  Again, using an  
existing solution might be better than trying to roll your own, since it's  
not like you're going to be implementing this in-process anyway (i.e.  
doesn't need to be integrated with whatever else you're doing).

In any case, I doubt this is the right newsgroup for trying to learn how  
to implement this.

Pete
John Graves - 19 Mar 2008 13:43 GMT
Pete,

 Thanks for your help...

 If this is not the right newsgroup do you know what one I should use?

 I can control printer driver on the server that will be receiving the text
file from the mainframe.

 I have setup a pcl and text only printer on the server and ran test from
the mainframe.
 The reports are sent to the server and appear as *.SHD and *.SPL in the
windows spool directory.
 This is true for the pcl and text (they are in EMF format).

 I would like to write a .NET c# windows service on this server to convert
these files from EMF to text and then
 remove them from the spooler the correct way.

 Any references about controling the spooler would be appreciated.

 Thanks,--
John Graves

> > Does any one know how to caputer text data sent to a printer to a file. I
> > have seen a window service that captures text data sent to a printer on  
[quoted text clipped - 25 lines]
>
> Pete
Peter Duniho - 19 Mar 2008 19:44 GMT
>   If this is not the right newsgroup do you know what one I should use?

I'm sure I have no idea, sorry.

>   I can control printer driver on the server that will be receiving the  
> text
> file from the mainframe.

But can you control how the mainframe uses the printer driver?  That is,  
can you require that the mainframe print to the text printer driver?

>   I have setup a pcl and text only printer on the server and ran test  
> from
[quoted text clipped - 9 lines]
>
>   Any references about controling the spooler would be appreciated.

I'm sorry, but I don't have any.  If you want access to those files,  
you'll need to hook into the spooler somehow, because otherwise they could  
appear and disappear before you get a chance to look at them.  Parsing the  
EMF to extract any text should be relatively simple, but you need reliable  
access to the EMF.

Just from your description so far, it seems like the easiest thing would  
be just to print to the text driver, which already should emit the results  
to a file.  Then you can just get that text file rather than messing  
around with the spooler.

Other than that, I don't have any specialized knowledge in the area you're  
asking about.  So if you have other questions that you really want to post  
here, someone else will have to answer them.  If you get an answer,  
great...but if not, you should really reconsider my advice that this isn't  
a great place for the question.  You'd be better off finding a forum where  
there's more expertise on the topic, so that you have a better chance of  
getting a useful answer.

Pete

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.