Unformatted text preview:

Printing GraphicsEscape-sequencesPrinter CommunicationInitilizationDots-per-inchSet the Cursor PositionSet the Compression ModeEnter Raster Graphics ModeSending Raster DataLeaving Raster Graphics ModeEnd-of-PageOur ‘wavprint.cpp’ demoPrinting GraphicsAn introduction to capabilities of the HP Printer Control LanguageEscape-sequences•The PCL language employs some special sequences of ASCII control-codes, known as ‘escape’ sequences (since they begin with the code for the escape-key: 0x1B)•The character-sequence ‘\e’ may be used to generate this special non-printable byte•The punctuation-symbols, numerals, and alphabetic characters that follow specify a specific command to the HP laser printerPrinter Communication•An application that wishes to do printing can create a textfile containing a mixture of document text and PCL commands •This text file is then ‘submitted’ to the printer using a Linux command (e.g., ‘lpr’)•The printer recognizes commands by the occurrence of an ‘escape’ codeInitilization•Printer initialization command has format:ESC E •Example: fprintf( prn, “\eE” ); // This statement writes the initialization // command to a file whose file-pointer is // the ‘prn’ variableDots-per-inch•Setting print resolution for raster graphics is done with the following command:ESC * t # R•Here the ‘#’ symbol denotes a numeric parameter that specifies the number of dots-per-inch (i.e., the pixel resolution) •Possible choices are: 75, 100, 150, 300Set the Cursor Position•Set the cursor’s Y-coordinate:ESC * p # Y•Set the cursor’s X-coordinate:ESC * p # X•Example: If dots-per-inch equals 300, then fprintf( prn, “\e*p%dY\e*p%dX”, 150, 150 );places the cursor a half-inch from marginsSet the Compression Mode•Here is the command that specifies the type of raster data-compression used: ESC * b # M•The possible numeric parameters are:–0: unencoded (no compression)–1: run-length encoding–2: tagged image file format (TIFF)–3: delta row compressionEnter Raster Graphics Mode•The printer’s default mode is ‘text’ mode•To switch into raster graphics mode, the following command is issued:ESC * r # A•Here the ‘#’ symbol specifies the type of cursor-positioning that is used: –1 means use current cursor position–0 means use the printer’s left marginSending Raster Data•Here is the command for sending raster graphics data to the printer:ESC * b # W•Here the ‘#’ symbol stands for a numeric parameter that specifies the number of bytes of raster data that follows the ‘W’•Then the cursor moves to the next rowLeaving Raster Graphics Mode•To exit from raster graphics mode, the following command is used:ESC * r B•This command switches the printer back to its normal ‘text’ mode, and it is issued after the final row of raster graphics data is sentEnd-of-Page•The PCL language is ‘page oriented’, and once a page’s description is complete, the printer should eject that page•The ‘form-feed’ command ‘\f’ can be sent to the printer to eject the completed page: fprintf( prn, “\f” );Our ‘wavprint.cpp’ demo•We have posted an application program that prints certain Waveform Audio files, using the printer’s PCL raster graphics commands•So far it only works with 8-bit non-stereo data-format •To avoid wasting paper and toner, it only prints the first page of the


View Full Document

USF CS 686 - Printing Graphics

Documents in this Course
Load more
Download Printing Graphics
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Printing Graphics and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Printing Graphics 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?