C# Read PDF Walkthrough
Today, we'll walk through a simple method for reading PDF content and extracting text in its original format. This can be done for entire documents or specific pages, all within your C# project.



Get started with IronPDF
Start using IronPDF in your project today with a free trial.
How to Read PDF Files in C#
- Download IronPDF C# Library for PDF Reading and Writing
- Install with IronPDF via NuGet to test the Library
- Read PDF files, extract content, and even extract high quality and original images
- Use a C# Form to show you the perfect output of reading the PDF content
- View your PDF output
Read PDF File in C#
Using this C# library, we can read PDF files, extract content, and even extract high quality and original images. See the examples below for the many ways we can use different functions to achieve our PDF reading needs in a .NET environment.
:path=/static-assets/pdf/content-code-examples/how-to/csharp-read-pdf-read-pdf.cs
using IronPdf;
using IronSoftware.Drawing;
using System.Collections.Generic;
// Select the desired PDF File
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
// Extract all text from an pdf
string allText = pdf.ExtractAllText();
// Get all Images
IEnumerable<AnyBitmap> AllImages = pdf.ExtractAllImages();
// Else combine above both functionality using PageCount
for (var index = 0; index < pdf.PageCount; index++)
{
string Text = pdf.ExtractTextFromPage(index);
IEnumerable<AnyBitmap> Images = pdf.ExtractImagesFromPage(index);
}
Output
We have used a C# Form to show you the perfect output of reading the PDF content. With this approach, it's all about simplicity and using as little code as possible to achieve your project needs.
Library Quick Access
Library Documentation
Documentation for the IronPDF library is available in the handy API Reference for you to explore and share.
IronPDF API Reference Documentation