• 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: PDFKit - CurrentPage with scale factor not in 100%
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PDFKit - CurrentPage with scale factor not in 100%


  • Subject: Re: PDFKit - CurrentPage with scale factor not in 100%
  • From: John Calhoun <email@hidden>
  • Date: Wed, 27 Jun 2007 18:53:26 -0700

On Jun 27, 2007, at 4:22 PM, Michael Wu wrote:
What is a correct way to get the current page number when the scale factor is not 100%?

I am using this call: "[[[impoViewer currentPage] ] intValue]" to get the current page number.

That should work. You can also:

[[[impoViewer currentPage] document] indexForPage: [impoViewer currentPage]];

If the scale factor is 100%, the current page number is correct in relation to the scroll bar in a PDF view. If the scale factor is not 100%, and duplex layout, the currentPage does not correct. For example, the scroll bar is all the way to top and the current page is 3.

So [PDFView currentPage] is always going to be a bit ambiguous when in "two up" display mode. This of course because there are two pages displayed.


In Tiger I think the intent was to always return the page on the left in this case. But I may be wrong.

I'm fairly sure this is not the case with Leopard — [PDFView currentPage] may return either the left or right page.

But regardless — PDFView considers an imaginary horizontal line halfway between the top and bottom of the view. The page crossed by that line is considered the "current page" (disregard the 2-up case for now).

It sounds like you would prefer that the page intersecting the top edge of the PDFView be treated as the current page.

You can do this yourself.  Try this:

NSRect viewBounds = [impoViewer bounds];
PDFPage *currentPage = [impoViewer pageForPoint: NSMakePoint(0.0, NSMaxY(viewBounds)) nearest: YES];


This should map the top of the PDFView to the nearest PDFPage. Let me know if this doesn't work. Sometimes doing these coordinate routines from memory can take a couple go's.

john calhoun—_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


References: 
 >PDFKit - CurrentPage with scale factor not in 100% (From: Michael Wu <email@hidden>)

  • Prev by Date: Re: NSFormatter interfering with bindings continuous update?
  • Next by Date: Re: setting up an NSTextView manually
  • Previous by thread: PDFKit - CurrentPage with scale factor not in 100%
  • Next by thread: CoreData predicate programming
  • Index(es):
    • Date
    • Thread