postscript file is not collating when cups copies is set

615 views Asked by At

Our C++ application is using cups to print out a postscript file generated by XRT XrtTblVaDrawPS command. But when I print 2 copies and set the cups collate option the file is not printed out as collated.

1

There are 1 answers

0
user3416126 On

Our project is using XRT motif library to generate a postscript file from a table layout using motif. The postscript file generated by XrtTblVaDrawPS was printed using cups but during testing the cups Collate option appeared not to work when we where printing more then 1 copy. Web searches did not return any reason why the ps file was not collating but after a lot of experimentation we found out why cups was not working as expected. The XrtTblVaDrawPS call generating the ps file and one of the option used was "XRTTBL_PS_NUM_COPIES, 2" to set how many copies the postscript file would print out. In our cups class we were doing a cupsAddOption("copies", "2",.. and cupsAddOption("Collate", "True", .. commands (see examples below). It turns out the the cups "copies" command was killing the Collating if it set to 2. Like the orientation postscript/cups conflict you need to set the cups copies value to 1 to get the collation to work. The postscript file already knows its going to print out, for example 2 copies. If you don't want it to be collated then set cups copies to 2 number. If you are generating a postscript file some other way this problem might not be happening to you, but it is if you are using the XrtTblVaDrawPS call.

pgs = XrtTblVaDrawPS(myTable, fp, XRTTBL_PS_NUM_COPIES, num, <= set to 2 XRTTBL_PS_CELL_RANGE, rng, XRTTBL_PS_COLOR, clr, XRTTBL_PS_ORIENTATION, ornt, XRTTBL_PS_SCALE, FIT_TO_PAGE_HEIGHT, XRTTBL_PS_SHOW_ROW_LABELS, XRTTBL_PS_ALL, XRTTBL_PS_SHOW_FROZEN_ROWS, XRTTBL_PS_ALL, XRTTBL_PS_SHOW_COL_LABELS, XRTTBL_PS_ALL, XRTTBL_PS_SHOW_FROZEN_COLS, XRTTBL_PS_ALL, XRTTBL_PS_PAPERSIZE_WIDTH, media_sz.width, XRTTBL_PS_PAPERSIZE_HEIGHT, media_sz.length, XRTTBL_PS_MARGIN_LEFT, 1.00, XRTTBL_PS_MARGIN_RIGHT, 1.00, XRTTBL_PS_MARGIN_TOP, 0.75, XRTTBL_PS_MARGIN_BOTTOM, 0.75, XRTTBL_PS_HEADER_FONT, "Adobe 10", XRTTBL_PS_HEADER, hdr, XRTTBL_PS_HEADER_MARGIN, 0.55, XRTTBL_PS_FOOTER_FONT, "Adobe 10", XRTTBL_PS_FOOTER, "Page #", XRTTBL_PS_FOOTER_MARGIN, 0.25, NULL);

myNumOptions = cupsAddOption("Collate", "True", myNumOptions, &myOptions); myNumOptions = cupsAddOption("copies", oss.str().c_str(), myNumOptions, &myOptions);

oss.str().c_str() is "2" and collate fails and I get (1-1-2-2) oss.str().c_str() is "1" and collate works and I get (1-2-1-2) oss.str().c_str() is "2" and cups Collate set to "False" I get (1-1-2-2) as expected