Some time ago I made our printer print letterheads on demand, and wrote the instructions here: https://www.steveroot.co.uk/2019/11/19/magic-letterhead-tray-making-preprinted-stationary-automatically-on-plain-white-paper/
We’ve just replaced our printer with a new model, a Kyocera P7240cdn and that means I need to update cups with a new print queue that generates letterheads on demand for anything sent to that queue.
Typically, it didn’t work first time. Checking the logs, and error file was created that said
Error: /undefined in !R!RGBL0,0;RGBL1,0;RGBL2,0;HUE0,0;HUE1,0;HUE2,0;HUE3,0;HUE4,0;HUE5,0;HUE6,0;LGHT0,0;LGHT1,0;SATU0;EXIT;
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1990 1 3 %oparray_pop 1989 1 3 %oparray_pop 1977 1 3 %oparray_pop 1833 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
--dict:731/1123(ro)(G)-- --dict:0/20(G)-- --dict:75/200(L)--
Current allocation mode is local
Current file position is 261
GPL Ghostscript 9.50: Unrecoverable error, exit code 1
From that I worked out that the new PPD file contained settings not seen in the old printer (P6035) starting with the section
*JCLOpenUI *JCLRedLevel/RGB Level (Red): PickOne
*OrderDependency: 8 JCLSetup *JCLRedLevel
*JCLRedLevel None/Normal: "!R!RGBL0,0;"
*JCLRedLevel Minus10/-10: "!R!RGBL0,-10;"
*JCLRedLevel Minus9/-9: "!R!RGBL0,-9;"
*JCLRedLevel Minus8/-8: "!R!RGBL0,-8;"
So I first removed the “!R!” thinking that caused the error, then the whole JCLRedLevel section, then finally removed about 300 lines of the PPD file from the JCLRedLevel section to the SATU0 section.
With those lines gone, the script succesfully merged the PDF letterhead overlay onto the print file and everything worked.
Update next day!
Not so fast steve, It started printing slightly smaller first pages, like 30% smaller scale. I traced it back to the original PostScript print file first page being smaller than A4 but all subsequent ones being A4. Eventually, I worked out that the fix was to add the printer to cups in a particular way.
Add Printer > IPP > Name of Printer (mars-P… as before), DO NOT add description or location text.
Make = Generic
Model = CupsPDF printer (no options)
Set defaults (Page Size: a4, 600DPI)