Page 1 of 1

PDF page numbering

Posted: Tue Jun 02, 2009 10:32 am
by pierre.chepelov
Hello,

In many of IMSLP's PDFs, the file's numbering does not match the original printed and scanned numbering. The score itself may begin on page 2, or 3, or 5... but, for the file, it's usually on p. 1 (when the cover hasn't been scanned) or 2 (with the cover). This causes troubles when printing recto-verso, and when browsing the index in large files.

Furthermore, in some books there are several numbering sections, usually one for the preface (with Roman numbers), sometimes even in the score (e.g. in Lully's Armide IMSLP #01970, the Prologue has its numbering, and then Act I begins with page 1 again).
Here is an example where the PDF follows well the original numbering of the old printed score: http://www.musicasacra.com/pdf/graduale1961.pdf (BTW is that uploadable?)

Do people here know some tools for that purpose? I mean, not only Adobe Pro, but some Linux (or even Windows) open software...

Thanks

Re: PDF page numbering

Posted: Wed Jul 15, 2009 10:22 am
by pierre.chepelov
I did found a way to manage a PDF's "logical" page numbering, using PDFedit (http://pdfedit.petricek.net/index_e.html, http://sourceforge.net/projects/pdfedit/). This (open source) software (workong on Linux, and Windows with cygwin) is powerfull, but quite undocumented... So below is a small tutorial.

Note : "physical" numbering means counting from the first to the last page of the document; it while be used as a reference; while "logical" numbering means the other way(s) of counting, those that you want to be shown.

1. Using PDFedit's GUI mode, open the PDF. (I wasn't courageous enough to try the command line mode!)
2. On the right pane, you'll see the Tree, and within it, entries like:
  • Catalog
    Pages
    Outlines, etc.
Under the Catalog entry, you'll see entries like
  • Entries
    Metadata
    Pages
    Type, etc.
3. Under the Catalog entry, add ("+" button) an object with name = "PageLabels" and type = Dict[ionary]
4. Under that PageLabels object, add an object (name = "Nums", type = Array)
5. Under that Nums entry, add objects sequentially (the easiest is to use the "Append to the end" function), with, for each numbering section of your document :
  • 1. object (position = sequentially, type = Int[eger], value = first "page label" of the section, the page label being the (physical) page number minus 1). Usually, the very first entry should be (position = [0], value = 0).
    2. object (position = sequentially, type = Dict), and within that object, add
    • * object name = "S", type = Name, value =
      • "D" for a normal numbering with Arabic digits,
        "r" for small roman numerals,
        "R" for capital Roman numerals,
        "A" or "a" for upper/lowercase letters
      * if you want the section not to begin with 1 (or i, or A...) then add this object: name = "St", value = (digit) - the page number you want the section to begin with.
      * you want a prefix to the digit, add object name = "P", type = String, value = what you want. - If want a section to have a fix page "number", use a "P" object but no "S object.
Example: If you want your document to have the first 9 pages with small roman digits with a "*" prefix (*i, *ii, *iii...), and then the remaining ones to have common Arabic numerals beginning from 1984, you should build that tree -under the Catalog entry:
  • PageLabels (Dict)
    • Nums (Array)
      • [0] (Int, 0)
        [1] (Dict)
        • P (String, *)
          S (Name, r)
        [2] (Int, 9)
        [3] (Dict)
        • S (Name, D)
          St (String, 1984)
See also: http://www.adobe.com/devnet/pdf/pdfs/PDFReference13.pdf, pp. 391-393.