>From my Winforms application (.NET 1.1) I want to write a text file to a postscript printer, but I want the printer to print to a file rather than to the physical printer. (Another application will pick up the postscript file and do additional processing on it. It is not particularly picky about the precise format of the postscript file.) Although my printing takes place on the client machine, all of this must take place without requiring any user intervention. I also cannot rely on anything special being installed on the client machine (apart from Office 2003 and the printer).
I can accomplish this by automating Word: I write the text to a temp file, then automate Word to open and print it, specifying the output file name. This satisfies the requirements, but there are a couple of annoyances: A: My temp file is added to My Recent Documents. B: It takes a while to launch Word. I can live with this, but does anyone have other suggestions for how to do this? I have tried the following already: 1: notepad.exe /pt <INPUT> <PRINTER> <DRIVER> <PORT> , passing the output filename as <PORT>. (This is the shell PrintTo command). Unfortunately it ignores my filename and prompts the user instead. 2: Derive from PrintDocument and print manually. But PrinterSettings has no API for controlling the output file. 3: Specify AddToRecentFiles=false when calling Documents.Open to avoid (A), but this seems to have no effect (the document is still added to "My Recent Documents"). Any suggestions? =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com