Re: PDFPage Creation query
Re: PDFPage Creation query
- Subject: Re: PDFPage Creation query
- From: "Amrit Majumdar" <email@hidden>
- Date: Fri, 23 May 2008 14:13:07 +0530
Heya...
That completely does it!!
I had overlooked - (Class) pageClass
Thanks a ton.
There are a couple of other queries I have.
1. How to display the thumbnails in a PDFThumbnailView without their
corresponding labels ?
2. On double clicking on a PDFPage in an document I want to change the color
of the page,eg.
On Thu, May 22, 2008 at 2:35 PM, Antonio Nunes <email@hidden>
wrote:
> 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 (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