How to Summarize and Query PDFs with AI in C#
Organizations that handle large volumes of PDFs, reports, contracts, case files, manuals, spend significant staff time reading documents to find what matters. Two AI capabilities change that workload: a one-shot summary that lets someone triage a document without reading it, and a conversational query that answers natural-language questions about its content. IronPDF adds both to a .NET application through its AI extension, built on Microsoft Semantic Kernel and backed by Azure OpenAI.
The Business Problem
A support agent needs an answer buried in product documentation. An analyst wants the key figures from a 60-page report. A legal reviewer needs to check a specific clause across long contracts. Reading each document end to end does not scale. The goal is to summarize on intake and let people ask questions in plain language.
The Solution
The IronPdf.Extensions.AI package adds Summarize for quick abstracts and Query for continuous, context-aware questioning. After configuring Semantic Kernel with an Azure endpoint and a memory store, summarizing a document takes one call.
using IronPdf;
using IronPdf.AI;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Memory;
var builder = Kernel.CreateBuilder()
.AddAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey)
.AddAzureOpenAIChatCompletion("oaichat", azureEndpoint, apiKey);
var kernel = builder.Build();
var memory = new MemoryBuilder()
.WithMemoryStore(new VolatileMemoryStore())
.WithAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey)
.Build();
IronDocumentAI.Initialize(kernel, memory);
PdfDocument pdf = PdfDocument.FromFile("report.pdf");
string summary = await pdf.Summarize();
The Query method holds conversation context across follow-up questions, which is the basis for a document chatbot, an internal knowledge base, or a research tool. Paired with OCR, summarization also works on scanned documents, complex multi-column layouts, and files with images and tables.
Points to Plan For
This feature carries more setup than the conversion guides, so a few prerequisites matter:
- Three packages:
IronPdf,IronPdf.Extensions.AI, andMicrosoft.SemanticKernel.Plugins.Memory. The memory plugin powers continuous querying. - Azure OpenAI backend: The documented path requires an Azure subscription with Azure OpenAI Service access, configured with an endpoint and key.
- Data handling: The extension extracts document text and sends it to the Azure OpenAI endpoint, so confidential content leaves the local environment. Account for that in regulated workflows.
- Memory store by environment:
VolatileMemoryStoresuits development, while Chroma, Azure Cognitive Search, or Qdrant suit production persistence. - Experimental APIs: Semantic Kernel raises
SKEXPbuild warnings, suppressed with aNoWarnentry in the csproj.
Result
With a small amount of setup, teams add automated summaries and a chat-with-your-document interface to a .NET app, turning dense PDFs into something staff and users can query in seconds. Full configuration details are in the OpenAI for PDF guide.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.