Is it acceptable to use -knowsPageRange to generate page rects?

  • Hi-

    In the continuing saga of my production scheduling program (which has
    benefited so much from the kind help of this list), I am currently
    implementing printing of production schedules with custom pagination.
    I have a list of work centers each with order steps that must appear
    on the printout. Several related work centers (or just one) may
    appear on one or more pages, followed by a page break before the next
    group of work centers.

    Work Center A
    -some work to be done
    -some more work to be done

    Work Center B
    -B's work to be done
    -some more work

    ---------- page break ----------

    ...more work centers, etc

    It seems to me that since the -knowsPageRange method of my print view
    (which I have just written) must go through all of my work center
    data to determine when the pages should break in order to count them,
    it could also generate and store aside the rect for each page in an
    array as it does so.

    Then my -rectForPage method could access that information to return
    the correct rect for the requested page without having to go through
    the nearly identical computations again.

    Does this make sense and not violate anything? If this is commonly
    done (I can't be the first to think of this), did I miss discussion
    of it Apple's printing docs? Their custom pagination example is very
    simple (which they admitted) and to my mind didn't really discuss the
    issues that arise in an actual custom pagination situation.

    http://developer.apple.com/documentation/Cocoa/Conceptual/Printing/
    Tasks/PaginatingViews.html#//apple_ref/doc/uid/20000912-BBCHHAHI

    Thank you
  • On Thu, 29 Nov 2007 14:30:02 -0500, Paul Bruneau
    <Paul_Bruneau...> said:
    > Hi-
    >
    > In the continuing saga of my production scheduling program (which has
    > benefited so much from the kind help of this list), I am currently
    > implementing printing of production schedules with custom pagination.
    > I have a list of work centers each with order steps that must appear
    > on the printout. Several related work centers (or just one) may
    > appear on one or more pages, followed by a page break before the next
    > group of work centers.
    >
    > Work Center A
    > -some work to be done
    > -some more work to be done
    >
    > Work Center B
    > -B's work to be done
    > -some more work
    >
    > ---------- page break ----------
    >
    > ...more work centers, etc
    >
    >
    > It seems to me that since the -knowsPageRange method of my print view
    > (which I have just written) must go through all of my work center
    > data to determine when the pages should break in order to count them,
    > it could also generate and store aside the rect for each page in an
    > array as it does so.
    >
    > Then my -rectForPage method could access that information to return
    > the correct rect for the requested page without having to go through
    > the nearly identical computations again.
    >
    > Does this make sense and not violate anything? If this is commonly
    > done (I can't be the first to think of this), did I miss discussion
    > of it Apple's printing docs? Their custom pagination example is very
    > simple (which they admitted) and to my mind didn't really discuss the
    > issues that arise in an actual custom pagination situation.
    >
    > http://developer.apple.com/documentation/Cocoa/Conceptual/Printing/
    > Tasks/PaginatingViews.html#//apple_ref/doc/uid/20000912-BBCHHAHI

    Well, judging from answers I've given on this topic before, I'd say that
    what you're thinking of doing is exactly what you're *supposed* to do:

    http://www.cocoabuilder.com/archive/message/cocoa/2006/12/14/175913

    http://www.cocoabuilder.com/archive/message/cocoa/2002/12/4/51570

    Now, of course, what I've said on the topic could be wrong; but it certainly
    has allowed me to print without calculating all the page breaks twice. m.

    --
    matt neuburg, phd = <matt...>, <http://www.tidbits.com/matt/>
    A fool + a tool + an autorelease pool = cool!
    One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
    AppleScript: the Definitive Guide - Second Edition!
    <http://www.amazon.com/gp/product/0596102119>
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today