Re: NSImage to PDFPage in Tiger?
Re: NSImage to PDFPage in Tiger?
- Subject: Re: NSImage to PDFPage in Tiger?
- From: John Calhoun <email@hidden>
- Date: Thu, 3 Jan 2008 13:41:42 -0800
On Jan 2, 2008, at 1:40 PM, Jerry LeVan wrote:
For reasons that are not clear to me I had to keep the "pages" until
I was
finished with the PDF document in Tiger. For Leopard this was not
necessary...
This was a bug in PDFKit in Tiger. My recollection is that when you
added a PDFPage to a document, PDFDocument made a copy of the PDFPage
and retained that, but did not tell the copy of its new owning document.
Recall that PDFPage has a -[document] method that returns the "ownnig"
document. To accomplish this a PDFPage has a weak reference to the
PDFDocument that it is a part of. A private call to -[PDFPage
setDocument:] is made by the PDFDocument when you add a page. The bug
is that while a copy of the page is created and retained, -
[setDocument:] is called on the original PDFPage. I'm not quite clear
on why you should have to keep the original pages around however....
A workaround for Tiger might be to call the private -[setDocument:]
call yourself after adding the page to a document. Something like:
[someDocument insertPage: originalPage atIndex: i];
[[someDocument pageAtIndex: i] setDocument: someDocument];
This should have no ill effect on Leopard.
john calhoun—_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden