Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!ginosko!uunet!mcsun!ukc!warwick!ecctp From: ecctp@warwick.ac.uk (Dr J A K Cave) Newsgroups: comp.binaries.ibm.pc.d Subject: Capturing Printer (eg PS) output to file Message-ID: <236@orchid.warwick.ac.uk> Date: 12 Sep 89 10:37:25 GMT Reply-To: ecctp@warwick.ac.uk (Dr J A K Cave) Organization: Computing Services, Warwick University, UK Lines: 85 The following documents a utility that I received as shareware. Although it bears a copyright notice, I believe it is available free. If this belief is mistaken, please notify me. I shall wait a week before posting the code (on c.b.i.p) to seek advice. LPT2DSK - Capture printer output to disk file. Version 1.0 October 3, 1986 (c) Copyright by George G. Bouche This program works by intercepting the printer bios interupt (17h) and capturing the would be printed data in a buffer which is later written to a disk file. By capturing at the bios level, all dos printing (file redirection, Ctl-PrtSc, LPT?, PRN, ...) and programs which call the bios directly (BASIC, Shft-PrtSc) are handled. Capturing is for a specific printer (LPT1, LPT2 or LPT3) and output to the other two printers is passed thru to the original INT17 interupt address. Usage: LPT2DSK [p] [nnK] [F=[d:][\path]filename[.ext]] p=1, 2 or 3 printer number for LPT1, LPT2, or LPT3 Default=1 LPT1 nn=1 to 64 the amount of memory (in multiples of 1024 bytes) to allocate to the printer buffer. The K is required. Default=64K filename any valid dos filename (can be a device) with optional drive, path and/or extension. The F= is required. Default=LPT2DSK.p where p=printer number as above on the current drive, current directory. Requirements: - Dos 2.0 or later. - The parameters can be in any sequence but must be delimited by space(s). - Any or all parameters can be ommitted. - The environment must have an entry for locating COMMAND.COM (COMSPEC= ) and COMMAND.COM must be available as it will be loaded. - LPT2DSK.EXE needs 9120 bytes + XXXX bytes for the resident portion of COMMAND.COM(for dos 3.1 this is 3200) + buffer size. - Multiple printers can be captured - just run the program again for the other printer. Remember, last one started is the first one to exit from. - Dos redirections of the printer (i.e. to COM?) are not detected and no data will reach the buffer. - The printer port hardware need not be present to capture data. The printer status of the captured printer is returned as ready/not busy unless the buffer has filled. Examples: LPT2DSK 2 32K F=CAPTURE.DAT capture LPT2 and reserve a 32k buffer. a secondary level of command.com is loaded. interupt 17h is replaced; no hardware or dos interupts are disturbed. ... run the programs that print and/or hit shift-print-screen and/or hit control-print-screen printing to LPT1 or LPT3 goes on un-affected if the buffer gets full, dos returns an "Not ready error writing device LPT2 Abort, Retry, or Ignore" the only option is to abort. EXIT exit secondary command.com and end LPT2DSK the file CAPTURE.DAT is opened and data is written. if the file existed before, it is overwritten. if no data was printed, the file will not be opened. interupt 17h is restored to value before capture. all allocated memory is returned - nothing resident. LPT2DSK F=LPT1 3 capture LPT3 and reserve a 64k buffer. the buffer will be written to printer 1 when done. Please direct any comments/suggestions/problems to: George G. Bouche P.O.Box 65111 Lubbock, TX 79464