I am looking for the alternative of _processDownload() function which is available in magento1.
I have tried to use the below snippet but it is not generating file.
$pdf = \Zend_Pdf::load($this->directory_list->getPath(DirectoryList::MEDIA) . DIRECTORY_SEPARATOR . $file);
$fileName = test.pdf;
$this->fileFactory->create(
$fileName,
str_replace('/Annot /Subtype /Link', '/Annot /Subtype /Link /Border[0 0 0]', $pdf->render()),
\Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR,
'application/pdf'
);