Re: Creating PDF from a view with custom bounds
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