Re: PDFMarkupAnnotations not showing when drawing PDFPage
Re: PDFMarkupAnnotations not showing when drawing PDFPage
- Subject: Re: PDFMarkupAnnotations not showing when drawing PDFPage
- From: John Calhoun <email@hidden>
- Date: Thu, 15 Feb 2007 17:32:40 -0800
On Feb 15, 2007, at 3:36 PM, Antonio Nunes wrote:
I'm not sure I understand the Z pattern. According to the docs the
quadriliteral points are ordered counterclockwise at the lower-left
corner of the current page. I make that:
-----
|3 2|
|0 1|
-----
The docs are wrong (as is Adobe's spec). The ordering is:
--------
| 0 1 |
| 2 3 |
--------
And that appears to be the bug (in PDF Kit). It draws using the z-
order above, but in initializes with the counterclockwise order in
Adobe's spec.
I think there is another bug too (looking at the code) where the quad
points created for you inside PDFAnnotationMarkup's initializer are
not relative to the bounds of the annotation as they should be.
Defining the quadPoints as "bounds relative" turns out to be handy
since the annotation can be easily moved about the page by simply
changing the origin of the annotation's bounds (and not having to move
all the quad points as well).
So, you could add some code like this right after you create the
annotation:
NSMutableArray *points;
NSRect bounds;
points = [[NSMutableArray alloc] initWithCapacity: 4];
bounds = [self bounds];
[points addObject: [NSValue valueWithPoint: NSMakePoint(0.0,
bounds.size.height)]];
[points addObject: [NSValue valueWithPoint:
NSMakePoint(bounds.size.width, bounds.size.height)]];
[points addObject: [NSValue valueWithPoint: NSMakePoint(0.0, 0.0)]];
[points addObject: [NSValue valueWithPoint:
NSMakePoint(bounds.size.width, 0.0)]];
[self setQuadrilateralPoints: points];
[points release];
Also, FWIW, I think these lines are not necessary (because they are
the default):
[markup setMarkupType:kPDFMarkupTypeHighlight];
:
[page setDisplaysAnnotations:YES];
john calhoun—_______________________________________________
Cocoa-dev mailing list (email@hidden)
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