$doc->PagePushBack($page);
// Start a new page ------------------------------------
//
// The example illustrates how to embed the external font in a PDF document.
// The example also shows how ElementReader can be used to copy and modify
// Elements between pages.
// Start reading Elements from the last page. We will copy all Elements to
// a new page but will modify the font associated with text.
$reader->Begin($doc->GetPage($doc->GetPageCount()));
$page = $doc->PageCreate(new Rect(0.0, 0.0, 1300.0, 794.0));
$writer->Begin($page);
// begin writing to this page
$builder->Reset();
// Reset the GState to default
// Embed an external font in the document.
$font2 = Font::CreateType1Font($doc->GetSDFDoc(), $input_path . "Misc-Fixed.pfa");
while ($element = $reader->Next()) {
    if ($element->GetType() == Element::e_text) {
        $element->GetGState()->SetFont($font2, 12);
    }
    $writer->WriteElement($element);
}
$reader->End();
$writer->End();
// save changes to the current page
$doc->PagePushBack($page);
// Start a new page ------------------------------------
$page = $doc->PageCreate();
$writer->Begin($page);
// begin writing to this page
$builder->Reset();