home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 443.lha / pcl2english_v2.0 / README < prev    next >
Text File  |  1990-12-02  |  10KB  |  251 lines

  1.                             PCL2ENGLISH
  2.                             Version 2.0
  3.  
  4.                         Author: Allen Norskog
  5.                          September 15, 1990
  6.  
  7.  
  8. PUBLIC DOMAIN NOTICE
  9.  
  10. This program is placed in Public Domain.  It may be freely copied.
  11. I developed this program to suit my own needs.  I hope it will be
  12. useful to others.  The source is included so that you can make
  13. modifications to suit your own needs.  I would appreciate any 
  14. comments or bug reports.
  15.  
  16.  
  17. DESCRIPTION
  18.  
  19. Pcl2english was designed to help debug and understand printouts that
  20. use the Hewlett Packard Printer Control Language (PCL).  For example,
  21. when pcl2english encounters the "escape sequence" for setting the
  22. margins, it will print out the escape sequence that was
  23. used and a brief English translation of what it means.
  24.  
  25. I have frequently done this process by hand and its quite tedious.
  26. First one (typically) prints the characters out in hex so that
  27. the "escape" character, 1B (hex), can be seen.  By slowly going back
  28. and forth between the hex printout and the printer manual, you can
  29. decode the escape sequences and start to determine what the  printer
  30. was asked to do.
  31.  
  32. Pcl2english was designed to reduce the tedium and chance for errors
  33. with this formerly manual process.  You will still need to use your
  34. printer manual to more clearly understand page size, margin settings,
  35. font selection and your printer's capabilities.  But hopefully, you
  36. can quickly answer questions such as:  Why did part of my print out
  37. come out on the second page?
  38.  
  39. It has been my experience that each program seems to have its own
  40. philosophy of how to print.  Pcl2english is a tool to understand
  41. these "philosophies" and give insight as to when you can get a program
  42. to do something you want (say print in landscape) and when you can't.
  43.  
  44. I have personally used a number of the Hewlett-Packard printers:
  45. ThinkJet, DeskJet, PaintJet, LaserJet+, and the LaserJet IIP.  The
  46. program handles the escape sequences used by these printers and also
  47. the LaserJet 500+, DeskJet+, and LaserJet IID.  Pcl2english does
  48. not handle new features introduced with the LaserJet III.
  49.  
  50.  
  51. REVISION HISTORY
  52.  
  53. Version 1.x:  Internal development versions.
  54.  
  55. Version 2.0:  First release of pcl2english.
  56.  
  57.  
  58. RUNNING PCL2ENGLISH
  59.  
  60. Pcl2english is strictly a "text" based program.  The command format is:
  61.  
  62. pcl2english [options] infile [outfile]
  63.  
  64.     options:
  65.  
  66.     -e  print escape sequences and certain control codes only.   Normal
  67.         text sequences are  not printed, though they are used to keep
  68.         track of where  the "cursor" is.
  69.     -v  print version number on the first output line.
  70.     -x  print hexadecimal equivalents.  After the escape sequence, special
  71.         character, or line of text is printed, a line is printed that
  72.         contains the hex values for each character.
  73.  
  74.     infile:  "pcl" input file.  This should be a capture of the exact
  75.              data being sent to the printer.  That is, any data
  76.              translation ("cooking") should have already been done.
  77.              Methods to get this will vary with machine/operating system.
  78.     outfile: optional output file.  If not given, output is sent to stdout.
  79.              The output is plain ASCII text.
  80.  
  81.  
  82. PCL2ENGLISH OUTPUT
  83.  
  84. A short example to illustrate various features follows:
  85.  
  86.  
  87. <Esc>(s10h1T
  88.     <Esc>(s10h  primary font characters per inch = 10
  89.     <Esc>(s1T   primary font typeface = Pica
  90.  
  91. <Esc>&d@
  92.     <Esc>&d@    Disable Underline
  93.  
  94. <Esc>(sbS
  95.     <Esc>(sb    primary font weight = Medium (0)
  96.     <Esc>(sS    primary font style = Upright
  97.  
  98. <Esc>9
  99.     <Esc>9      Reset Left and Right Margins to default settings.
  100.  
  101. <Esc>&l002e062F
  102.     <Esc>&l002e Top margin = 2 lines.  Text length defaults to:
  103.                     page_length - top_margin - half_inch
  104.     <Esc>&l062F Text length = 62 lines
  105.  
  106. 1<LF>2<LF>3<LF>4<LF>
  107.     Added 4 more lines.
  108.  
  109. <Form feed>  Move to first line at top of next page
  110.              while maintaining current column at 4.
  111.  
  112. <LF>
  113.     Added 1 more lines.
  114.  
  115. ----------------------------------------------------------------------
  116.  
  117. Special characters are enclosed in <>'s such as the escape and form feed.
  118.  
  119. Each new group of special characters is printed starting at the left edge.
  120.  
  121. Multiple  escape commands can be grouped together.  The actual
  122. decoding for each "sub" command is done on subsequent indented
  123. lines following the command group listing. The <Esc>(sbS command
  124. above is an example of this.
  125.  
  126. Text is condensed to fit on a single line.  This is done by printing
  127. up to 20 characters.  If more than 20 characters were encountered,
  128. the first and last 10 characters are printed separated by " ... ".
  129. Special characters are printed between <>'s. A space at the beginning
  130. or the end will be printed as <SP> so that it does not get "lost".
  131. The program counts the number of line feeds encountered in a text
  132. section.  If any are seen, it will print the number of lines added.
  133. This number includes any <LF>'s that may be visible in the text line.
  134.  
  135. A form feed causes the present page to be ejected.  However, the
  136. cursor is not automatically moved over to the left margin on the
  137. next page.  Thus, a "current column" is maintained and printed when
  138. a form feed is encountered.  This column is affected by left and
  139. right margin settings, tabs, returns, and standard characters.
  140. However, pcl2english isn't smart about proportional fonts and some
  141. of the cursor positioning commands.  Thus, the current column value is
  142. really only a help, and not to be relied upon when doing fancy stuff.
  143.  
  144. The "-x" hex option will print out a line of hex equivalents, as can
  145. be seen in the following example.  Here, the second line repeats the
  146. first line, but in hex.  The other lines are like in the example above.
  147.  
  148. <Esc>(s10h1T
  149. 1B 28 73 31 30 68 31 54
  150.     <Esc>(s10h  primary font characters per inch = 10
  151.     <Esc>(s1T   primary font typeface = Pica
  152.  
  153.  
  154. In many cases, you can interchange printer drivers.  Often, you can
  155. use a LaserJet driver on a DeskJet, or a DeskJet driver on a LaserJet.
  156. However, there are differences between the various printers that
  157. could cause differences in the printout.  For example, the DeskJet
  158. is restricted in its ability to move the page back up.  Thus, a
  159. LaserJet command to move the cursor (paper) back could be ignored
  160. on a DeskJet.  Pcl2english was designed to recognize commands for
  161. a wide variety of printers, rather than be specific to one particular
  162. printer.  Thus, if you decode something with pcl2english, and it
  163. doesn't seem that your printer is responding properly to a particular
  164. escape sequence, check in your printer manual to see if that sequence
  165. is indeed supported.
  166.  
  167.  
  168. ERRORS
  169.  
  170. Below are a couple examples of error messages that one could get.
  171. Basically, these escape sequences are undefined, though they could
  172. be used on a future printer.  If you encounter one of these, check
  173. your printer manual.
  174.  
  175. <Esc>A
  176.     <Esc>A      WARNING!!!  Improper/unknown escape sequence.
  177.  
  178. <Esc>&d5D
  179.     <Esc>&d5D   Underline control = ???
  180.  
  181.  
  182. COMPILING NOTES
  183.  
  184. Pcl2english was developed on an Amiga.  However it does not take
  185. advantage of any Amiga specific features, and should be able to
  186. run on a variety of machines.  You will need to make changes in
  187. the compile options in the makefile to match your compiler.  The
  188. one feature that this program does take advantage of is prototypes
  189. that are defined in ANSI C.
  190.  
  191.  
  192. MISCELLANEOUS
  193.  
  194. Included with this program are two files called "chart" and "pcl_good".
  195. "chart" is a reference sheet that lists escape sequences in
  196. alphabetical order.  "pcl_good" is a test file of all escape sequences
  197. handled by pcl2english.  This was one of the files used to test
  198. the program.  You can test the program by running:
  199.  
  200.     pcl2english -e pcl_good
  201.  
  202. I should mention that my employer is Hewlett-Packard.  Though I have
  203. used a variety of HP printers, I do not design/build printers for HP.
  204. My main motivation for this program comes as an owner and user.
  205.  
  206.  
  207. AMIGA NOTES
  208.  
  209. There are three "printer devices" on the Amiga:  PRT:, PAR:, and SER:.
  210. The PRT: device will route output to the appropriate parallel or
  211. serial port (PAR: or SER:) based on your Preferences setting.  The
  212. PRT: device also "cooks" its input by converting "generic" escape
  213. sequences to the proper escape sequences used by your printer.  These
  214. conversions are handled in the printer driver that is selected in
  215. Preferences.  (For example, the HP_DeskJet or HP_LaserJet printer
  216. drivers.)  What pcl2english wants is the PCL data being sent to PAR:
  217. (or  SER: if you connect your printer to the serial port.)
  218.  
  219. A program called CMD is available for capturing exactly this data.
  220. It is in the Utilities drawer for the Workbench 1.3 release.  It is
  221. also on Fred Fish Disk #95.  You need to be sure that if Preferences
  222. wants to send printer output to the parallel port, that you specify
  223. "parallel" in CMD.  Similarly if you use the serial port.  You will
  224. want to decide where you want to create the new file.  For short cases,
  225. you may want to use ram memory since it is fast.  For example,
  226. you might want FILE=RAM:CMD_file.  For longer outputs, or something
  227. you want to save, you may give a hard disk or floppy file name.
  228.  
  229. After the file(s) has been created, you can run pcl2english on it
  230. to see the escape sequences.  Running CMD a second time will turn
  231. off the re-direction, and allow you to send to the printer again.
  232. You can now send the file captured by CMD to the printer by saying:
  233. copy file PAR:  (or SER:).  The file is already "cooked", so you
  234. want to send it directly to PAR: rather than PRT:.
  235.  
  236. To run pcl2english, you will need to open up a CLI or Shell window.
  237. Then type in the command as shown above.  If pcl2english is not
  238. in one of your "path" directories, then you will also need to specify
  239. the path to it so the computer can find it.
  240.  
  241. Pcl2english was developed on the Manx Aztec C 5.0c compiler using
  242. 32 bit ints.
  243.  
  244. --------------------------
  245.  
  246. Allen Norskog
  247. 900 Whaler's Way
  248. Fort Collins, CO  80525
  249.  
  250. --------------------------
  251.