Adding Page numbers

From MobileRead
Jump to: navigation, search

This page describes a way to display the original page numbers from a paper book you scanned. Thanks to Tex2002ans for the technique.

[edit] Overview

This technique can be useful for books that have an index linked to physical pages or a text book where page number references are required. It does not change any page number counter performed by the eBook reader which may be displayed. It does provide a visual indicator of the boundaries of the book pages by displaying the original page numbers in the right margin. Notice the span entries in the example.

The results are similar to the display of numbers by ADE when it computes the pages or uses an external table of pages. See page numbers for more on this.

[edit] The example

Here is an example of the HTML source code for the page. (The text is not important. Watch for the <span> entries.)

<p>It does not make any difference in this regard whether the new <span class="pagenumber">508</span> invention is or is not protected by a patent. A firm that has acquired a license has already expended money for the new invention. [...]</p>
<p>If an invention is so superior to the old processes that it makes the old equipment obsolete and peremptorily demands its immediate replacement by new machines, the transformation will be effected no matter whether the privilege conferred by the patent is in the hands of the owners of the old equipment or of an independent firm. The assertions to the contrary are based on the assumption that not only the inventor and his attorneys but also all people already active in <span class="pagenumber">509</span> [...]</p>

The idea is to capture the page numbers that happens to be mixed into the text, likely due to a scan followed by an OCR, and surround them with a special span. Of course if the page numbers weren't captured they can be added.

The CSS:
span.pagenumber {
     float: right;
     font-weight: bold;
     padding: .5em;
     margin-left: -1em;
     margin-right: -2em;

[edit] The results

Here is how the EPUB appears in the ePub reader: EPUBFloatingPageNumbers.png

Of course, your book's exact code might vary so you'll have to experiment with what negative margins work well for your book. This display is not an exact duplicate of the book since the actual book content goes to the next page after the end of page while this technique may mix the last and first lines of the two pages on the same line.

Personal tools

MobileRead Networks