diff --git a/brlaser.drv.in b/brlaser.drv.in index 74a77f8..afb7359 100644 --- a/brlaser.drv.in +++ b/brlaser.drv.in @@ -33,7 +33,6 @@ Filter application/vnd.cups-raster 33 rastertobrlaser // The 1200dpi mode is weird: we need to send 1200x1200dpi raster // data, but Brother only advertises 1200x600dpi. I wonder what // is going on there. -Resolution k 1 0 0 0 "300dpi/300 DPI" *Resolution k 1 0 0 0 "600dpi/600 DPI" Resolution k 1 0 0 0 "1200dpi/1200HQ" @@ -87,6 +86,7 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10 Attribute "NickName" "" "Brother DCP-7030, using @PACKAGE@ v@VERSION@" Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7030;CLS:PRINTER;" PCFileName "br7030.ppd" + Resolution k 1 0 0 0 "300dpi/300 DPI" } { @@ -94,6 +94,7 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10 Attribute "NickName" "" "Brother DCP-7055, using @PACKAGE@ v@VERSION@" Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7055;CLS:PRINTER;CID:Brother Laser Type1;" PCFileName "br7055.ppd" + Resolution k 1 0 0 0 "300dpi/300 DPI" } { @@ -109,4 +110,5 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10 Attribute "NickName" "" "Brother DCP-7065DN, using @PACKAGE@ v@VERSION@" Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7065DN;CLS:PRINTER;CID:Brother Laser Type1;" PCFileName "br7065dn.ppd" + Duplex rotated } diff --git a/src/job.cc b/src/job.cc index cc8e201..206bb11 100644 --- a/src/job.cc +++ b/src/job.cc @@ -73,10 +73,16 @@ void job::write_page_header() { fprintf(out_, "@PJL SET PAGEPROTECT = AUTO\n"); fprintf(out_, "@PJL SET ORIENTATION = PORTRAIT\n"); fprintf(out_, "@PJL ENTER LANGUAGE = PCL\n"); + + fputs("\033E", out_); + fprintf(out_, "\033&l%dX", std::max(1, page_params_.num_copies)); + + if (page_params_.duplex) { + fputs("\033&l2S", out_); + } } void job::encode_page(const page_params &page_params, - int num_copies, int lines, int linesize, nextline_fn nextline) { @@ -95,8 +101,6 @@ void job::encode_page(const page_params &page_params, block.add_line(encode_line(line)); std::swap(line, reference); - fputs("\033E", out_); - fprintf(out_, "\033&l%dX", std::max(1, num_copies)); fputs("\033*b1030m", out_); for (int i = 1; i < lines && nextline(line.data()); ++i) { diff --git a/src/job.h b/src/job.h index e3e6d5d..f26a78c 100644 --- a/src/job.h +++ b/src/job.h @@ -23,14 +23,18 @@ #include struct page_params { + int num_copies; int resolution; + bool duplex; bool economode; std::string sourcetray; std::string mediatype; std::string papersize; bool operator==(const page_params &o) const { - return resolution == o.resolution + return num_copies == o.num_copies + && resolution == o.resolution + && duplex == o.duplex && economode == o.economode && sourcetray == o.sourcetray && mediatype == o.mediatype @@ -46,7 +50,6 @@ class job { ~job(); void encode_page(const page_params ¶ms, - int num_copies, int lines, int linesize, nextline_fn nextline); diff --git a/src/main.cc b/src/main.cc index 32d46ee..db238eb 100644 --- a/src/main.cc +++ b/src/main.cc @@ -107,9 +107,11 @@ page_params build_page_params() { }; page_params p = { }; + p.num_copies = header.NumCopies; p.resolution = header.HWResolution[0]; p.economode = header.cupsInteger[10]; p.mediatype = header.MediaType; + p.duplex = header.Duplex; if (header.MediaPosition < sources.size()) p.sourcetray = sources[header.MediaPosition]; @@ -182,7 +184,6 @@ int main(int argc, char *argv[]) { dump_page_header(header); } job.encode_page(build_page_params(), - header.NumCopies, header.cupsHeight, header.cupsBytesPerLine, next_line);