I have been working on making a both creator and reader 'ebooks', so a I
have needed   paginating a 'book' from a text file.  The best solution I
have found is to use the pageheights property, as Scott suggests in other
response, because it makes the work very well without effort, but  it is not
so fast as you want.

Finding a particular chunk may be done with a simple 'find' command --very
fast in 100 pages or bigger books. Or you have to 'index' the text to know
in which pages a particular word appears, but this a process that takes more
time to build the index.

Jose Luis

José L. Rodríguez Illera
Universitat de Barcelona
Passeig Vall d'Hebron, 171
08035 Barcelona  --E

> From: "Geoff Canyon" <[EMAIL PROTECTED]>
> Subject: Pagination experiences
> Date: Thu, 21 Sep 2000 17:51:35 -0700
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset=us-ascii
> Content-Transfer-Encoding: 7bit
> In-Reply-To: <[EMAIL PROTECTED]>
> I'm wondering if anyone here has experience writing pagination routines in
> MetaCard. I'm considering writing a routine that would take a 50-100k block
> of text, a font, a font size, a field size, and figure out where the page
> breaks should occur from beginning to end.
> The actual goal is to be able to go to an arbitrary chunk of the text, and
> know what page number to put under it.
> My first instinct is to use the height of the field and the formattedHeight
> function on chunks of text, finding page-sized chunks and counting them
> until I get to the chunk I want to display. but this is fairly slow across
> perhaps hundreds of pages. By slow I mean more than a second on a fast
> computer.
> But my second instinct is to figure out how many lines will fit onto one
> page, figure out how tall those lines are individually, and then just search
> for the largest n such that n*(the number of lines that will fit on a page)
> is still less than the chunk I want to display, and then use n+1 for a page
> number. I'm sure that's not clear, but if someone's done it, I'm betting it
> will be clear to them. This might be much faster, but will it work?
> Thanks to anyone who has a suggestion,
> Geoff

Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to