394
401
if (current->len != 20)
395
402
error(1,"wrong BIH length\n");
404
if (Model == MODEL_2480MF)
410
case 3: x = 0x00FFFF; break;
411
case 2: x = 0xFF00FF; break;
412
case 1: x = 0xFFFF00; break;
414
fprintf(fp, "RasterObject.Planes=%06X,0,0,0,0,0,0;", x);
416
/* startpage, jbig_bih, jbig_bid, jbig_end, endpage */
417
w = (((long) current->data[ 4] << 24)
418
| ((long) current->data[ 5] << 16)
419
| ((long) current->data[ 6] << 8)
420
| (long) current->data[ 7]);
421
h = (((long) current->data[ 8] << 24)
422
| ((long) current->data[ 9] << 16)
423
| ((long) current->data[10] << 8)
424
| (long) current->data[11]);
425
fprintf(fp, "RasterObject.Width=%d;", w);
426
fprintf(fp, "RasterObject.Height=%d;", h);
397
429
for (current = *root; current && current->len; current = current->next)
399
431
if (current == *root)
401
fprintf(fp, "\033*b20V");
402
fwrite(current->data, 1, current->len, fp);
436
fprintf(fp, "\033*b20V");
437
fwrite(current->data, 1, current->len, fp);
440
fprintf(fp, "RasterObject.Data#%d=", (int) current->len);
441
fwrite(current->data, 1, current->len, fp);
406
452
len = current->len;
407
453
next = current->next;
408
fprintf(fp, "\033*b%d%s", len, next ? "V" : "W");
409
fwrite(current->data, 1, len, fp);
454
if (!next || !next->len)
455
pad = PAD * ((len+PAD-1)/PAD) - len;
461
fprintf(fp, "\033*b%d%s", len + pad, next ? "V" : "W");
462
fwrite(current->data, 1, len, fp);
463
for (i = 0; i < pad; i++)
467
fprintf(fp, "RasterObject.Data#%d=", len + pad);
468
fwrite(current->data, 1, len, fp);
469
for (i = 0; i < pad; i++)
413
477
free_chain(*root);
415
//chunk_write(ZJT_END_JBIG, 0, 0, fp);
417
//chunk_write(ZJT_END_PLANE, 0, 0, fp);
443
505
| (long) current->data[11]);
446
fprintf(ofp, "\033&l%dO", 0);
447
fprintf(ofp, "\033*r%dU", Mode == MODE_COLOR ? 1004 : 1);
448
fprintf(ofp, "\033*g%dW", Mode == MODE_COLOR ? 26 : 8);
449
fprintf(ofp, "\033*b%dM", 1234);
450
fprintf(ofp, "\033&l%dA", PaperCode);
451
fprintf(ofp, "\033&l%dH", SourceCode);
452
fprintf(ofp, "\033&l%dM", MediaCode);
453
fprintf(ofp, "\033&l%dE", 0);
454
fprintf(ofp, "\033*r%dS", (int) w);
455
fprintf(ofp, "\033*r%dT", (int) h);
456
fprintf(ofp, "\033&l%dU", 0);
457
fprintf(ofp, "\033&l%dZ", 0);
458
fprintf(ofp, "\033*p%dX", 200);
459
fprintf(ofp, "\033*p%dY", 200);
511
fprintf(ofp, "\033&l%dO", 0);
512
fprintf(ofp, "\033*r%dU", Mode == MODE_COLOR ? -1004 : 1);
513
fprintf(ofp, "\033*g%dW", Mode == MODE_COLOR ? 26 : 8);
516
np = Mode == MODE_COLOR ? 4 : 1;
517
for (i = 0; i < np; ++i)
524
//putc(Mode == MODE_COLOR ? 2 : 0, ofp); // Number of bpc
527
fprintf(ofp, "\033*b%dM", 1234);
528
fprintf(ofp, "\033&l%dA", PaperCode);
529
if (PaperCode == 101)
531
fprintf(ofp, "\033&f%dG", PageHeight * 720 / ResY); // Custom Y
532
fprintf(ofp, "\033&f%dF", PageWidth * 720 / ResX); // Custom X
534
fprintf(ofp, "\033&l%dH", SourceCode);
535
fprintf(ofp, "\033&l%dM", MediaCode);
536
fprintf(ofp, "\033&l%dE", 0);
537
fprintf(ofp, "\033*r%dS", (int) w);
538
fprintf(ofp, "\033*r%dT", (int) h);
539
fprintf(ofp, "\033&l%dU", 0);
540
fprintf(ofp, "\033&l%dZ", 0);
541
fprintf(ofp, "\033*p%dX", ResX / 6);
542
fprintf(ofp, "\033*p%dY", ResX / 6);
461
fprintf(ofp, "\033*r1A");
544
fprintf(ofp, "\033*r1A");
547
fprintf(ofp, "MediaSize=%s;", PaperStr);
548
fprintf(ofp, "MediaType=%s;", MediaStr);
549
fprintf(ofp, "MediaInputTrayCheck=top;");
550
fprintf(ofp, "RasterObject.BitsPerPixel=1;");
463
554
if ((PageNum & 1) == 0 && EvenPages)
464
555
SeekMedia = ftell(EvenPages) - 4;
468
559
end_page(FILE *ofp)
470
if (Mode == MODE_COLOR)
472
fprintf(ofp, "\033*x%dY", Dots[0]);
473
fprintf(ofp, "\033*x%dU", TotalDots - Dots[0]);
474
fprintf(ofp, "\033*x%dM", Dots[1]);
475
fprintf(ofp, "\033*x%dV", TotalDots - Dots[1]);
476
fprintf(ofp, "\033*x%dC", Dots[2]);
477
fprintf(ofp, "\033*x%dZ", TotalDots - Dots[2]);
564
if (Mode == MODE_COLOR)
566
fprintf(ofp, "\033*x%dY", Dots[0]);
567
fprintf(ofp, "\033*x%dU", TotalDots - Dots[0]);
568
fprintf(ofp, "\033*x%dM", Dots[1]);
569
fprintf(ofp, "\033*x%dV", TotalDots - Dots[1]);
570
fprintf(ofp, "\033*x%dC", Dots[2]);
571
fprintf(ofp, "\033*x%dZ", TotalDots - Dots[2]);
573
fprintf(ofp, "\033*x%dK", Dots[3]);
574
fprintf(ofp, "\033*x%dW", TotalDots - Dots[3]);
576
fprintf(ofp, "\033*rC");
578
fprintf(ofp, "\f"); // Eject page
580
fprintf(ofp, "\033&l0H"); // Eject page
583
fprintf(ofp, "Event=EndOfPage;");
479
fprintf(ofp, "\033*x%dK", Dots[3]);
480
fprintf(ofp, "\033*x%dW", TotalDots - Dots[3]);
482
fprintf(ofp, "\033*r0C");
579
tmp = localtime(&now);
580
strftime(buf, sizeof(buf), "%m/%d/%Y", tmp);
582
fprintf(fp, "\033%%-12345X@PJL JOB NAME=\"%s\"\n",
583
Filename ? Filename : "stdin");
584
fprintf(fp, "\033%%-12345X@PJL JOB USERNAME=\"%s\"\n",
585
Username ? Username : "");
586
fprintf(fp, "\033%%-12345X@PJL JOB TIMESTAMP=\"%s\"\n", buf);
594
fprintf(fp, "\033%%-12345X@PJL JOB OSINFO=\"Linux/%s\"\n", u.release);
688
tmp = localtime(&now);
689
strftime(buf, sizeof(buf), "%m/%d/%Y", tmp);
691
fprintf(fp, "\033%%-12345X@PJL JOB NAME=\"%s\"\n",
692
Filename ? Filename : "stdin");
693
fprintf(fp, "\033%%-12345X@PJL JOB USERNAME=\"%s\"\n",
694
Username ? Username : "");
695
fprintf(fp, "\033%%-12345X@PJL JOB TIMESTAMP=\"%s\"\n", buf);
703
fprintf(fp, "\033%%-12345X@PJL JOB OSINFO=\"Linux/%s\"\n",
707
fprintf(fp, "\033%%-12345X@PJL JOB OSINFO=\"%s\"\n", "Unknown");
709
fprintf(fp, "\033%%-12345X@PJL ENTER LANGUAGE=LAVAFLOW\n");
710
fprintf(fp, "\033E");
711
fprintf(fp, "\033&l%dS", Duplex-1);
712
fprintf(fp, "\033&l%dG", 0);
713
fprintf(fp, "\033&u%dD", ResX);
714
fprintf(fp, "\033&l%dX", 1);
715
fprintf(fp, "\033&x%dX", 1);
718
fprintf(fp, "Event=StartOfJob;");
719
fprintf(fp, "OSVersion=Linux;");
720
fprintf(fp, "DrvVersion=2.0.1410.0;");
721
fprintf(fp, "Resolution=%dx%d;", ResX, ResY);
722
fprintf(fp, "RasterObject.Compression=JBIG;");
723
fprintf(fp, "Sides=%sSided;", (Duplex-1) ? "Two" : "One");
597
fprintf(fp, "\033%%-12345X@PJL JOB OSINFO=\"%s\"\n", "Unknown");
599
fprintf(fp, "\033%%-12345X@PJL ENTER LANGUAGE=LAVAFLOW\n");
600
fprintf(fp, "\033E");
601
fprintf(fp, "\033&l%dS", Duplex-1);
602
fprintf(fp, "\033&l%dG", 0);
603
fprintf(fp, "\033&u%dD", ResX);
604
fprintf(fp, "\033&l%dX", 1);
605
fprintf(fp, "\033&x%dX", 1);
609
729
end_doc(FILE *fp)
611
fprintf(fp, "\033E");
612
fprintf(fp, "\033%%-12345X");
734
fprintf(fp, "\033E");
735
fprintf(fp, "\033%%-12345X");
738
fprintf(fp, "Event=EndOfJob;");
1266
1395
w = PageWidth - UpperLeftX - LowerRightX;
1267
1396
h = PageHeight - UpperLeftY - LowerRightY;
1268
1397
bpl = (w + 7) / 8;
1271
case MODEL_2300DL: bpl16 = bpl; break;
1272
case MODEL_HP1020: bpl16 = (bpl + 15) & ~15; break;
1273
default: error(1, "Bad model %d\n", Model); break;
1401
//case MODEL_2300DL: bpl16 = bpl; break;
1402
//case MODEL_HP1020: bpl16 = (bpl + 15) & ~15; break;
1403
//default: error(1, "Bad model %d\n", Model); break;
1276
1406
plane = malloc(bpl16 * h);
1360
1490
if (PageHeight < 0 || PageHeight > 1000000)
1361
1491
error(1, "Illegal Y value '%s' for -g\n", optarg);
1363
case 'm': MediaCode = atoi(optarg); break;
1493
case 'm': if (isalpha(optarg[0]))
1496
MediaCode = atoi(optarg);
1364
1498
case 'n': Copies = atoi(optarg); break;
1365
case 'p': PaperCode = atoi(optarg); break;
1499
case 'p': if (strstr(optarg,"in") || strstr(optarg, "mm"))
1502
PaperCode = atoi(optarg);
1366
1504
case 'r': if (parse_xy(optarg, &ResX, &ResY))
1367
1505
error(1, "Illegal format '%s' for -r\n", optarg);