I have created a pdf file of a page using DOMpdf as following.
<?php
use Dompdf\Dompdf;
class Pdfgenerator {
  public function generate($html, $filename='', $stream=TRUE, $paper = 'A4', $orientation = "portrait")
  {
    $dompdf = new DOMPDF(array('enable_remote' => true));
    $dompdf->loadHtml($html);
    $dompdf->setPaper($paper, $orientation);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename.".pdf", array("Attachment" => 0));
    } else {
        return $dompdf->output();
    }
  }
}
On clicking Save As Pdf button on a view page, pdf of the page is created in a controller function using DOMpdf and open the pdf in new tab in browser from where it can be downloaded on the download path which is set for browser.
$html = $this->load->view('test/pdfview', $this->data, true);
$this->load->library('pdfgenerator');
$filename = 'testfile';
$this->pdfgenerator->generate($html, $filename, true, 'a4', '');
What I actually want is to download the file on given path such that when a PDF is created a save prompt will open which already navigates to given location. If its the right location I can press save, if not I can navigate to the proper save location. These are somewhat similar questions already asked which I found but I couldnt find them helpful.
 
     
     
    