Skip navigation.
 
mlRe: NSImage to PDFPage in Tiger?
FROM : John Calhoun
DATE : Thu Jan 03 22:41:42 2008

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_removed>)

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:
http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>

This email sent to <email_removed>

Related mailsAuthorDate
mlNSImage to PDFPage in Tiger? Jerry LeVan Dec 21, 20:56
mlRe: NSImage to PDFPage in Tiger? Nick Zitzmann Dec 22, 21:29
mlRe: NSImage to PDFPage in Tiger? Jerry LeVan Dec 23, 04:28
mlRe: NSImage to PDFPage in Tiger? John Calhoun Jan 2, 22:25
mlRe: NSImage to PDFPage in Tiger? Jerry LeVan Jan 2, 22:40
mlRe: NSImage to PDFPage in Tiger? John Calhoun Jan 3, 22:41
mlRe: NSImage to PDFPage in Tiger? Uli Kusterer Jan 9, 18:44
mlRe: NSImage to PDFPage in Tiger? Jerry LeVan Jan 9, 19:21
mlRe: NSImage to PDFPage in Tiger? John Calhoun Jan 15, 00:20
mlRe: NSImage to PDFPage in Tiger? Jerry LeVan Jan 15, 00:59