# pdfset element

Type: | Document Structure
Attributes: | class • colorspace • direction • id • lang
See: | body pdf

The pdfset element may optionally be used a top-level element in the XML, to combine multiple documents into one. The pdfset element must have one or more pdf children, which may either have a body as normal or a src attribute and no children, to combine a previously created PDF.
Bookmarks will be combined from all children in the final document. Form fields will be combined, and if both documents contains a field with the same name and value they will be merged into one field. If the documents have two different fields with the same name, an error is thrown.
Other document-wide properties - encryption, metadata and so on - will be taken from the first child. Values in subsequent children will be ignored.
The advantage to using a pdfset rather than one large pdf is primarily memory - creating and combining two 5,000 page documents requires roughly half the memory required to create one 10,000 page document. The smaller the files, the less benefit there will be be.
See also the Xinclude, which can be used to make managing the different sections a bit easier.
The pdfset element was added in release 1.1.51

This creates a PDF from a preexisting cover, then two regular documents created in the normal way.

    <pdfset>

      <pdf src="resource/coverpdf.pdf" />

      <pdf>
        <body>
          Document body here
        </body>
      </pdf>

      <pdf>
        <body>
          Document trailer here
        </body>
      </pdf>

    </pdfset>