title: Viewer does not show pdf file
body: <p>I am trying to show a pdf file in a viewer of sort to show the contents of the pdf. however the viewer outputs blank.</p>
  <p>the file is located (uploaded) via a folder named 'pdf'</p>
  <p>this is my href code to pass which pdf should be shown</p>
  <pre><code>&lt;a href=&quot;viewimage.php?docnamepath='&lt;?php echo $scannedfilepath; ?&gt;'&quot; class=&quot;btn btn btn-success btn-sm&quot;  
                                          name=&quot;btnview&quot;
                                          id=&quot;btnview&quot;&gt;&lt;i class=&quot;fa-solid fa-thin fa-envelope fa-xs;&quot;&gt;&lt;/i&gt; View PDF &lt;/a&gt;
  </code></pre>
  <p>this is what it looks like in the url</p>
  <pre><code>http://localhost/recordsmanagement/viewimage.php?docnamepath='pdf/FAQs on RA11210 and the IRR.pdf'
  </code></pre>
  <p>this is how I read the pdf</p>
  <pre><code>&lt;?php
  
  if(!isset($_SESSION)) {
  session_start();
  }
  
  if(!isset($_GET['docnamepath'])) {
    $docnamepath=$_GET['docnamepath'];
  }
  
  
  
  if(isset($_GET['docnamepath'])){
  
    /** separate name and dir */
    $str_arr = explode (&quot;/&quot;,$_GET['docnamepath']);
  
    $content = $str_arr[0];
    $dir = &quot;pdf/&quot;;
  
  
  
  // Store the file name into variable
  $file = $dir . $content;
  $filename = $content;
  
  
  
  // Header content type
  header('Content-type: application/pdf');
  
  header('Content-Disposition: inline; filename=&quot;' . $filename . '&quot;');
  
  header('Content-Transfer-Encoding: binary');
  
  header('Accept-Ranges: bytes');
  
  // Read the file
  @readfile($file);
  
  }
  
  ?&gt;
  </code></pre>
  <p>the output looks like this. It is blank, what could be causing this</p>
  <p><a href="https://i.stack.imgur.com/trTkg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/trTkg.jpg" alt="enter image description here" /></a></p>
  <p>I got the idea by reading <a href="https://stackoverflow.com/questions/37404686/show-pdf-file-content-as-a-viewer">this</a> example</p>
  <p>I have already tried attaching the file in an email via php
  the pdf seems fine when sent via email so why is my pdf viewer not showing the pdf</p>
  <p><strong>UPDATE:</strong></p>
  <p>I have looked into @KD's comment and tried to use a file with no spaces</p>
  <p><a href="https://i.stack.imgur.com/lo5rr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lo5rr.jpg" alt="no spaces" /></a></p>
  <p>still does not work on my end</p>