PdfImposition Class
Arranges pages on sheets (N-up) and splits the spreads of scanned books into pages.
public static class PdfImpositionMethods
| Name | Description |
|---|---|
| CreateNUp(PdfDocument, PdfNUpOptions) | Creates a document whose sheets show several pages of a document each, such as two pages side by side (2-up) or four pages on a sheet (4-up): each page is scaled to fit its cell, keeping its proportions, centered, and upright whatever its rotation. The source document is not changed. |
| SplitSpreads(PdfDocument, PdfSpreadSplitOptions?) | Splits the pages that show two pages side by side, such as the spreads of a scanned book, into two pages: the page shows its left half, and a copy of it, inserted after it, its right half (or the reverse, from right to left). The halves are the halves of the page as it is displayed, its rotation applied. |
CreateNUp(PdfDocument, PdfNUpOptions)
PdfImposition.csCreates a document whose sheets show several pages of a document each, such as two pages side by side (2-up) or four pages on a sheet (4-up): each page is scaled to fit its cell, keeping its proportions, centered, and upright whatever its rotation. The source document is not changed.
public static PdfDocument CreateNUp(PdfDocument source, PdfNUpOptions options)Parameters
sourcePdfDocument- The document whose pages are arranged.
optionsPdfNUpOptions- The grid of the sheets.
Returns
PdfDocument The new document: PdfNUpOptions.Columns times PdfNUpOptions.Rows pages per sheet, the last sheet with the pages left.
Exceptions
ArgumentException- The margins and the spacing leave no room for the cells.
InvalidPdfContentException- A content stream of a page cannot be decoded.
Remarks
The pages are copied as forms (PdfDocument.CreateFormFromPage): their annotations, links and form fields are not part of the sheets.
SplitSpreads(PdfDocument, PdfSpreadSplitOptions?)
PdfImposition.csSplits the pages that show two pages side by side, such as the spreads of a scanned book, into two pages: the page shows its left half, and a copy of it, inserted after it, its right half (or the reverse, from right to left). The halves are the halves of the page as it is displayed, its rotation applied.
public static int SplitSpreads(PdfDocument document, PdfSpreadSplitOptions? options = null)Parameters
documentPdfDocument- The document, changed in place.
optionsPdfSpreadSplitOptions?- The options, or
nullforPdfSpreadSplitOptions.Default.
Returns
int The number of pages split.
Exceptions
ArgumentException- The gutter is wider than a page.
Remarks
The halves are crop boxes: the content of the page is kept, and the copy shares it. The trim, bleed and art boxes of the pages split are removed, since they describe the spread.