Version 5.9.2

# `SavePages`

This command is used for two different but similar purposes.

1: Everything enclosed in `SavePages` is saved internally and not placed into the PDF. Useful if the output might be discarded.

2: “Future mode”: Create pages that have been previously reserved by `InsertPages`.

## Child elements

`AddSearchpath`, `AttachFile`, `Bookmark`, `ClearPage`, `Copy-of`, `DefineColor`, `DefineFontalias`, `DefineFontfamily`, `DefineMatter`, `DefineTextformat`, `ForAll`, `Group`, `Hyphenation`, `Include`, `InsertPages`, `Layout`, `LoadDataset`, `LoadFontfile`, `Loop`, `Message`, `NextFrame`, `NextRow`, `Options`, `Output`, `PDFOptions`, `Pageformat`, `Pagetype`, `PlaceObject`, `ProcessNode`, `SaveDataset`, `SavePages`, `Section`, `SetGrid`, `SetVariable`, `SortSequence`, `StructureElement`, `Switch`, `Until`, `Value`, `While`

## Parent elements

`AtPageCreation`, `AtPageShipout`, `Case`, `Contents`, `ForAll`, `Loop`, `Otherwise`, `Record`, `SavePages`, `Until`, `While`

## Attributes

`name` (text)
  The name of the discarded output (1) or for the reserved pages (2). For later/earlier retrieval with `InsertPages`.

## Remarks

The second mode has been introduced in version 3.7.12.

## Example

First mode:

    <Record element="data">
      <SavePages name="foo">
        <Loop select="100">
          <PlaceObject>
            <Textblock>
              <Paragraph><Value>Hello world</Value></Paragraph>
            </Textblock>
          </PlaceObject>
        </Loop>
      </SavePages>
      <Message select="sd:count-saved-pages('foo')"/>
      <InsertPages name="foo"/>
    </Record>

“Future mode”

    <Layout xmlns="urn:speedata.de:2009/publisher/en"
        xmlns:sd="urn:speedata:2009/publisher/functions/en">
        <Pageformat height="5cm" width="5cm"/>

        <Record element="data">
            <InsertPages name="firstpage" pages="1"/>
            <Loop select="4" variable="n">
                <PlaceObject>
                    <Textblock>
                        <Paragraph>
                            <Value select="$n" />
                        </Paragraph>
                    </Textblock>
                </PlaceObject>
                <ClearPage />
            </Loop>
            <SavePages name="firstpage">
                <PlaceObject>
                    <Textblock>
                        <Paragraph>
                            <Value>This will be the first page</Value>
                        </Paragraph>
                    </Textblock>
                </PlaceObject>
            </SavePages>
        </Record>
    </Layout>

#### On this page