If it will make you feel better, I am having the same experience with
layer-backed views. Searching the list archives and the Apple website
(using keywords "CALayer" and "print") didn't shed any light either.
I have temporarily(?) solved my issue my using an alternate, not-layer-
backed view for printing.

regards,

douglas

On Jan 4, 2008, at 5:27 AM, Timothy J. Wood wrote:

>
> I'm hoping that this is possible, but so far it seems like NSView's
> that are layer-backed don't print (not even a bitmap!)
>
> Tell me I'm wrong and we haven't stepped back into the dark ages...
> =)
>
> -tim

> I'm hoping that this is possible, but so far it seems like NSView's
> that are layer-backed don't print (not even a bitmap!)
>
> Tell me I'm wrong and we haven't stepped back into the dark ages...
> =)
>
> -tim

Hi Tim,

Sorry to say there is indeed a bug that causes the views' drawing to
be redirected to their backing layers, even though the views are being
asked to draw for the purpose of printing.

Ways this can be worked around:

(1) temporarily switch off layer-backing of the view (or view
hierarchy) during printing, or

(3) if your views are employing visual effects that only work in layer-
backed mode (effects that are rendered by Core Animation: view
filters, shadows, alpha) and you need those same effects to appear in
the printed output, use a CARenderer to render the layer tree to
bitmapped form, then print the bitmap.

I'll see about fixing this. In the meantime, I hope the above will
help get you un-stuck.

This would sort of work, but I don't really want to have to set up
my views both ways if I can avoid it. I'm just exploring right now,
but the view I'm wanting to make layer backed is pretty complicated
and having two setup paths would be bad. On the flip side, while
printing, I'm unlikely to have any CIFilters in effect and all my
layers should be able to draw themselves via the CGContextRef path.
In this case, I'd need to be able to render the layer tree into the
CGContextRef as actual vector output.

Hopefully this will work once this bug is fixed. It'd be a bummer
to have to traverse the layer tree myself, applying transforms and
calling the CGContextRef methods, but it seems like I could do that if
I had to.