Installation & Setup
Get Scryber.Core installed and configured in your .NET project in minutes.
Learning Objectives
By the end of this article, you’ll be able to:
- Install Scryber.Core via NuGet
- Configure your project for PDF generation
- Verify your installation
- Set up your IDE for optimal development
Prerequisites
- .NET 6.0 or later (or .NET Framework 4.6.2+)
- Visual Studio 2022, VS Code, or Rider
- Basic C# knowledge
Installation Methods
Method 1: NuGet Package Manager (Visual Studio)
- Open your project in Visual Studio
- Right-click on your project in Solution Explorer
- Select Manage NuGet Packages
- Click the Browse tab
- Search for
Scryber.Core - Click Install

Method 2: Package Manager Console
Install-Package Scryber.Core
Method 3: .NET CLI
dotnet add package Scryber.Core
Method 4: Direct .csproj Edit
<ItemGroup>
<PackageReference Include="Scryber.Core" Version="6.*" />
</ItemGroup>
Then restore packages:
dotnet restore
Project Types Supported
Scryber.Core works with various .NET project types:
| Project Type | Supported | Notes |
|---|---|---|
| ASP.NET Core | ✅ | Web applications, APIs |
| Console App | ✅ | Batch processing, CLI tools |
| Windows Forms | ✅ | Desktop applications |
| WPF | ✅ | Desktop applications |
| Azure Functions | ✅ | Serverless PDF generation |
| Blazor Server | ✅ | Interactive web apps |
| Blazor WebAssembly | ⚠️ | Limited (requires server-side generation) |
| .NET Framework 4.6.2+ | ✅ | Legacy applications |
Verifying Installation
Create a simple test to verify Scryber is installed correctly:
using Scryber.Components;
using System.IO;
namespace ScryberTest
{
class Program
{
static void Main(string[] args)
{
// Create a simple HTML document
string html = @"
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Installation Test</title>
</head>
<body>
<h1>Hello, Scryber!</h1>
<p>If you can see this PDF, Scryber is installed correctly.</p>
</body>
</html>";
// Parse and generate PDF
using (var reader = new StringReader(html))
{
var doc = Document.ParseDocument(reader, ParseSourceType.DynamicContent);
using (var stream = new FileStream("test.pdf", FileMode.Create))
{
doc.SaveAsPDF(stream);
}
}
Console.WriteLine("PDF generated successfully: test.pdf");
}
}
}
Run the program:
dotnet run
Expected output:
PDF generated successfully: test.pdf
Open test.pdf to verify it contains “Hello, Scryber!”
IDE Setup
Visual Studio
Recommended Extensions:
- C# IntelliSense (built-in)
- NuGet Package Manager (built-in)
- HTML/CSS IntelliSense (built-in)
Project Configuration:
- Target Framework: .NET 6.0 or later recommended
- Language Version: C# 10.0 or later
- Nullable Reference Types: Optional but recommended
VS Code
Required Extensions:
- C# Dev Kit (Microsoft)
- HTML CSS Support
- XML Tools (for XHTML templates)
Create .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/YourProject.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "internalConsole"
}
]
}
Rider
Setup:
- Open your solution in Rider
- NuGet packages are managed automatically
- Rider provides excellent HTML/CSS support out of the box
Project Structure
Recommended folder structure for Scryber projects:
YourProject/
├── Program.cs # Entry point
├── Templates/ # HTML/XHTML templates
│ ├── invoice.html
│ ├── report.html
│ └── letter.html
├── Styles/ # External CSS files
│ ├── common.css
│ └── invoice.css
├── Images/ # Static images
│ ├── logo.png
│ └── background.jpg
├── Fonts/ # Custom fonts (optional)
│ └── CustomFont.ttf
└── Output/ # Generated PDFs
└── .gitkeep
Add to .gitignore:
# Scryber output
Output/*.pdf
# But keep the directory
!Output/.gitkeep
Configuration Options
appsettings.json (ASP.NET Core)
{
"Scryber": {
"TemplateDirectory": "./Templates",
"ImageDirectory": "./Images",
"OutputDirectory": "./Output",
"DefaultFontFamily": "Arial",
"CacheTemplates": true
}
}
Dependency Injection Setup (ASP.NET Core)
using Microsoft.Extensions.DependencyInjection;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// Add Scryber services (if using ASP.NET Core)
services.AddScryber();
}
}
Common Installation Issues
Issue 1: NuGet Package Not Found
Problem: Cannot find Scryber.Core in NuGet
Solution:
- Ensure NuGet package sources include nuget.org
- Clear NuGet cache:
dotnet nuget locals all --clear - Check internet connection
Issue 2: Version Conflicts
Problem: Dependency version conflicts
Solution:
<ItemGroup>
<PackageReference Include="Scryber.Core" Version="6.*" />
<!-- Explicitly specify conflicting dependencies if needed -->
</ItemGroup>
Issue 3: .NET Framework Compatibility
Problem: Cannot install on .NET Framework project
Solution:
- Ensure project targets .NET Framework 4.6.2 or later
- Update project file: ```xml
### Issue 4: File Access Permissions
**Problem:** Cannot write PDF files
**Solution:**
- Ensure output directory exists
- Check folder permissions
- Use absolute paths for testing:
```csharp
string outputPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
"test.pdf"
);
Performance Considerations
For High-Volume Scenarios
// Use object pooling for better performance
public class PdfService
{
private readonly ObjectPool<Document> _docPool;
public PdfService()
{
_docPool = new DefaultObjectPool<Document>(
new DocumentPooledObjectPolicy(),
maxRetained: 10
);
}
public byte[] GeneratePdf(string template, object data)
{
var doc = _docPool.Get();
try
{
// Generate PDF
using (var ms = new MemoryStream())
{
doc.SaveAsPDF(ms);
return ms.ToArray();
}
}
finally
{
_docPool.Return(doc);
}
}
}
Next Steps
Now that Scryber is installed and configured:
- Create Your First Document - Build a simple PDF from scratch
- HTML to PDF - Learn how HTML converts to PDF
- Troubleshooting - If you encounter issues
Additional Resources
- Scryber GitHub - Source code and issues
- NuGet Package - Official package
- API Documentation - Complete API reference
Ready to create your first PDF? → Your First Document