Ack! This site is moving to since Comcast's efforts to improve their world's worst customer service ranking apparently include terminating web hosting for their existing customers.

More DVD Printing Adventures

Or: The Spirograph Diaries

My kewpie program was used for all the printing in this saga. Kewpie was the result of my initial Adventures in DVD Printing. This document continues the story and eventually gets printing to work (on my C5580) with no clipping of the top of the printout.

This HPLIP bug got an answer pointing me at the ImageableArea parameter in the PPD file as the key to margin control.

The PPD specification says:

*ImageableArea provides the bounding box of the imageable area for the page size named mediaOption. There will be one statement for each named page size supported by the device. *DefaultImageableArea provides the mediaOption name of the default imageable area. Since there can be only one default page size, this value should be the same as the value of *DefaultPageSize, *DefaultPageRegion, and *DefaultPaperDimension. The bounding box value of *ImageableArea is given as four real numbers, representing the x and y coordinates of the lower left and upper right corners of the region, respectively, in the PostScript language default user space coordinate system. The x and y axes of a given page size correspond to the x and y axes of that page size in the *PaperDimension entry. The imageable region is defined as the part of the page where marks can actually be made. On many devices, there are margins imposed by the media transport mechanism in the marking engine that might prevent marks from being made close to the edges of the media. The *ImageableArea entry will supply a region that represents a reliable area of the page in which marks can be made. This might exactly correspond to the clipping path set by the PostScript interpreter. The value is represented as an InvocationValue. On some devices, the imageable area of a given page size varies as a result of the current resolution, amount of memory, the direction of paper feed, and other factors. For example, the imageable area of a Legal size page might be smaller at higher resolutions on a printer with variable resolution, or it might be shifted left or right depending on whether the page was fed long-edge-first or short-edge-first. In PPD files where the imageable area of a given page size can vary depending on other factors, the imageable area recorded for that page size will be the intersection of all possible imageable areas for that page size. While this means that the imageable area available in the current configuration might actually be larger than the imageable area shown in the PPD file, it at least guarantees that the available imageable area will not be smaller than that shown in the PPD file, and all marks made within the given imageable area will be visible.

This sounds like I should be able to set ImageableArea to the whole page and print anywhere on the page without getting clipped. Since the CDDVD120 page size is given in the PPD file as 360 points, I should make the ImageableArea go from (0,0) to (360,360) then I'll have no problems printing anywhere (Yea, right :-).

First thing to do is produce a new test image I can print many times on the same media so I don't use up lots of test disks. A nice triangle inscribed on a 118 millimeter circle is just the ticket. If I ever get the clipping to stop, I'll see the red tip of the triangle printed at the very top of the CD, just touching the edge of the printable surface (likewise for the other two points, but the top is the place I've been getting clipped).

I set the new definition of ImageableArea to:

*ImageableArea CDDVD120/CD DVD 120mm: "0 0 360 360"

Now try a nice test print with 0 left and top margins, so I'll be printing my triangle in the top left corner of the 360 point square. I wouldn't expect that to be the right place to print, but I need the test output to decide how to adjust my margins.

I scan the printed CD with gimp, rotate to make the bottom of the triangle horizontal, and clip at the printable area of the CD so I get a scanned image that exactly matches the source image dimensions:

The green point of triangle (bottom right) is at: (1262,1018)

That is 38 pixels too high and 27 pixels too far left, so in theory if I increase top margin by 38 pixels (and decrease bottom margin by same amount) and increase left margin by 27 pixels, etc. I'll be spot-on.

top bottom left right
9.12 points 16.39 points 6.48 points 19.03 points

A new printout and a new scanned result:

In this image, I drew in some projected lines for where the truncated points of the triangles would be if they hadn't been truncated. That allowed me to pick off more data points to compute a better set of margins. My points were:

Extrapolated top (red point): (685,7)
Extrapolated left (blue point): (81,1053)
Measured right (green point): (1290,1051)

Which turns into these new margin values that should perfectly center my triangle:

top bottom left right
7.44 points 18.07 points 9.2 points 16.31 points

That does indeed almost perfectly center the triangle, but a lot of the top and a little of the left are truncated and had to be extrapolated to see they were perfectly positioned. So much for the theory that the ImageableArea parameter doesn't influence the printout, but merely determines where I'm able to print. I got much less truncation with the original installed default value that specified a smaller ImageableArea rectangle.

Since the truncation of lines isn't happening on any obvious square edges (the truncation at the top clearly doesn't represent clipping at a horizontal line, the lines got clipped at different heights). Maybe a wild and crazy theory to test is that the printer itself has a circular clipping region I have to get inside of. I have 3 points where places on my triangle got truncated, perhaps I can compute where the printer's idea of the printable circle is from that data?

Picking off three points, I get: (730,59) (659,66) (102,1032)

Using the handy dandy circle solver javascript, gives me a center and radius of:

center = (764.28, 770.29)
radius = 712.12

(that's in gimp pixel coordinates)

That does indeed appear to be a 120mm diameter circle, so that is a good sign.

Fiddling with coordinate transforms eventually produces this ridiculous setting for centering ImageableArea over the hypothetical circular clipping region the printer may or may not have:

*ImageableArea CDDVD120/CD DVD 120mm: "12.52 -21.22 354.34 320.60"

A negative offset seems unlikely to be sensible, but I might as well see what happens when I try it. Since I changed ImageableArea, I start over again with zero top and left margins to get a baseline printout with the new ImageableArea:

Attempting to compute new margin values to print with gives me negative margins in some places, which the print dialog won't let me specify, so I do the best I can, but get a squashed image. I just wanted to see if I printed all the way to the top (then I'd have to work on getting the bottom to print again :-).

Unfortunately, not only is my triangle squashed, but the top still gets truncated (not as much as some of the other printouts though).

Only thing to do is try one more time with stuff adjusted to not go negative, but get as close as possible. Switch to this definition instead:

*ImageableArea CDDVD120/CD DVD 120mm: "12.52 0.0 354.34 341.82"

Printing back in the top left corner again with new ppd file, I get:

This is interesting because one of the triangle edges appears to go off the top of the CD right in the center and didn't get truncated. Perhaps I'm close. Computing new print margins needed to shift the triangle to the center:

top bottom left right
21.60 points 3.91 points 14.88 points 10.63 points

Oh My GOD!!! I printed every corner of the triangle all the way to the edge! My work here is done! Success at last!

These margins, together with this ImageableArea did the trick:
*ImageableArea CDDVD120/CD DVD 120mm: "12.52 0.0 354.34 341.82"

One final test with my old rainbow border style test image produced this scan of the printed disk showing that I might still need to tweak the positioning by a pixel or two, but there is no longer any clipping anywhere around the entire disk.

Now if I only knew what ImageableArea actually meant :-).

Page last modified Thu Nov 5 19:34:43 2009