title: Display PDF on browser
body: <p>I want to display a PDF file on browser which is store on our server. Here is my code :-</p>
  
  <pre><code>$path = $_SERVER['DOCUMENT_ROOT'].folder_name.'/resources/uploads/pdf/pdf_label_'.$order['id'].'.pdf';
  
  $filename = 'pdf_label_'.$order['id'].'.pdf';
  
  $file = $path;
  $filename = $filename;
  
    header('Content-type: application/pdf');
    header('Content-Disposition: inline; filename="' . $filename . '"');
    header('Content-Transfer-Encoding: binary');
    header('Accept-Ranges: bytes');
    @readfile($file);
  </code></pre>
  
  <p>But it returns below output on browser :</p>
  
  <pre><code>%PDF-1.4 % 5 0 obj &gt;stream
  </code></pre>
  
  <p>PDF File to show :</p>
  
  <p><img src="https://i.stack.imgur.com/TTdL3.jpg" alt="enter image description here"></p>
  
  <p>I am doing this on view of codeignter.</p>
  
  <p>What I am doing wrong ? Please help me on this. thanks in advance</p>
  
  <p><strong>EDIT :-</strong></p>
  
  <p>Im doing something like below :</p>
  
  <pre><code>foreach($orders as $order){
  
  $path = $_SERVER['DOCUMENT_ROOT'].folder_name.'/resources/uploads/pdf/pdf_label_'.$order['id'].'.pdf';
  
  $filename = 'pdf_label_'.$order['id'].'.pdf';
  
  $file = $path;
  $filename = $filename;
  
    header('Content-type: application/pdf');
    header('Content-Disposition: inline; filename="' . $filename . '"');
    header('Content-Transfer-Encoding: binary');
    header('Accept-Ranges: bytes');
    echo file_get_contents($file);
  
    }
  </code></pre>
  
  <p>So how can I show more than one file on browser ?</p>
  
  <p><strong>Edit 2 :-</strong> </p>
  
  <p>So as per the answer below I have to use phpmerger to merge multiple PDF file and display into the browser. I gone through this website <a href="http://pdfmerger.codeplex.com/" rel="noreferrer">http://pdfmerger.codeplex.com/</a> but unable to use into codeignter. Can anyone please help me to use this phpmerger inside my codeingter</p>