• 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: Creating PDF from a view with custom bounds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating PDF from a view with custom bounds


  • Subject: Re: Creating PDF from a view with custom bounds
  • From: Brendan Younger <email@hidden>
  • Date: Thu, 19 Jul 2001 12:10:26 -0500

I'm sorry, I'm completely confused. The bounds that you state would make your image 2 pixels wide and 2 pixels tall which I doubt is the case. I assume therefore that the numbers you quoted are scaling factors. What I was trying to say before is that when you make the rect r to pass to the PDF method, you specify (0, 0) as the origin when (0, 0) is actually the middle of your view. Therefore, when you call the method to make a PDF, the method only asks your view to draw from (0, 0) to upper right-hand corner. Since (0, 0) is the center of your view, you only get one-fourth of the image. Here's a diagram:

+---------------+---------------+
| | |
| | | <- This (the upper right-hand square) is the only square that the method asks your view to draw
| | |
+---------------+---------------+
| | (0, 0) |
| | |
| | |
+---------------+---------------+
(-1, -1) <- This is where you *really* want to start drawing from.

In order to rectify this, when you do: r = NSMakeRect(0, 0, 2 * MaxX(... etc.
you should really be doing: r = NSMakeRect( -1 * "scaling factor", -1 * "scaling factor", 2 * MaxX(.... etc.
Feel free to personally email me to clarify anything or to send a code snippet which I will be glad to correct.

Brendan Younger


References: 
 >Re: Creating PDF from a view with custom bounds (From: tlr <email@hidden>)

  • Prev by Date: RE: [Help] How to get instance of instantiated Controller in nib from Controller in another nib? (Java)
  • Next by Date: Re: [Help] How to get instance of instantiated Controller in nib from Controller in another nib? (Java)
  • Previous by thread: Re: Creating PDF from a view with custom bounds
  • Next by thread: Re: Creating PDF from a view with custom bounds
  • Index(es):
    • Date
    • Thread