In scryber we have things called 'Components'. They are the building blocks of a document and refer to actual coded Types in the assemblies.
There are lots of components built into the scryber library - enough to suit most of the needs of most of the users.
These can be grouped under the following categories
The root of a PDF document containing document info, style declarations and pages
A single page in a document (content will not overflow on to a new page in the output). Pages also have a Header and a Footer which display at the top and bottom of the page, and will constrain the available size for content. Numbering options for the page are applied via styles for both the format and start index.
One or more output pages as content flows over after filling the previous page or an explicit page break was encountered. Sections inherit from Pages and the only real differences are that the Section has a default overflow action of NewPage and also declares a ContinuationHeader/Footer property that can be assigned. Pages can still overflow their content on to new output pages if their overflow style is set to NewPage.
- Panels - Scryber.Components.PDFPanel
Base container component that will flow content or position the content within a page. Can be nested with other layout components to any level.
- PageBreak - Scryber.Components.PDFPageBreak
Stops the layout on the current page and requests a new output page to continue rendering on. If the page or section cannot overflow onto a new page then the layout will stop at this point an no further components will be rendered to the output PDF.
- ColumnBreak - Scryber.Components.PDFColumnBreak
Similar to the PageBreak it will start layout at the next column rather than page. If the current container component does not have columns (effectively this is just one column), then a new page will be requested.
- Inline text - Scryber.Components.PDFTextLiteral
Any text that is directly entered into the content of a component is treated as a text literal. The flow of this text is inline with the rest of the content and supports a minimal set of styling attributes applied inline such as B (bold), I (italic), BR (line break).
- Label - Scryber.Components.PDFLabel
This is a more concrete textual component that can support the same textual content and styling of strings as the text literal. The label also has a 'text' attribute that can be data bound to for dynamic assignment. The default layout for a Label is inline with the rest of the content
- Para - Scryber.Components.PDFParagraph
Similar to the Label, but defaults to a block layout mode - i.e. It will start on a new line and close the line at the end.
- H1, H2, H3, H4, H5, H6 - Scryber.Components.PDFHead1...6
A series of 6 classes all inheriting from the abstract PDFHeadingBase class. Each defines their own style (which can be overridden) and like the PDFLabel class include a text attribute that can be data bound.
- Line - Scryber.Components.PDFLine
By default this will be a full width black 1pt line across the available page or column. If only the height is set, then it will be a vertical line, set both and it will be a block component at the required angle. Position it with an X and Y value.
- Link - Scryber.Components.PDFLink
The link is a flexible component will take users to another destination in the current file, a new file or even a web link. It will accept either a link to a destination - internality by component name; to an external file (optionally including a destination in that file), or some form of navigation such as first next previous or last page. The link is a fully qualified component that can accept any component content
- PageNumber - Scryber.Components.PDFPageNumber
Displays the current page number (either within the current numbering or globally within the document). It will also display the total number of pages globally or within the current section.
- PageLocator - Scryber.Components.PDFPageLocator
Displays the number of the page a component is (first) arranged on.
- UserComponent - Scryber.Components.PDFUserComponent
The UserComponent is declared in the schema as a full root element. Using this as a root element enables the schema to interpret a new file that can be referenced as external content in another file. There is no reason why the parser cannot interpret an external component of another type, but the schema of the user component may be extended in the future to include extra functionality, so it is recommended to keep this type as the root element.
Data Binding Components
This is when we get really clever! The data binding components are covered in the Data binding with XPath section, but generally they support the creation of new content and modifying existing content based on a datasource. If you are familiar with xslt then most of the techniques will come naturally.
- XMLDataSource - Scryber.Data.PDFXMLDataSource
Defines the root source for data. Specify the path to either a file or a remote source, any cache duration required, along with an optional transform file. The result of this will can be used as data for generating content.
- ForEach - Scryber.Data.PDFForEach
The ForEach component enumerates through a set of nodes in a datasource. The component has an internal template of components a new instance of this template will be generated for each item from the source. The source is optionally specified either directly in code or via the ID of the datasource component, or simply accepts the current inner source from an outer data component. An optional XPath select statement restricts the results to the required data.
- If - Scryber.Data.PDFIf
The 'If'' component is one of 2 conditional components used in data binding. It has a single 'test' attribute accepting an XPath expression. If this expression returns true then the contents of the component will be generated (and then data bound themselves). If the expression returns false then no content will be generated.
- Choose, When, Otherwise - Scryber.Data.PDFChoose
The Choose construct is the second, more complex conditional component for data binding. Within the choose can be any number of When components with a required 'test' XPath expression and optionally one Otherwise component. The When components are evaluated in order of appearance and if one returns true then the contents of that component are generated. If no expressions return true, then any Otherwise component's contents will be generated.
All of these components support the style infrastructure built into the scryber library. More info about this can be found in Understanding Styles page.