Mike_W_Ryan@cup.portal.com (09/12/90)
Does anyone know of a way to load font files to a HP Laserjet using the standard printer unit in TP5.5 ? I have managed to do it by doing blockreads on the font file, then sending it char by char to the printer via interrupt $17. Using the standard printer unit and the LST designator doesnt seem to work. Some of the font gets loaded ... some doesn't, and I get gibberish on the printed page. I assume that the text file driver us is filtereing or interpreting the chars. Is there a "transparent" mode I need to know about ?
bobb@vice.ICO.TEK.COM (Bob Beauchaine) (09/12/90)
In article <33771@cup.portal.com> Mike_W_Ryan@cup.portal.com writes: >Does anyone know of a way to load font files to a HP Laserjet using >the standard printer unit in TP5.5 ? I have managed to do it by >doing blockreads on the font file, then sending it char by char to >the printer via interrupt $17. Using the standard printer unit and the LST >designator doesnt seem to work. Some of the font gets loaded ... some doesn't, >and I get gibberish on the printed page. I assume that the text file driver us >is filtereing or interpreting the chars. Is there a "transparent" mode I >need to know about ? The fact that you found a solution using interrupt 17h shows that you've got a good handle on the problem. It's not Turbo Pascal that's interpreting the characters, it's DOS. Whenever a text device is used with DOS, the file is constantly monitored for character 26h, the end of file marker. If encoun- tered, the file is closed by DOS, whether or not you have transmitted all of the information you wished to send. DOS allows you to open a file in binary mode, but I have read (personally unverified) statements that even this does not cure the problem. The solution you have found is the one usually suggested; hey, if it ain't broke... Bob Beauchaine
abcscnuk@Twg-S5.uucp (Naoto Kimura (ACM)) (09/12/90)
Here's something I hacked some time ago.... I've used this quite a few times without trouble... ---- cut here -------- cut here -------- cut here -------- cut here ---- unit Lpr; (*====================================================================*\ || MODULE NAME: Lpr || || DEPENDENCIES: System.TPU, Dos.TPU || || LAST MOD ON: 8904.05 || || PROGRAMMER: Naoto Kimura || || || || DESCRIPTION: This unit declares a file variable "lst" that || || corresponds to the printer device. This unit does || || not have the same bug (inability to print ^Z) that || || the "printer" unit provided with the compiler. || \*====================================================================*) interface uses Dos; var lst : text; implementation {$F+} function LPRout( var f : TextRec ) : integer; var P : word; regs : registers; begin with f do begin P := 0; while P < BufPos do begin regs.AH := $05; regs.DL := byte(BufPtr^[P]); msdos(regs); inc(P) end; BufPos := 0 end; LPRout := 0 end; function LPRignore( var F : TextRec ) : integer; begin LPRignore := 0 end; function LPRopen( var F : TextRec ) : integer; begin with f do begin Mode := fmOutput; InOutFunc := @LPRout; FlushFunc := @LPRout; CloseFunc := @LPRignore end; LPRopen := 0 end; procedure AssignLPR( var F : text ); begin with TextRec(F) do begin Handle := $FFFF; Mode := fmClosed; BufSize := sizeof(Buffer); BufPtr := @Buffer; OpenFunc := @LPRopen; Name[0] := #0 end end; {$F-} begin AssignLPR(lst); rewrite(lst) end. ---- cut here -------- cut here -------- cut here -------- cut here ---- //-n-\\ Naoto Kimura _____---=======---_____ (abcscnuk@csuna.csun.edu) ====____\ /.. ..\ /____==== // ---\__O__/--- \\ Enterprise... Surrender or we'll \_\ /_/ send back your *&^$% tribbles !!
mg2n+@andrew.cmu.edu (Martin G. Greenberg) (09/13/90)
The easiest solution I found was to do the following: Exec ("C:\COMMAND.COM", "/C COPY " + FontFileName + " PRN /B"); Works perfectly as long as you remember to set the memory sizes. MGG