Add Page Breaks in PDF in C++

Use PdfFileEditor for this task. The examples below retain the original C++ code and API Reference steps.

Add page breaks in PDF

Insert a page break on page 1 at the position specified by 400.

  1. Create PdfFileEditor.
  2. Insert the page break with PdfFileEditor::AddPageBreak().
#include <Aspose.PDF.Cpp/Facades/PdfFileEditor.h>
#include <system/array.h>
#include <system/string.h>

namespace  Facades::Examples::PDF_FileEditor
{
using namespace System;
using namespace Aspose::Pdf;
using namespace Aspose::Pdf::Facades;

void AddPageBreaksInPdf(String inputFile, String outputFile)
{
    auto pdfEditor = MakeObject<PdfFileEditor>();
    pdfEditor->AddPageBreak(
        inputFile, outputFile,
        MakeArray<SharedPtr<PdfFileEditor::PageBreak>>({MakeObject<PdfFileEditor::PageBreak>(1, 400)}));
}
} // namespace  Facades::Examples::PDF_FileEditor