Added beginPage and endPage events.