• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: PDFPage Creation query
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PDFPage Creation query


  • Subject: Re: PDFPage Creation query
  • From: Antonio Nunes <email@hidden>
  • Date: Thu, 22 May 2008 11:05:09 +0200

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


  • Follow-Ups:
    • Re: PDFPage Creation query
      • From: "Amrit Majumdar" <email@hidden>
References: 
 >PDFPage Creation query (From: "Amrit Majumdar" <email@hidden>)

  • Prev by Date: PDFPage Creation query
  • Next by Date: Re: Programmatically get treecontroller selection
  • Previous by thread: PDFPage Creation query
  • Next by thread: Re: PDFPage Creation query
  • Index(es):
    • Date
    • Thread