Loading ...
Sorry, an error occurred while loading the content.

Re: [pdflib] Re: TOC that may take more than one page

Expand Messages
  • Thomas Merz
    ... Ah, that s a separate situation; we refer to it as the page x of y problem since you also run into it when you want to print the total number of pages on
    Message 1 of 8 , Apr 1 3:38 AM
    View Source
    • 0 Attachment
      jaymuntz wrote:
      > I don't think I really made it clear.
      >
      > If I fill up the first page of my TOC and go to page 2 of my TOC, all of the page numbers I wrote on page one will be wrong, because in the end document what was page 10 became page 11 when the TOC grew to two pages.
      >
      > In the example (which was very helpful in getting me this far), the number of pages is known to be 10. In my case, it might be ll, but I won't know until I fill up the first page of the TOC. At that point, I've already written the incorrect page numbers onto the first page of the TOC.
      >
      > I think I can get around this by pre-counting the number of lines of TOC I will need, then figuring out how many pages that will be and incrementing the page numbers that I write accordingly. I was just hoping there was a more direct way. I'm afraid the approach I just described will introduce new difficulties as I move forward.

      Ah, that's a separate situation; we refer to it as the
      "page x of y" problem since you also run into it when you
      want to print the total number of pages on each page, where
      this number is not known in advance.

      The PDFlib Cookbook also has sample code for this situation:
      http://www.pdflib.com/pdflib-cookbook/pagination/page-x-of-y/

      The main trick is the use of PDF_suspend_page() to keep a
      page open for later additions, and then use PDF_resume_page()
      to add more content to a previous page. In a sense, you
      can keep a page "open" but continue with the next page
      nevertheless.

      Thomas

      _______________________________________________________________
      Thomas Merz tm@... www.pdflib.com
      PDFlib GmbH, Franziska-Bilek-Weg 9, 80339 München, Germany
      Amtsgericht München HRB 129497, Geschäftsführer Thomas Merz
      ---------------------------------------------------------------
      PDFlib 7: Create PDF/A for archiving, format tables, and more!
      _______PDFlib - a library for generating PDF on the fly________
    • jaymuntz
      I ve got all of that. I ve already read and understood the page x of Y example. I m not saying I have a problem writing page x of y on the footers of
      Message 2 of 8 , Apr 1 5:39 AM
      View Source
      • 0 Attachment
        I've got all of that. I've already read and understood the "page x of Y" example. I'm not saying I have a problem writing "page x of y" on the footers of all of the pages. I'm saying that I can't write the page numbers in the TOC, because at the point when the TOC grows to two pages, I've already the written a bunch of (now incorrect) page numbers on page 1 of the TOC.
      • Lance Cotton
        In the publishing world, the TOC is front matter and is traditionally numbered in lowercase roman numberals. After the front matter, you get the content,
        Message 3 of 8 , Apr 1 6:45 AM
        View Source
        • 0 Attachment
          In the publishing world, the TOC is "front matter" and is traditionally
          numbered in lowercase roman numberals. After the front matter, you get the
          content, which is traditionally numbered with arabic numbering.

          -Lance

          on 4/1/2009 7:39 jaymuntz said the following:
          >
          >
          > I've got all of that. I've already read and understood the "page x of Y"
          > example. I'm not saying I have a problem writing "page x of y" on the
          > footers of all of the pages. I'm saying that I can't write the page
          > numbers in the TOC, because at the point when the TOC grows to two
          > pages, I've already the written a bunch of (now incorrect) page numbers
          > on page 1 of the TOC.
          >
          >
        • jaymuntz
          I hear that about front matter. My idea is that when reading a PDF in Adobe Reader, it s nice if the page numbers align with Reader s notion of the page
          Message 4 of 8 , Apr 1 8:39 AM
          View Source
          • 0 Attachment
            I hear that about front matter. My idea is that when reading a PDF in Adobe Reader, it's nice if the page numbers align with Reader's notion of the page numbers, which makes it possible to go page 16 by typing 16 in the page number box.

            To my knowledge, the PDF specification does not include support for front matter. So my solution is to start with the cover page as page one, so the user doesn't experience the mismatch between Reader's page number and the document's page number.

            We're trying to get a result that will work for the end user effortlessly whether he chooses to read the document in Reader or print it out. To us this means to include page numbers in the document (for those who print it out), but make them match the page numbers that Reader uses (so we don't tax the brains of users who see the page they're looking at has two different page numbers).

            Anyway, I think I'll plow ahead by figuring out how many TOC entries fit on a page, then counting the number of TOC entries and renumbering my pages before I start writing the TOC. I'm more confident that that's going to work then when I started this thread. Thanks for the help.



            --- In pdflib@yahoogroups.com, Lance Cotton <lcotton+pdflib@...> wrote:
            >
            > In the publishing world, the TOC is "front matter" and is traditionally
            > numbered in lowercase roman numberals. After the front matter, you get the
            > content, which is traditionally numbered with arabic numbering.
            >
            > -Lance
            >
            > on 4/1/2009 7:39 jaymuntz said the following:
            > >
            > >
            > > I've got all of that. I've already read and understood the "page x of Y"
            > > example. I'm not saying I have a problem writing "page x of y" on the
            > > footers of all of the pages. I'm saying that I can't write the page
            > > numbers in the TOC, because at the point when the TOC grows to two
            > > pages, I've already the written a bunch of (now incorrect) page numbers
            > > on page 1 of the TOC.
            > >
            > >
            >
          • Thomas Merz
            ... PDF and PDFlib support a mechanism called page labels which you can use to separate physical from logical page numbers. For example, using suitable page
            Message 5 of 8 , Apr 1 3:17 PM
            View Source
            • 0 Attachment
              jaymuntz wrote:
              > I hear that about front matter. My idea is that when reading a PDF in Adobe Reader, it's nice if the page numbers align with Reader's notion of the page numbers, which makes it possible to go page 16 by typing 16 in the page number box.
              >
              > To my knowledge, the PDF specification does not include support for front matter. So my solution is to start with the cover page as page one, so the user doesn't experience the mismatch between Reader's page number and the document's page number.
              >
              > We're trying to get a result that will work for the end user effortlessly whether he chooses to read the document in Reader or print it out. To us this means to include page numbers in the document (for those who print it out), but make them match the page numbers that Reader uses (so we don't tax the brains of users who see the page they're looking at has two different page numbers).
              >
              > Anyway, I think I'll plow ahead by figuring out how many TOC entries fit on a page, then counting the number of TOC entries and renumbering my pages before I start writing the TOC. I'm more confident that that's going to work then when I started this thread. Thanks for the help.

              PDF and PDFlib support a mechanism called "page labels" which you
              can use to separate physical from logical page numbers. For example,
              using suitable page labels the user can type "ii" in Acrobat in
              order to jump to page 2 (= ii) of the TOC, and then "2" will jump
              to the actual page 2 of the contents.

              The insert-toc Cookbook sample also demonstrates how to generate
              page labels for the front matter.

              Thomas

              _______________________________________________________________
              Thomas Merz tm@... www.pdflib.com
              PDFlib GmbH, Franziska-Bilek-Weg 9, 80339 München, Germany
              Amtsgericht München HRB 129497, Geschäftsführer Thomas Merz
              ---------------------------------------------------------------
              PDFlib 7: Create PDF/A for archiving, format tables, and more!
              _______PDFlib - a library for generating PDF on the fly________
            Your message has been successfully submitted and would be delivered to recipients shortly.