CocoaDev

Edit AllPages

This lets you easily make a PDFDocument from an array containing PDFPage objects.

PDFDocument+CCDAdditions.h

#import <Cocoa/Cocoa.h> #import <PDFKit/PDFDocument.h> #import <PDFKit/PDFPage.h>

@interface PDFDocument (CCDAdditions)

// This pair will raise an exception if index is out of bounds.

PDFDocument+CCDAdditions.m

#import “PDFDocument+CCDAdditions.h”

@implementation PDFDocument (CCDAdditions)

return [masterDocument autorelease]; }

return NSMakeSize(width, height); }

@end

The next-obvious addition would be - (NSArray *)pages;. -addPagesFromArray: or similar would probably be good too.


Borrowed the idea (and some implementation) for the -size… methods from ReadingPDFPageDimensions.

…which will probably break in Leopard due to resolution independence. If this can be fixed now (legally) then please do. Otherwise, I guess we wait.