After Some Debug in the core file i found the solution to my problem and i am sharing my answer.
I had to override function in controller to achieve this task.for this i had created one module which overrides Mage_Downloadable's Download Controller.
Step 1: Create YourPackageName_Downloadable.xml under app/etc/modules/
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<modules>
<YourPackageName_Downloadable>
<active>true</active>
<codePool>local</codePool>
</YourPackageName_Downloadable>
</modules>
</config>
Step 2. Create config.xml file in app/code/local/YourPackageName/Downloadable/etc/.
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<modules>
<YourPackageName_Downloadable>
<version>0.0.1</version>
</YourPackageName_Downloadable>
</modules>
<frontend>
<routers>
<downloadable>
<args>
<modules>
<yourpackagename_downloadable before="Mage_Downloadable">YourPackageName_Downloadable</yourpackagename_downloadable>
</modules>
</args>
</downloadable>
</routers>
</frontend>
</config>
Step 3: Create DownloadController.php in app/code/local/YourPackageName/Downloadable/controllers/
<?php
require_once("Mage/Downloadable/controllers/DownloadController.php");
class YourPackageName_Downloadable_DownloadController extends Mage_Downloadable_DownloadController{
protected function _processDownload($resource, $resourceType)
{
$helper = Mage::helper('downloadable/download');
/* @var $helper Mage_Downloadable_Helper_Download */
$helper->setResource($resource, $resourceType);
$fileName = $helper->getFilename();
$contentType = $helper->getContentType();
$this->getResponse()
->setHttpResponseCode(200)
->setHeader('Pragma', 'public', true)
->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
->setHeader('Content-type', $contentType, true);
if ($fileSize = $helper->getFilesize()) {
$this->getResponse()
->setHeader('Content-Length', $fileSize);
}
// custom change in core code strats here
$actionName = Mage::app()->getRequest()->getActionName();
if($actionName == "sample"){
$this->getResponse()
->setHeader('Content-Disposition', 'inline' . '; filename='.$fileName);
}else{
if ($contentDisposition = $helper->getContentDisposition()) {
$this->getResponse()
->setHeader('Content-Disposition', $contentDisposition . '; filename='.$fileName);
}
}
// custom change in core code ends here
$this->getResponse()
->clearBody();
$this->getResponse()
->sendHeaders();
session_write_close();
$helper->output();
}
}
?>