Skip to main content Link Search Menu Expand Document Toggle dark mode Copy Code (external link)

Scryber Configuration and Extension

Scryber provides a comprehensive configuration and extension system that allows you to customize behavior, add custom components, integrate with external systems, and implement code-behind logic for PDF templates.

Overview

This documentation covers the complete architecture for extending and configuring Scryber:

Document Configuration

Applies to individual document templates

Core Engine Configuration

Applies to all documents within the application or process.

Extension Mechanisms

Applies to any number of applications or processes

In the Code

How the library works, a documents’ lifecycle and creating and setting standard values.

  • Library Architecture - An overview of the libraries, important namespaces and class hierarchies, and the strategies used for parsing; layout; and rendering.
  • Working in Code - Details many of the standard classes used and ways to create component trees, set typed style values, and safely parse CSS-like values from configuration.

Integration


Quick Start

Basic Configuration

{
  "Scryber": {
    "Parsing": {
      "Namespaces": [ /* Custom component namespaces */ ]
    },
    "Fonts": {
      "Register": [ /* Custom fonts */ ]
    },
    "Imaging": {
      "Factories": [ /* Custom image loaders */ ]
    }
  }
}

Using Processing Instructions

<?xml version='1.0' encoding='utf-8' ?>
<?scryber parser-mode='Strict' 
          log-level='Warnings'
          controller='MyNamespace.MyController, MyAssembly' ?>
<html xmlns='http://www.w3.org/1999/xhtml'>
    <!-- Document content -->
</html>

Creating a Controller

public class MyController
{
    [PDFOutlet(Required = true)]
    public Label TitleLabel { get; set; }
    
    public void Init(InitContext context)
    {
        TitleLabel.Text = "Generated at " + DateTime.Now;
    }
}

Initializing the configuration in Scryber.Core

Extension Points Summary

Extension Point Purpose Configuration
Processing Instructions Document-level settings <?scryber ... ?>
Controllers Code-behind with outlets/actions controller='Type, Assembly'
Custom Components Reusable widgets Namespace registration
Image Factories Custom image sources Imaging:Factories[]
Font Registration Custom fonts Fonts:Register[]
Namespaces Component discovery Parsing:Namespaces[]

Architecture Principles

  1. Dependency Injection - Configuration via IScryberConfigurationService
  2. Lazy Loading - Types, assemblies, fonts loaded on-demand
  3. Caching - Reflected definitions cached for performance
  4. Thread Safety - Configuration access protected with locks
  5. Convention over Configuration - Sensible defaults, explicit overrides

Next Steps


Documentation Version: 1.0
Last Updated: February 2026
Target: Scryber.Core 6.x / 7.x


Table of contents