# Devexpress Office File Api Pdf

> Build .NET applications with the DevExpress PDF Document API for creating, reading, editing, merging, signing, and extracting content from PDF files programmatically. Use when working with PDF documents, PDF generation, PDF graphics API, interactive PDF forms, digital signatures, PDF/A compliance, text extraction, image extraction, PDF merging/splitting, bookmarks, hyperlinks, annotations, or XMP…

- **Type:** Skill
- **Install:** `agentstack add skill-devexpress-agent-skills-devexpress-office-file-api-pdf`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [DevExpress](https://agentstack.voostack.com/s/devexpress)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [DevExpress](https://github.com/DevExpress)
- **Source:** https://github.com/DevExpress/agent-skills/tree/main/plugins/dx-office-file-api/skills/devexpress-office-file-api-pdf
- **Website:** https://www.devexpress.com

## Install

```sh
agentstack add skill-devexpress-agent-skills-devexpress-office-file-api-pdf
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# DevExpress PDF Document API

The PDF Document API is a non-visual .NET library for creating, loading, editing, merging, splitting, signing, and extracting content from PDF documents — without requiring Adobe Acrobat. It supports both new document generation via a graphics API and processing of existing PDFs through `PdfDocumentProcessor`. Features include interactive AcroForm fields, digital signatures (PKCS#7, PAdES), password protection, annotations, bookmarks, hyperlinks, content extraction, and XMP metadata management.

## When to Use This Skill

Use this skill when you need to:

- Create new PDF files from scratch using a graphics drawing API
- Load and modify existing PDF files (rotate pages, add content, change properties)
- Merge multiple PDF files into one or split pages out of a document
- Add or reorder pages, copy pages between documents
- Draw text, images, rectangles, lines, ellipses, and paths on PDF pages
- Create interactive AcroForms (text boxes, check boxes, combo boxes, radio groups, signature fields)
- Read and write AcroForm field values, or flatten forms
- Apply digital signatures (PKCS#7, PAdES) using PFX files or custom signers (Azure Key Vault)
- Validate existing digital signatures in PDFs
- Protect PDFs with user/owner passwords and restrict permissions (printing, editing, copying)
- Add annotations (highlight, underline, sticky notes, redaction) to pages
- Add bookmarks, hyperlinks, and file attachments
- Extract text (with word coordinates), search text, or extract images from PDF pages
- Convert PDFs to PDF/A-1b, PDF/A-2b, PDF/A-3b compliance
- Read and write XMP metadata packets
- Print PDFs with custom printer settings

## Prerequisites & Installation

### NuGet Packages

| Package | Purpose |
|---------|---------|
| `DevExpress.Document.Processor` | Core PDF processing: create, load, edit, merge, sign, extract |
| `DevExpress.Pdf.SkiaRenderer` | Cross-platform rendering and image export (.NET 6+) |

### .NET (6/7/8+)

```bash
dotnet add package DevExpress.Document.Processor
dotnet add package DevExpress.Pdf.SkiaRenderer  # For rendering/export on .NET 6+
```

### .NET Framework (4.6.2+)

```
Install-Package DevExpress.Document.Processor
```

On .NET Framework, GDI+ is used for rendering — `DevExpress.Pdf.SkiaRenderer` is not required. See [references/getting-started-dotnet-fw.md](references/getting-started-dotnet-fw.md) for assembly references.

**Important**: All DevExpress packages in a project must share the same version number. A valid DevExpress license is required.

## Before You Start — Ask the Developer

Before generating code, ask these questions to avoid rework:

### General Questions
1. **Target framework**: Are you using .NET 8+, .NET 6/7, or .NET Framework 4.x?
2. **New or existing project?**: Creating new or adding to existing?
3. **Hosting model**: Console app, ASP.NET Core, Blazor, MAUI, WinForms, WPF, or something else?

### PDF-Specific Questions
4. **Operation type**: Generate new PDF from scratch / read-extract from existing / merge-split / sign / protect / add interactive forms / add annotations?
5. **Starting point**: Create from scratch with graphics API / convert from another format / process an existing PDF?
6. **Output needed**: Modified PDF / extracted text or images / image render of pages / validated signature?

> **Rule**: If the developer's answer is ambiguous or missing, ask before generating code. Do not guess.

## Component Overview

The PDF Document API provides:

- **Document processing** (`PdfDocumentProcessor`): Open, save, merge, organize pages, rotate, resize, extract content, print
- **Graphics drawing** (`PdfGraphics`): Draw text, images, shapes, and links on new or existing pages
- **Interactive forms** (`PdfAcroFormField`, `PdfDocumentFacade`): Create, read, write, and flatten AcroForm fields
- **Document security** (`PdfEncryptionOptions`, `PdfDocumentSigner`, `Pkcs7Signer`): Password protection, digital signatures, signature validation
- **Annotations** (`PdfPageFacade`, `PdfMarkupAnnotationFacade`): Add, edit, and remove markup and redaction annotations
- **Content extraction**: Extract text with coordinates, search text, extract embedded images
- **XMP metadata** (`XmpDocument`): Read and write XMP metadata packets

### Core Entry Points

```csharp
using DevExpress.Pdf;

// --- Process an existing PDF ---
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.LoadDocument("input.pdf");
    // modify pages, extract content, sign, etc.
    processor.SaveDocument("output.pdf");
}

