| 1894 | */ |
| 1895 | |
| 1896 | static void |
| 1897 | do_setup(pstops_doc_t *doc, /* I - Document information */ |
| 1898 | ppd_file_t *ppd) /* I - PPD file */ |
| 1899 | { |
| 1900 | char *ps; /* PS commands */ |
| 1901 | |
| 1902 | |
| 1903 | /* |
| 1904 | * Disable CTRL-D so that embedded files don't cause printing |
| 1905 | * errors... |
| 1906 | */ |
| 1907 | |
| 1908 | doc_puts(doc, "% Disable CTRL-D as an end-of-file marker...\n"); |
| 1909 | doc_puts(doc, "userdict dup(\\004)cvn{}put (\\004\\004)cvn{}put\n"); |
| 1910 | |
| 1911 | /* |
| 1912 | * Mark job options... |
| 1913 | */ |
| 1914 | |
| 1915 | cupsMarkOptions(ppd, doc->num_options, doc->options); |
| 1916 | |
| 1917 | /* |
| 1918 | * Send all the printer-specific setup commands... |
| 1919 | */ |
| 1920 | |
| 1921 | if ((ps = ppdEmitString(ppd, PPD_ORDER_DOCUMENT, 0.0)) != NULL) |
| 1922 | { |
| 1923 | doc_puts(doc, ps); |
| 1924 | free(ps); |
| 1925 | } |
| 1926 | |
| 1927 | if ((ps = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL) |
| 1928 | { |
| 1929 | doc_puts(doc, ps); |
| 1930 | free(ps); |
| 1931 | } |
| 1932 | |
| 1933 | /* |
| 1934 | * Set the number of copies for the job... |
| 1935 | */ |
| 1936 | |
| 1937 | if (doc->copies != 1 && (!doc->collate || !doc->slow_collate)) |
| 1938 | { |
| 1939 | doc_printf(doc, "%%RBIBeginNonPPDFeature: *NumCopies %d\n", doc->copies); |
| 1940 | doc_printf(doc, |
| 1941 | "%d/languagelevel where{pop languagelevel 2 ge}{false}ifelse\n" |
| 1942 | "{1 dict begin/NumCopies exch def currentdict end " |
| 1943 | "setpagedevice}\n" |
| 1944 | "{userdict/#copies 3 -1 roll put}ifelse\n", doc->copies); |
| 1945 | doc_puts(doc, "%RBIEndNonPPDFeature\n"); |
| 1946 | } |
| 1947 | |
| 1948 | /* |
| 1949 | * If we are doing N-up printing, disable setpagedevice... |
| 1950 | */ |
| 1951 | |
| 1952 | if (doc->number_up > 1) |
| 1953 | { |
no test coverage detected