Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!gatech!prism!bb16 From: bb16@prism.gatech.EDU (Scott Bostater) Newsgroups: comp.lang.pascal Subject: Re: Just for kicks Message-ID: <29446@hydra.gatech.EDU> Date: 20 May 91 14:14:23 GMT References: <4cBo0AK00Vpg06BUV4@andrew.cmu.edu> Organization: Georgia Institute of Technology Lines: 80 In article <4cBo0AK00Vpg06BUV4@andrew.cmu.edu> mg2n+@andrew.cmu.edu (Martin G. Greenberg) writes: >Has anyone else seen/experienced this problem? > >I wrote a program (for commercial reasons) which needs to download >soft fonts to a laser printer which is attached to the computer. To >do this I did the sensible thing and used the following sequence of >commands along with a WRITELN or two to send the appropriate control >codes. I've written a similar routine for work myself. Why are you using WRITELN? Are you sure you want the extra CR+LF sent to the printer? PCL in general will normally ignore those characters so at best you're doing no harm, at worst you're corrupting the data. > > SwapVectors; > Exec (GetEnv ('COMSPEC'), '/C COPY FONT1.FOO PRN > NUL') > SwapVectors; Off the top of my head try: Exec( GetnEnv('COMSPEC'), '/C copy/b font1.foo prn > nul'); This makes sure that ^Z's don't mess up the copy command. (Or are you sure that font1.foo doesn't have a $1a in it anywhere? :-) The approach that I took differs signifigantly. I read the data in and sent it to the printer directly because I had to send over a 19200 baud serial line. I later re-wrote the program to go over a parallel line. This method gives you more control over what gets sent. Program LJ_Example; uses printer; const ESC = #27; ... Procedure DownloadFont( FontID: Integer; FontFile: String); var F: File of Char; c: Char; Begin Assign( f, FontFile); Reset(f); Write(lst, ESC+"*c", FontID, "D"); { tell printer data is a downloadable softfont } While Not Eof(f) do Begin read(f,c); write(lst,c); End; { While } Close(f); End; { Procedure DownloadFont } ... [stuff deleted] >We finally got ticked off and sent the whole shebang off to Hewlett Packard >(the software is designed for the LaserJet 2 since that is what our market >uses almost exclusively) and said "any ideas?". The tech at HP tried the >code on the machines in the office and it failed miserably, yet when she >tried it on her machine at home, it worked flawlessly. HP at this point said, >"It's Borland's fault" (the code was written using TP 5.0 & 5.5). Sounds like a DOS bug to me. If you're using the EXEC command to call the copy command. Is there any correlation between DOS versions and/or IBM-DOS vs MS-DOS? It sounds to me like sometimes the ^Z's are causing problems and sometimes they aren't (at least off the top of my head :-) -- Scott Bostater Georgia Tech Research Institute - Radar Systems Analysis "My soul finds rest in God alone; my salvation comes from Him" -Ps 62.1 uucp: ...!{allegra,amd,hplabs,ut-ngp}!gatech!prism!bb16 Internet: bb16@prism.gatech.edu