• 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: PDFMarkupAnnotations not showing when drawing PDFPage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PDFMarkupAnnotations not showing when drawing PDFPage


  • Subject: Re: PDFMarkupAnnotations not showing when drawing PDFPage
  • From: Antonio Nunes <email@hidden>
  • Date: Fri, 16 Feb 2007 14:32:40 +0000

On Feb 16, 2007, at 1:32 AM, John Calhoun wrote:

The docs are wrong (as is Adobe's spec).  The ordering is:

--------
| 0  1 |
| 2  3 |
--------

Thanks John. As you may have seen in my follow up email I had already come to that conclusion. :-)


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).

Yep, that second issue I noticed too, hence we pretty much came up with equivalent code for setting the points.


From the snippet of code you showed I gleaned you were thinking PDFAnnotationMarkup subclass, which I think is a great idea, so I changed my test project slightly to accomodate for that paradigm:

We now have a new class ANAnnotationMarkup which is a subclass of PDFAnnotationMarkup. All it does is overriding the initWithBounds initializer to adjust the quadriliteral points array:

- (id) initWithBounds:(NSRect)bounds {
self = [super initWithBounds:bounds];
if (self != nil) {
[self setQuadrilateralPoints: [NSArray arrayWithObjects:
[NSValue valueWithPoint: NSMakePoint(0.0, NSHeight(bounds))],
[NSValue valueWithPoint: NSMakePoint(NSWidth(bounds), NSHeight (bounds))],
[NSValue valueWithPoint: NSMakePoint(0.0, 0.0)],
[NSValue valueWithPoint: NSMakePoint(NSWidth(bounds), 0.0)],
NULL]];
}
return self;
}


Which allows us to simplify the test code a bit further to:

- (IBAction)createNewAnnotation:(id)sender
{
#pragma unused (sender)
PDFPage *page = [_pdfView currentPage];
NSRect bounds = NSMakeRect(20, 100, 550, 300);
PDFAnnotationMarkup *markup = [[[ANAnnotationMarkup alloc] initWithBounds:bounds] autorelease];
[markup setColor:[NSColor yellowColor]];

[page addAnnotation:markup];

PDFAnnotationSquare *square = [[[PDFAnnotationSquare alloc] initWithBounds:bounds] autorelease];
[page addAnnotation:square];

[_pdfView setNeedsDisplay:YES];
[_slaveView setNeedsDisplay:YES];
}


Which looks and works great, except no better than before. I.e. the markup draws in the PDFView but not in the 'normal' NSView.

So this still leaves us with how to get the markup to show up in views that are not subclasses of PDFView. (Unfortunately it is rather unlikely I could switch to using PDFView in Tiger.)

António

-----------------------------------------------------------
And you would accept the seasons of your
heart, even as you have always accepted
the seasons that pass over your field.

--Kahlil Gibran
-----------------------------------------------------------



_______________________________________________

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


  • Follow-Ups:
    • Re: PDFMarkupAnnotations not showing when drawing PDFPage
      • From: John Calhoun <email@hidden>
References: 
 >PDFMarkupAnnotations not showing when drawing PDFPage (From: Antonio Nunes <email@hidden>)
 >Re: PDFMarkupAnnotations not showing when drawing PDFPage (From: John Calhoun <email@hidden>)
 >Re: PDFMarkupAnnotations not showing when drawing PDFPage (From: Antonio Nunes <email@hidden>)
 >Re: PDFMarkupAnnotations not showing when drawing PDFPage (From: John Calhoun <email@hidden>)
 >Re: PDFMarkupAnnotations not showing when drawing PDFPage (From: Antonio Nunes <email@hidden>)
 >Re: PDFMarkupAnnotations not showing when drawing PDFPage (From: John Calhoun <email@hidden>)

  • Prev by Date: Re: Core Data, bindings and synchronizing.
  • Next by Date: Re: simple regex with NSTask
  • Previous by thread: Re: PDFMarkupAnnotations not showing when drawing PDFPage
  • Next by thread: Re: PDFMarkupAnnotations not showing when drawing PDFPage
  • Index(es):
    • Date
    • Thread