Split a PDF File using C++

Split PDF files using C++

PDF is a standard format for sharing documents over the internet. Its global support and consistent layout make it an ideal choice for such scenarios. But there may be situations where sharing the complete PDF file is not an ideal or appropriate option. For such cases, you can split the PDF file according to your requirements. You can do this manually, but that might prove to be less efficient and time-consuming. Alternatively, you can split the PDF document programmatically. In this article, you will learn how to split PDF files using C++.

C++ API for Splitting PDF Files

Aspose.PDF for C++ is a C++ library that allows you to create, read and update PDF documents. Furthermore, the API supports splitting PDF files into multiple documents. You can either install the API through NuGet or download it directly from the downloads section.

PM> Install-Package Aspose.PDF.Cpp

Split a PDF File using C++

Aspose.PDF for C++ lets you save each page of the PDF file as a separate PDF document. The following are the steps to achieve this using C++.

The following is the sample code to split a PDF file using C++.

Split Selected PDF Pages using C++

Instead of saving each page separately, you may specify different conditions for splitting the PDF file. The following are the steps to split selected PDF pages using C++.

The following is the sample code to split specific PDF pages using C++.

Get a Free License

You can try the API without evaluation limitations by requesting a free temporary license.


In this article, you have learned how to split PDF files into individual pages using C++. Furthermore, you have learned how to use custom criteria to customize the splitting of PDF files. Aspose.PDF for C++ is a vast library with many additional features for working with PDF files. You can explore the API in detail by using the official documentation. In case of any questions, please feel free to reach us on our free support forum.

See Also