// --- Create a new PDF from scratch ---
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.CreateEmptyDocument("output.pdf");
    using (PdfGraphics graph = processor.CreateGraphicsPageSystem())
    {
        // draw content here
        processor.RenderNewPage(PdfPaperSize.Letter, graph);
    }
}
```

## Documentation & Navigation Guide

### Getting Started
Refer to [references/getting-started.md](references/getting-started.md)

When you need to:
- Set up the PDF Document API for the first time (.NET 6+)
- Install NuGet packages and configure your project
- Create your first PDF document
- Load, modify, and save an existing PDF

### Getting Started (.NET Framework)
Refer to [references/getting-started-dotnet-fw.md](references/getting-started-dotnet-fw.md)

When you need to:
- Set up the PDF Document API in a .NET Framework 4.6.2+ project
- Reference the correct assemblies (GDI+ rendering path)
- Understand .NET Framework-specific limitations

### Document Generation
Refer to [references/document-generation.md](references/document-generation.md)

When you need to:
- Create a new PDF file from scratch
- Draw text, images, and shapes on pages
- Render pages from graphics content
- Set PDF/A compatibility mode
- Control font embedding

### PDF Graphics API
Refer to [references/pdf-graphics.md](references/pdf-graphics.md)

When you need to:
- Draw text (`DrawString`), measure text (`MeasureString`)
- Draw images, rectangles, ellipses, lines, polygons, Bezier curves, paths
- Add hyperlinks to a page
- Apply transforms (scale, rotate, translate)
- Save and restore the graphics state
- Add graphics to an existing page foreground or background

### Document Manipulation
Refer to [references/document-manipulation.md](references/document-manipulation.md)

When you need to:
- Merge multiple PDFs into one
- Add, insert, copy, or delete pages
- Rotate or resize pages
- Scale, rotate, or offset page content
- Convert to PDF/A-2b or PDF/A-3b
- Optimize file size with object streams

### Interactive Forms
Refer to [references/interactive-forms.md](references/interactive-forms.md)

When you need to:
- Create text boxes, check boxes, combo boxes, list boxes, radio groups, or signature fields
- Read or write field values in an existing form
- Change form field appearance properties
- Flatten a form (bake fields into page content)
- Import/export AcroForm data

### Document Security
Refer to [references/document-security.md](references/document-security.md)

When you need to:
- Protect a PDF with a user password (restrict opening)
- Protect a PDF with an owner password and restrict permissions (printing, copying, editing)
- Apply a PKCS#7 or PAdES digital signature using a PFX certificate
- Apply signatures with timestamps (TSA)
- Validate or verify existing signatures
- Use deferred or external signing (Azure Key Vault, hardware tokens)

### Content Extraction
Refer to [references/content-extraction.md](references/content-extraction.md)

When you need to:
- Extract all text from a PDF page
- Search for a text string and get word/character coordinates
- Extract embedded images from pages
- Get word bounding boxes in page coordinates

### Annotations
Refer to [references/annotations.md](references/annotations.md)

When you need to:
- Add markup annotations (highlight, underline, strikeout, squiggly)
- Add sticky notes or other markup annotation types
- Add redaction annotations and apply them
- Edit, flatten, or remove annotations
- Add comments or reviews to annotations

### New PDF Document API (CTP — v26.1+)

> **CTP Warning**: The new `DevExpress.Docs.Pdf` namespace is a Community Technology Preview. Do not use in mission-critical production applications.

A separate, object-oriented PDF API (`PdfDocument`, `Page`, fragment-based content model) is available as a CTP alongside this legacy API. Both can coexist in one project. Use the **devexpress-pdf-new** skill for the new API.

## Quick Start Example

A complete example — create a PDF with a title, body text, and a colored rectangle:

```csharp
using DevExpress.Drawing;
using DevExpress.Pdf;
using System.Drawing;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    // Create an empty document
    processor.CreateEmptyDocument("QuickStart.pdf");

    // Create a graphics context using the page coordinate system
    using (PdfGraphics graph = processor.CreateGraphicsPageSystem())
    {
        // Draw a filled rectangle (banner)
        graph.FillRectangle(new DXSolidBrush(Color.FromArgb(68, 114, 196)),
            new RectangleF(30, 30, 540, 60));

        // Draw title text in white
        using (DXFont titleFont = new DXFont("Arial", 24, DXFontStyle.Bold))
        {
            graph.DrawString("DevExpress PDF Report", titleFont,
                new DXSolidBrush(Color.White), 40, 45);
        }

        // Draw body text in black
        using (DXFont bodyFont = new DXFont("Arial", 11))
        {
            graph.DrawString(
                "This document was generated programmatically with the DevExpress PDF Document API.",
                bodyFont, new DXSolidBrush(Color.Black), 30, 120);
        }

        // Render the page (Letter size = 612 x 792 points)
        processor.RenderNewPage(PdfPaperSize.Letter, graph);
    }
}
```

### What This Does
Creates a single-page Letter-size PDF with a blue banner, white title text, and a body paragraph. The file `QuickStart.pdf` is saved to the working directory. See [examples/quickstart.cs](examples/quickstart.cs) for the full compilable console app version.

## Key Properties & API Surface

### PdfDocumentProcessor

| Property/Method | Type | Description |
|----------------|------|-------------|
| `LoadDocument(path)` | `void` | Load a PDF file from disk |
| `LoadDocument(stream, password)` | `void` | Load from stream with optional password |
| `CreateEmptyDocument(path)` | `void` | Create a new empty PDF |
| `CreateEmptyDocument(path, options)` | `void` | Create with `PdfCreationOptions` (PDF/A, font embedding) |
| `SaveDocument(path)` | `void` | Save the current document |
| `SaveDocument(path, PdfSaveOptions)` | `void` | Save with encryption/signature options |
| `AppendDocument(path)` | `void` | Merge another PDF into the current document |
| `RenderNewPage(paperSize, graphics)` | `void` | Append a new page rendered from a `PdfGraphics` |
| `DeletePage(pageNumber)` | `void` | Delete a page by 1-based number |
| `AddNewPage(rect)` | `void` | Append a blank page |
| `InsertNewPage(pageNum, rect)` | `void` | Insert a blank page at position |
| `CreateGraphicsPageSystem()` | `PdfGraphics` | Create graphics in page coordinate system |
| `CreateGraphicsWorldSystem()` | `PdfGraphics` | Create graphics in world coordinate system |
| `Document` | `PdfDocument` | Access raw document model (pages, metadata) |
| `DocumentFacade` | `PdfDocumentFacade` | High-level facade for annotations, forms, layers |
| `FindText(textToFind)` | `PdfTextSearchResults` | Search text across all pages |
| `GetText(pageNumber)` | `IList` | Get words from a page with coordinates |
| `GetDXImages(pageNumber)` | `IList` | Extract images from a page |
| `Print(printerSettings)` | `void` | Print the document |

### PdfGraphics

| Method | Description |
|--------|-------------|
| `DrawString(text, font, brush, x, y)` | Draw text at a point |
| `DrawString(text, font, brush, rect, format)` | Draw text within a rectangle |
| `MeasureString(text, font)` | Measure rendered text size |
| `DrawImage(image, rect)` | Draw an image |
| `DrawRectangle(pen, rect)` | Draw a rectangle outline |
| `FillRectangle(brush, rect)` | Fill a rectangle |
| `DrawEllipse(pen, rect)` | Draw an ellipse outline |
| `FillEllipse(brush, rect)` | Fill an ellipse |
| `DrawLine(pen, x1, y1, x2, y2)` | Draw a line |
| `DrawPath(pen, path)` | Draw a graphics path |
| `FillPath(brush, path)` | Fill a graphics path |
| `AddLinkToUri(rect, uri)` | Add a hyperlink to a URI |
| `AddLinkToPage(rect, pageNum, x, y)` | Add a link to a page destination |
| `AddFormField(field)` | Add an AcroForm field |
| `AddToPageForeground(page)` | Stamp graphics on existing page foreground |
| `AddToPageBackground(page)` | Stamp graphics on existing page background |
| `ScaleTransform(sx, sy)` | Scale the coordinate system |
| `RotateTransform(angle)` | Rotate the coordinate system |
| `TranslateTransform(dx, dy)` | Translate the origin |
| `SaveGraphicsState()` | Save current graphics state |
| `RestoreGraphicsState()` | Restore previously saved graphics state |

## Common Patterns

### Load, Modify, Save

```csharp
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.LoadDocument("input.pdf");
    foreach (PdfPage page in processor.Document.Pages)
        page.Rotate = 90;
    processor.SaveDocument("output.pdf");
}
```

### Merge Two PDFs

```csharp
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.CreateEmptyDocument("merged.pdf");
    processor.AppendDocument("file1.pdf");
    processor.AppendDocument("file2.pdf");
    // Processor is disposed — document is finalized
}
```

### Add Graphics to an Existing Page

```csharp
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.LoadDocument("input.pdf");
    PdfPage firstPage = processor.Document.Pages[0];
    using (PdfGraphics graphics = processor.CreateGraphicsPageSystem())
    {
        using (DXFont font = new DXFont("Arial", 14))
            graphics.DrawString("CONFIDENTIAL", font,
                new DXSolidBrush(Color.Red), 200, 400);
        graphics.AddToPageForeground(firstPage);
    }
    processor.SaveDocument("output.pdf");
}
```

## Troubleshooting

| Symptom | Cause | Solution |
|---------|-------|----------|
| `FileNotFoundException` for SkiaSharp | Missing renderer package on .NET 6+ | Add `DevExpress.Pdf.SkiaRenderer` NuGet package |
| PDF opens but shows blank pages | Graphics rendered but `RenderNewPage` not called | Always call `RenderNewPage` after drawing into a `PdfGraphics` from `CreateGraphicsPageSystem` |
| `No usable version of ICU` on Linux | Missing ICU library | Set env variable: `export DXEXPORT_ICU_VERSION_OVERRIDE=65.1` (or current version) |
| Page origin confusion | Wrong coordinate system selected | Page system: origin bottom-left, Y up. World system: origin top-left, Y down (96 DPI). Choose the correct `CreateGraphics*System` method. |
| Version mismatch build error | Mixed DevExpress package versions | Ensure all DX NuGet packages use the exact same version (e.g., all 25.2.x) |
| License error at runtime | Missing DevExpress license | Register license key per the DevExpress installation guide |
| PDF/A save fails | Transparency or non-embedded fonts in PDF/A-1b | Remove transparency; PDF/A-1b forbids transparency. Use PDF/A-2b for transparency support. |
| Signature validation fails | Certificate not trusted | Add the certificate to the trusted store or pass it via `CertificateStoreProvider` |
| `ComplianceViolationException` on load/save | FIPS mode active; operation uses non-compliant algorithm (RC4, AES-128 Rev 4) | Use PDF 2.0 AES-256 (`PdfEncryptionAlgorithm.AES256`). Detect FIPS mode with `OperatingSystemLevelFipsMode.IsEnabled`. |

## Constraints & Rules

CRITICAL — follow these rules in every interaction:

1. **Build verification**: After making changes, verify with

…

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [DevExpress](https://github.com/DevExpress)
- **Source:** [DevExpress/agent-skills](https://github.com/DevExpress/agent-skills)
- **License:** MIT
- **Homepage:** https://www.devexpress.com

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-devexpress-agent-skills-devexpress-office-file-api-pdf
- Seller: https://agentstack.voostack.com/s/devexpress
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
