Introduction
The element <sourcepdfs> specifies the input files, page ranges, and Table of Contents entry text for the appended document. You can specify more than one input file. To specify multiple page ranges from one file, specify an inputpdf, using the same file, for each page range.
The table below describes the elements specifying <sourcepdfs>.
Contents of the <sourcepdfs> Element
Element | Level | Pro | Required | Content |
---|---|---|---|---|
<appendparam version=”1.0″> | Top | ✔ | Topmost element, contains entire parameter spec | |
<sourcepdfs> | 2 | ✔ | Input files to be appended | |
<inputpdf> | 3 | ✔ | Input PDF file | |
<file> | 4 | ✔ | Text: Name and path of input file | |
<startpage> | 4 | Text: Start page of range to extract | ||
<endpage> | 4 | Text: End page of range to extract | ||
<tocentry> | 4 | Pro | Text: Table of Contents entry | |
+ <inputpdf> | 3 | Additional PDF Files |
XML Code Sample
Specifying an input file.
<appendparam version="1.0"> <!-- . Indicates skipped sections--> <!-- . --> <!-- . --> <sourcepdfs> <inputpdf> <file> /fullpath/input1.pdf </file> <startpage> 3 </startpage> <endpage> 10 </endpage> <TOCEntry> Input File 1 </TOCEntry> </inputpdf> </sourcepdfs> <!-- . --> <!-- . --> <!-- . --> </appendparam>
Elements for <sourcepdfs>
inputpdf
Specifies the details of an input file.
You can specify more than one file by including multiple sets of <inputpdf> tags.
file
Specifies the path and filename of an input PDF file.
startpage, endpage
Specifies the start page and end page of a range of pages to extract and append to the output document. The example above will extract pages 3 through 10 of the input document.
Specifying page ranges
The following notes apply to specifying page ranges:
- If you do not specify a page range, the entire file will be appended.
- You can specify multiple page ranges by specifying the same file in multiple instances of <inputpdf>. For each instance, specify one of the required ranges in a <startpage> and <endpage> set.
- To specify one page, make the value of <startpage> and <endpage> the same.
- To specify from a particular page to the end of the file, use only the <startpage> tag.
- You can specify the last page of a document using -1. This is especially helpful if the number of pages in a document may change.
TOCEntry (AppendPDF Pro only)
Specifies the text to use in the Table of Contents to identify this range of pages. <TOCEntry> is only used if you include a TOC page, see Table of Contents — XML. If you want to append an <inputpdf> without an entry in the Table of Contents, use an empty <TOCEntry> tag as shown below:
<TOCEntry/>
Note: If you are using a TOC page and do not include a <TOCEntry> element for an <inputpdf>, the Title in the Document Properties of the input file will be used as the TOC entry. If the file does not have a Title set, the file name of the <inputpdf> will be used.
Examples
For clarity, the following examples use truncated path names. We recommend that you use full path names for all files. The following examples are from the sample files included with AppendPDF Pro.
Including the entire file
To include the entire file, do not specify a page range:
<sourcepdfs> <inputpdf> <file> ./samples/pdfs/sample1.pdf </file> </inputpdf> </sourcepdfs>
To explicitly specify all pages in a file and a TOC entry
<sourcepdfs> <inputpdf> <file> ./samples/pdfs/sample1.pdf </file> <startpage> 1 </startpage> <endpage> -1 </endpage> <TOCEntry> sample document 1 </TOCEntry> </inputpdf> </sourcepdfs>
Other examples
The following additional examples use a generic example file.
Including one page of a file
To include only page 7 of a file:
<sourcepdfs> <inputpdf> <file> ./samples/example.pdf </file> <startpage> 7 </startpage> <endpage> 7 </endpage> <TOCEntry> example document, page 7 </TOCEntry> </inputpdf> </sourcepdfs>
Including a range to the end of the file
To include from page 7 to the end of the file:
<sourcepdfs> <inputpdf> <file> ./samples/example.pdf </file> <startpage> 7 </startpage> <endpage> -1 </endpage> <TOCEntry> example document, page 7 to end </TOCEntry> </inputpdf> </sourcepdfs>
Including the last page only
To specify the last page when you are not sure what number it will be:
<sourcepdfs> <inputpdf> <file> ./samples/example.pdf </file> <startpage> -1 </startpage> <endpage> -1 </endpage> <TOCEntry> example document, last page </TOCEntry> </inputpdf> </sourcepdfs>