CUPS: Adding custom page size to ppd file

I have a Canon i560 printer, which is rather well supported by Gutenprint drivers. I have been using those for a while and they serve my regular printing needs. However, when I try to print a good quality photo on glossy photo paper, strange stuff happens.
The colour doesn’t come out nice, but somewhat faded. Worse, no matter how I specify that I want to make a print on 10x15 glossy paper, the actual print is always cut off, printed landscape when I specify portrait, etc. The printer is shared via CUPS and when my wife prints from her Windows XP machine, the printer works normally and the colours look brilliant so there’s no problem with the machine itself, it has to be in the driver.

I googled this problem extensively and in my search, I found out that Canon does in fact have a Linux driver for this printer, though it can’t be found through their website. It is on their ftp server, however: ftp://download.canon.jp/pub/driver/bj/linux/

I installed the driver from there, following instructions that I found on the web and I have the printer working. But…the photo paper size that I want to print on (10x15 centimetres) isn’t available in the ppd file. I can also not specify a custom paper size to print on in digikam or gwenview, since that option is greyed out…
Since a ppd file is a text file, I decided to see if I could add a custom paper size. I googled some more and found this page: Adding Custom Paper Sizes to a Custom Printer File Using a Text Editor

With the help of that page, I thought I had it nailed. I added the following to my ppd file:
*PageSize photo/Photo 10x15: “<</CNPageSizeName(photo)/PageSize[283 424]ImagingBBox null>>setpagedevice”
*PageRegion photo/Photo 10x15: “<</CNPageSizeName(photo)/PageSize[283 424]ImagingBBox null>>setpagedevice”
*ImageableArea photo: “0 0 283.46 283.46”
*PaperDimension photo: “283 424”

Of course these entries went in the proper sections of the ppd file. The Photo 10x15 option shows up now in the print dialog, however, when I specify it, nothing is printed and the following is logged in /var/log/cups/error_log:

D [24/Mar/2010:20:07:49 +0100] [Job 118] pstocanonbj: /usr/bin/gs -r600 -g0x0 -q -dNOPROMPT -dSAFER -sDEVICE=ppmraw -sOutputFile=- -| /usr/local/bin/bjfilterpixus560i --imageres 600 --papersize photo10x15 --media plain --paperload asf --bbox 0,0,0,0 
D [24/Mar/2010:20:07:49 +0100] [Job 118] Error: invalid papersize
D [24/Mar/2010:20:07:49 +0100] [Job 118] 
D [24/Mar/2010:20:07:49 +0100] [Job 118] Canon Bubble Jet Print Filter for Linux ver.2.4.0
D [24/Mar/2010:20:07:49 +0100] [Job 118] Copyright CANON INC. 2001-2004
D [24/Mar/2010:20:07:49 +0100] [Job 118] All Rights Reserved.
D [24/Mar/2010:20:07:49 +0100] [Job 118] 
D [24/Mar/2010:20:07:49 +0100] [Job 118] bjfilterpixus560i --gui (gui mode)
D [24/Mar/2010:20:07:49 +0100] [Job 118] bjfilterpixus560i [switches] [file]
D [24/Mar/2010:20:07:49 +0100] [Job 118] 
D [24/Mar/2010:20:07:49 +0100] [Job 118] switches:  --imageres     1 - 32767             ]
D [24/Mar/2010:20:07:49 +0100]  --cartridge    cartridgetype         ]
D [24/Mar/2010:20:07:49 +0100]  --media        mediatype             ]
D [24/Mar/2010:20:07:49 +0100]  --halftoning   halftonetype          ]
D [24/Mar/2010:20:07:49 +0100]  --quality      1 - 5                 ]
D [24/Mar/2010:20:07:49 +0100]  --grayscale                          ]
D [24/Mar/2010:20:07:49 +0100]  --papersize    size                  ]
D [24/Mar/2010:20:07:49 +0100]  --paperload    position              ]
D [24/Mar/2010:20:07:49 +0100]  --borderless                         ]
D [24/Mar/2010:20:07:49 +0100]  --extension    0 - 3                 ]
D [24/Mar/2010:20:07:49 +0100]  --location     position              ]
D [24/Mar/2010:20:07:49 +0100]  --fit                                ]
D [24/Mar/2010:20:07:49 +0100]  --full                               ]
D [24/Mar/2010:20:07:49 +0100]  --percent      20 - 400              ]
D [24/Mar/2010:20:07:49 +0100]  --copies       1 - 999               ]
D [24/Mar/2010:20:07:49 +0100]  --renderintent intent                ]
D [24/Mar/2010:20:07:49 +0100]  --gamma        1.4/1.8/2.2           ]
D [24/Mar/2010:20:07:49 +0100]  --balance_c    -50  -   50           ]
D [24/Mar/2010:20:07:49 +0100]  --balance_m    -50  -   50           ]
D [24/Mar/2010:20:07:49 +0100]  --balance_y    -50  -   50           ]
D [24/Mar/2010:20:07:49 +0100]  --balance_k    -50  -   50           ]
D [24/Mar/2010:20:07:49 +0100]  --density      -50  -   50           ]
D [24/Mar/2010:20:07:49 +0100]  --papergap     gaptype               ]
D [24/Mar/2010:20:07:49 +0100]  --bbox         left,bottom,right,top ]
D [24/Mar/2010:20:07:49 +0100] [Job 118] 
E [24/Mar/2010:20:07:49 +0100] [Job 118] pstocanonbj write error,32.

