How to pass pagination value to drupal view programatically? I have a view with contextual filter and I render the view through program as below
$args=[$id];
$view = Views::getView('schedule');
$render_array = $view-&gt;buildRenderable('rest_export_1',$args);
$rendered = \Drupal::service('renderer')-&gt;renderRoot($render_array);

The view is paged with 5 results in each page. How do I pass the value to get results from the second page of the view?
I found setCurrentPage more suitable for my use case
$view = Views::getView('schedule');
$view-&gt;setCurrentPage($pageNum);