Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi Team

I am struggling to create a view pdf document using php when receipient receives email attachment. My code only view pdf from the browser. How do i link it with front end(html, jquery)?

What I have tried:

PHP
<pre><?php
// Database Connection 
$conn = new mysqli('localhost','acifinan_acifinan','Finance_01','acifinan_acifinanc');
//Check for connection error
$select = "SELECT * FROM `infopdf`";
$result = $conn->query($select);
while($row = $result->fetch_object()){
  $pdf = $row->filename;
  $path = $row->directory;
  $date = $row->created_date;
  $file = $path.$pdf;
}


// Add header to load pdf file
header("Content-disposition: inline;     
filename=".basename('theme/assets/pdf/ci.pdf'));
header('Content-Transfer-Encoding: binary'); 
header('Accept-Ranges: bytes'); 
@readfile($file);  
?>

<br/><br/>
<iframe src="<?php echo $path.$pdf; ?>" width="90%" height="500px">
</iframe>


// front end using html no jquery yet to call path url for php
<input type="Submit" id="btnNow" class="btn apply-btn mt-30" name="button" value="APPLY NOW">
                                <div id="dialog" style="display: none"></div>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900