I’m sort of at a loss here on what to try next. Can someone spot a mistake or point me in the right way?

I’m on openSUSE 11.2, KDE 4.4.1, release 228, CUPS 1.3.11.

No one with any experience adding page sizes to ppd files?

Or is my description too long and y’all didn’t bother reading? :wink: (joke!)

Can someone spot a mistake or point me in the right way?

I have not had to edit ppd files before, so I can only make an educated guess here. Your ‘Imageable Area’ line appears to be incorrect, based on the desired page size (10cm x 15cm)

*ImageableArea photo: “0 0 283.46 283.46”

This should probably be more like

*ImageableArea photo: “0 0 283.46 425.20”

BTW, I used this Centimeters to Points [Postscript] Chart

Thank you for your help deano_ferrari.

On second thought, that line:

*ImageableArea photo: “0 0 283.46 283.46”

does look a bit suspect, so I changed it to your suggestion of:

*ImageableArea photo: “0 0 283.46 425.20”

but unfortunately, CUPS still reports the error “pstocanonbj write error,32.” when I tell it to print on 10x15 glossy paper.

I then took a closer look at the chart you provided and saw that 15 centimeters there are specified as 425 rather then 424 as I had added to my ppd file. So I updated the appropriate lines as well.
Now, CUPS logs “/usr/lib/cups/filter/pstocanonbj failed”

And indeed, the error log shows this:

E [27/Mar/2010:12:31:25 +0100] PID 29033 (/usr/lib/cups/filter/pstocanonbj) crashed on signal 11!

Any other thoughts?

I’ve been ‘hurt’ by Canon and it’s drivers so often, spent weeks to get a € 90 Canon to work with a Canon driver, that I can only add one suggestion:
replace the printer by a linux supported one. Myself I stick to HP: unpack, plug in, configure, done.

Thanks Knurpht.
I couldn’t agree with you more. For normal printing, this little Canon works fine with Linux. But photo printing is just not possible. It will most likely be my last Canon…

For what it’s worth, I removed the Canon driver from my system and switched back to the Gutenprint drivers. At least they work as far as normal printing is concerned. :slight_smile:

Before I got CUPS to recognize the i560 again after removing the Canon drivers, I had to reboot the entire system too. Odd. But at least I am back to printing things again. Guess I’ll have to print photos from my wife’s XP box until I go out and buy a new printer.

Nice nick, by the way :wink:

Sorry for the late reply, but I can’t stand that nobody pointed out the obvious:

Look at the following lines:

pstocanonbj: /usr/bin/gs -r600 -g0x0 -q -dNOPROMPT -dSAFER -sDEVICE=ppmraw -sOutputFile=- -| /usr/local/bin/bjfilterpixus560i --imageres 600 --papersize photo10x15 --media plain --paperload asf --bbox 0,0,0,0
Error: invalid papersize

This has nothing to do with either CUPS or Ghostscript. So changing their settings will obviously do nothing.
It’s bjfilterpixus560i (which on my system is called “bjfilterpixusip3100”, and I have the same printer) which is the problem.

I executed this manually (22x11 = DL, which is also missing), and it gave me the same error:

# bjfilterpixusip3100 --papersize Custom.22x11cm
Error: invalid papersize

But this one worked:

# bjfilterpixusip3100 --papersize a4

Unfortunately, there is no --help to show which values it accepts.

But good old equery (I have Gentoo here) could tell me that there is a /usr/lib/bjlib/bjfilterpixusip3100.conf! And lo and behold, in there, I found a whole list of paper sizes not shown anywhere! (Under [papersize].)
Including landscape versions, called formatl. e.g. a4l.
And even my DL envelope format, as envelopdlp (I guess the p stands for portrait. But I have to test if that means I have to put the envelope in horizontally, which feels weird.
It also seems to have postcard formats of various sizes and even a “user” size.

No idea how to use them though, because i just found out the bad part:
When I actually try to set it, I get:

# bjfilterpixusip3100 --papersize envelopdlp
Error: inappropriate papersize selection

Then again, maybe I really use the wrong driver, and this would work for you.
I also see a graphical tool in the rpm with the correct driver. Maybe one can set custom sizes in there…?

Anyway, I hope I could help to get one step further.
Always remember that a computer is the most complex system any normal human has access to. So treat it like one, check your logs carefully, and don’t rely on dumbed-down (e.g. GUI) interfaces, since they WILL bite you in the ass. ^^