How We Solved the Page Range Problem

History

RPM has supported page range printing from early days. However, this was in the text print action where we knew the content of each page in detail.

As we developed RPM 5.0 we realized people were going to want more page range functions, particularly ones that apply to ranges of data. This way you could select ranges, and convert them to PDF, print or email. 

How it works

Ranges in text data are established in two ways:

  1. by line count
  2. text search, for instance, a string you can search for like "PAGE 001" or perhaps a form feed.

Line count example

Let's say you have a ten thousand line text file, and you want to extract pages ten through one hundred. If the file has sixty lines per page, you would get lines lined 541 through 6000.

To do with that RPM you would use these transforms:

  • remove lines, count=540
  • limit lines, count=5460

After that you can use text markup, print to Windows, print to a PDF file, or anything else.

Text search examples

Let's use RFC5969 as an example (see http://www.ietf.org/rfc.html). The last line of each page looks like this:

Townsley & Troan             Standards Track                    [Page 1]

followed by a form feed.

  • To select pages 1 through 10:
  1. Remove After transform, search = "[Page 10]"

This passes through all the text up to the line with "[Page 10]" and eliminates everything after.

  • To select pages 6 through 10:
  1. Remove Until transform, search = "[Page 5]"
  2. Remove Until transform, search = "\f"
  3. Remove After transform, search = "[Page 10]"

This will remove through the end of page 5, then the form feed, then pass through everything to the bottom of page 10.