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: tlr <email@hidden>
- Date: Sat, 21 Jul 2001 00:06:19 +0200
Le vendredi 20 juillet 2001, ` 11:27, Brendan Younger a icrit :
I think we've been talking through one another.
In the example from your first post, you did something like this:
NSRect r = NSMakeRect(0.0, 0.0, MaxX(...
The first two zeros are the origin from which to start drawing and since
you have custom bounds, (0, 0) is in the middle of your view. Therefore,
what happens if you do:
NSRect r = NSMakeRect(-1.4, -1.1, MaxX(...
Better yet, though, is to pass NSZeroRect which, in AppKit drawing is
taken to mean the entire view.
Sorry I can't help you with the other problems, I'm not sufficiently
experienced with printing to help you.
Brendan Younger
I obtained this value of r by trial and error. Giving it NSZeroRect doesn'
t work: I get an empty PDF or EPS file (that is, the file is not empty,
but it doesn't contain any drawing).
Using r = bounds seems natural, but then I get a 2 pixels wide PDF ! Hence
the actual value, which is really the same than my view's frame.
Since MaxX(frame) is about 300, I also tried r = NSMakeRect(-300, -300,
300, 300). The strange thing is that, even though this rect is larger than
the previous, now I get NOTHING except an empty white rect in the PDF or
EPS. I guess that NSMakeRect(-1.4, -1.1, MaxX...) would no work, either,
and by the way 1.4 is uch smaller than the width of the frame.
For the moment,
r =NSMakeRect(0,0, NSMaxX(frame), NSMaxY(frame));
does work IF I translate the context in drawRect as I told you before...
Very odd.
I believe that Apple's engineers never test their code for views with
bounds like (-1,-1)x(2,2). There is also a weird bug in drawStringAtPoint
for these ones, I reported it two weeks ago.
This is annoying, because in mathematical plottings, it is very usual to
have coordinates with this range of values.
Thomas Lachand-Robert
********************** email@hidden
The Commandant Project:
http://lachand.free.fr/
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.