ZingPDF logo

Guide

How to export selected PDF pages in C#

Use ExportPagesAsync(...) when you need a new PDF containing only specific pages from an existing document.

This is the right tool when you know the exact 1-based page numbers you want and need them copied into a separate output file.

Export the pages you want

Pass the requested page numbers and save the returned document.

using ZingPDF;

using var pdf = Pdf.Load(File.OpenRead("packet.pdf"));
using var selectedPages = await pdf.ExportPagesAsync([1, 3, 5]);

await selectedPages.SaveAsync(File.Create("selected-pages.pdf"));

The page order comes from the sequence you pass in

ExportPagesAsync(...) uses the 1-based page numbers you provide and preserves that requested order in the new document.

If you ask for [5, 2, 1], the exported PDF will follow that order instead of the source document order.

The exported document is a new PDF

The result of ExportPagesAsync(...) is a separate Pdf instance, so save it like any other document.

That makes it easy to export one subset for a customer packet and a different subset for internal review.

Use split when the output should be fixed-size chunks

Export is the better fit when you know the exact pages. If the requirement is “break this document into groups of 10 pages,” use SplitAsync(...) instead.

Need chunked output instead of named pages?

The split guide covers fixed-size document chunks from a larger source PDF.

Open split guide Open docs