HP PCL/PJL reference (PCL 5 Printer Language) - Technical Reference Manual Part II

17-14 An Introduction to HP-GL/2 Vector Graphics EN
Example:C Programming Language
This example uses the C programming language to print the same
three lines shown on the previous page.
Table 17-6
#include <stdio.h>
main()
{
FILE *prn;
prn = fopen(“PRN”,“wb”); /* open the printer */
fprintf(prn,“033E”); /*
E
C
E to reset printer */
fprintf(prn,“033%%>0B”); /* Enter HP-GL/2 */
fprintf(prn,“IN”); /* Initialize HP-GL/2 Mode */
fprintf(prn,“SP1PA10,10”); /* Select pen 1 & move to 10,10 */
fprintf(prn,“PD2500,10,10,1500,10,10;”); /* Pen down & draw */
fprintf(prn,“033%%0A”); /* enter PCL at previous CAP */
fprintf(prn,“033E”); /* Reset to end job/eject page */
}