Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print to file using generic text printer 1

Status
Not open for further replies.

lanez

Technical User
May 13, 2003
10
GB
Generic text printer set up to print to file. :)
file set up as port so always uses the same file name. :)

Problem. :(

Overwrites previous print. :((

To be of any use to me it must be able to append rather than overwrite. Then I want to read it into a formatting app I've created to print on company stationery. The file can then be deleted/renamed ready for the next print job.

Does anyone know how to set the print to file option to append?

So far, have not been able to find a solution even though I've trawled through several tech web sites.

Thanks
Arnie Lane (lanez)
 
Are you trying to print a txt file? If so, why not use the type command and append it to a file. Then, just read this file into your formatting app.

type a.txt >file.txt
type b.txt >>file.txt

File b.txt will be appended to the end of file.txt.
 
The following trick gets around the file overwrite problem..
1. Create the printer device to write to file
2. configure the file output to c:\temp\xxx.txt or otherwise
3. configure the spooler service to use a seperate spooling directory for this printer (in registry HKLM\System\CurrentControlSet\Control\Print\Printers\<Printer>\SpoolDirectory), restart spooler service to take effect.
4. select &quot;keep documents after they have been printed&quot; from the scheduling tab in printer propertie in control panel
5. you will now get uniquely named files in the spooling directory created in step 3, there are 2 files per print job, one is the control file whilst the other contains the spool data.
6. process the spools as required and delete the jobs from the print queue when processed (net print /delete)


ciao
Gary
 
Thanks to facaldo for an excellent working solution.

Apologies to Serbtastic for not explaining myself more clearly.

cheers
lanez
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top