On May 22, 2008, at 10:20 AM, Amrit Majumdar wrote:

I was planning to create a new PDFDocument, with my own PDF Page that I
generate after subclassing  PDFPage
Accordingly  I subclassed PDFPage and have over-riden [initWithImage]
 [...]
MyPDFPageClass *myPDFPage = [[ MyPDFPageClass alloc ]initWithImage:img];


You did not post the code in the overriden initWithImage:, which is likely to be the crucial factor in the situation you describe. Having said that, I wonder why you would need to override initWithImage:. In the code you posted I see no need for that.

You also want to check out and read up on PDFDocument's pageClass method. From the header file's commentary:
// This is the class that will be allocated and initialized when page objects are created for the document. The // default implementation returns [PDFPage class] but if you want PDFDocument to use your own custom class you can // subclass PDFDocument and implement this method to return your own custom class. Your class should be a subclass of
// PDFPage (otherwise the behavior is undefined).

Further, you may have your reasons for wanting to create an image based PDF page from any PDF page source, but if you don't, your process can be much simpler:

Subclass PDFDocument, and override the pageClass method to return your custom PDFPage subclass.

- (Class) pageClass
{
// Instruct PDFDocument to create MyPDFPageClass objects instead of the default PDFPage objects.
        return [MyPDFPageClass class];
}


Then load PDF data into your PDFDocument's subclass:

[[MySubclassedPDFDocument alloc] initWithXXX:yyy];

... and the pages will already be of type MyPDFPageClass.

António

-----------------------------------------------------------
What you have inside you expresses itself through both your
choice of words and the level of energy you assign to them.
The more healed, whole and connected you feel inside,
the more healing your words will be.

--Rita Goswami
-----------------------------------------------------------


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to