Output PDF file using header - php

I can output a PHP table in an excel file using this code:
<?php
require("aacfs.php");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=Cancelled Flight Summary_sortbydate.xls");
header("Pragma: no-cache");
header("Expires: 0");
echo "<center>Ayala Aviation Corporation</center>";
echo "<center><b>Cancelled Flight Summary</b></center>";
echo "<center>For the period ________</center></br></br>";
$result=mysql_query("select * from reservation where status='Cancelled' order by bdate");
echo "<center></br></br><table border=1 class='imagetable'><tr>
<th>Flight Date</th>
<th>Client</th>
<th>Group Code</th>
<th>Itinerary</th>
<th>ETD</th>
<th>Aircraft</th>
<th>ETA</th>
<th>Reservation No.</th>
<th>Last Status</th>
<th>Remarks</th>
<th>Reserved By</th>
</tr>";
if(mysql_num_rows($result)>0)
{
while($row=mysql_fetch_array($result))
{
$rvno=$row['reservno'];
$yr=(string) date("Y");
$rn=$yr."-".$rvno;
echo"<tr><td>".$row['fdate']."</td><td>".$row['cliename']."</td><td>".$row['grpcode']."</td><td>".$row['itinerary']."</td><td>".$row['etd']."</td><td>".$row['acode']."</td><td>".$row['eta']."</td><td>".$rn."</td><td>".$row['lstatus']."</td><td>".$row['remarks']."</td><td>".$row['adminid']."</td></tr>";
}
}
else
{ ?>
<tr><td colspan="11" style="text-align:center; color:#FF0000; font-size:16px;">*No Data Available!*</td></tr>
<?php
}
?><?php
?>
I tried this,
<?php
require("aacfs.php");
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=Cancelled Flight Summary_sortbydate.pdf");
header("Pragma: no-cache");
header("Expires: 0");
echo "<center>Ayala Aviation Corporation</center>";
echo "<center><b>Cancelled Flight Summary</b></center>";
echo "<center>For the period ________</center></br></br>";
$result=mysql_query("select * from reservation where status='Cancelled' order by bdate");
echo "<center></br></br><table border=1 class='imagetable'><tr>
<th>Flight Date</th>
<th>Client</th>
<th>Group Code</th>
<th>Itinerary</th>
<th>ETD</th>
<th>Aircraft</th>
<th>ETA</th>
<th>Reservation No.</th>
<th>Last Status</th>
<th>Remarks</th>
<th>Reserved By</th>
</tr>";
if(mysql_num_rows($result)>0)
{
while($row=mysql_fetch_array($result))
{
$rvno=$row['reservno'];
$yr=(string) date("Y");
$rn=$yr."-".$rvno;
echo"<tr><td>".$row['fdate']."</td><td>".$row['cliename']."</td><td>".$row['grpcode']."</td><td>".$row['itinerary']."</td><td>".$row['etd']."</td><td>".$row['acode']."</td><td>".$row['eta']."</td><td>".$rn."</td><td>".$row['lstatus']."</td><td>".$row['remarks']."</td><td>".$row['adminid']."</td></tr>";
}
}
else
{ ?>
<tr><td colspan="11" style="text-align:center; color:#FF0000; font-size:16px;">*No Data Available!*</td></tr>
<?php
}
?><?php
?>
And it does download a PDF file but it can't be opened.
Is it really impossible to output the PHP table in a PDF file the same way it does in the above code? Or I'm just doing something wrong on my 2nd code? This way is the easiest for me so I'm eager to know if it is impossible (if it is, then why?) or possible. And please point me out to an easy alternative to achieve this in case it is not possible, since I'm new to generating external files through PHP. Any help would do. Thanks.

You can't just echo out HTML and hope it will magically make a PDF binary because you sent a PDF header. Look at the PHP PDF library (http://php.net/manual/en/book.pdf.php) or other PHP-based library for creating PDF's.
Similarly, I am shocked that outputting HTML like that with an Excel header will create a usable Excel file. It must be through lucky compatibility with Excel that this would work. You should use a real Excel library (or create a CSV file compatible with Excel) if you want to create Excel files in a more reliable fashion.

Related

Generated excel file size is very big with php and mysql export

I am using php and mysql to generate excel file. Every thing works fine. I am using html table code and exporting data to excel file. But the downloaded file is having bigger size for 20k records it is showing nearly 35 MB. Below is my code .
<?php
$generated_date = date("Y-m-d-H-i-s");
$filename = 'order_detail_report'.$generated_date;
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=$filename.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
Html table code
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<th class="excel_style">Order Number</th>
<th class="excel_style">EAN</th>
<th class="excel_style">Article #</th>
<th class="excel_style">Amazon Price</th>
<th class="excel_style">ERP Price</th>
<th class="excel_style">Requested Quantity</th>
<th class="excel_style">Dispatch Quantity</th>
<th class="excel_style">Rejected Quantity</th>
<th class="excel_style">Cancelled Quantity</th>
</tr>
While loop
<?php
$query = "my select query";
$res = mysqli_query($mysqliConn,$query);
while($result= mysqli_fetch_assoc($res)){
?>
<tr>
<td class="tdstyle"><?php echo $result['order_id'];?></td>
<td class="tdstyle"><?php echo $result['ean'];?></td>
<td class="tdstyle"><?php echo $result['article_no'];?></td>
<td class="tdstyle"><?php echo $result['net_price'];?></td>
<td class="tdstyle"><?php echo $result['erp_price'];?></td>
<td class="tdstyle"><?php echo $result['requested_quantity'];?></td>
<td class="tdstyle"><?php echo $result['dispatch_quantity']?></td>
<td class="tdstyle"><?php echo $result['rejected_quanity'];?></td>
<td class="tdstyle"><?php echo $result['cancelled_quantity']?></td>
</tr>
<?php } ?>
</table>
How to solve this size of the file problem? Any help would be greatly appreciated. If I use phpexcel library I am getting some out of memory exception. So client asked me don't use phpexcel library.
It is not clear what is exact problem - the size of result generated file or the memory getting exhausting?
But, lets assume that the problem is memory getting exhausting. Do you really need to generate excel(.xslx) files or CSV format is acceptable? You can generate CSV file with a really low memory usage like this
<?php
$fp = fopen('file.csv', 'w');
$query = "my select query";
$res = mysqli_query($mysqliConn,$query);
while($result= mysqli_fetch_assoc($res)) {
$fields = [
$result['order_id'],
$result['ean'],
$result['article_no'],
$result['net_price'],
$result['erp_price'],
$result['requested_quantity'],
$result['dispatch_quantity'],
$result['rejected_quantity'],
$result['cancelled_quantity']
]
fputcsv($fp, $fields);
}
fclose($fp);
?>

Issues while export html table to excel

Hi I am going to Export my html form to excel
Here is my code:
<script type="text/javascript">
function callexports()
{
var tabdata=document.getElementById("tabledata").innerHTML;
document.getElementById("tableval").value=tabdata;
document.getElementById("sendtable").submit();
}
</script>
<form id="sendtable" action="exportexcel.php" method="post">
<input type="button" name="Export Excel"
value="Export Excel" onclick="callexports();"/>
<div id="tabledata">
<table border='1'>
<tr >
<th style="background-color:yellow;">Sno</th>
<th style="background-color:yellow;">Name</th>
<th style="background-color:yellow;">Marks</th>
<th style="background-color:yellow;">Age : Age Testing </th>
</tr>
<tr><td>1</td><td>Anvesh</td><td>90</td></tr>
<tr><td>2</td><td>Kapil</td><td>80</td></tr>
<tr><td>3</td><td>Mahesh</td><td>70</td></tr>
<tr><td>4</td><td>Sravan</td><td>90</td></tr>
<tr><td colspan='2'>Total</td><td>330</td></tr>
</table>
</div>
<input type="hidden" name="tableval" id="tableval" />
</form>
**exportexcel.php**
<?php
$filename = "Student_Info".time(); //File Name
$file_ending = "xls";
//header info for browser
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=$filename.xls");
header("Pragma: no-cache");
header("Expires: 0");
Echo $_REQUEST['tableval'];
?>
Now it's working fine.But i have a doubt
<th style="background-color:yellow;">Age : Age new Testing </th>
Here Age is My heading and Age new Testing is my description. Is there any way to remove description from <th>. I mean i need only Heading and i want to remove description? Please help me?

export images with data from Mysql to excel using php

Am trying to export my data along side images from mysql database using php.
The plain data is successfully exported to excel but the images donot display rather display error "the linked image cannot be displayed.The file may have been moved,renamed or deleted.Verify link points to correct file and location".
Output of the code
source code
<?php
// The function header by sending raw excel
header("Content-type: application/vnd-ms-excel");
// Defines the name of the export file "codelution-export.xls"
header("Content-Disposition: attachment; filename=system_users.xls");
// Add data table
include("config/dbconfig.php");
?>
<!-- Image path in subfolder images -->
<img src="images/reph.png" height="115" width="730">
<table width=70% border="1" class="view" align="center">
<tr><th> No</th>
<th> Name</th>
<th>User Role</th>
<th>User Name</th>
<th>Password</th>
</class> </tr><tr>
<?php
$sno=1;
$query=mysql_query("select * from users ");
$num_rows=mysql_num_rows($query);
if($num_rows>0)
{ while ($fields=mysql_fetch_assoc($query))
{ $sno<=$num_rows;
$pid=$fields['user_id'];
$lname=$fields['lname'];
?>
<td> <?php echo "$sno ";
$sno++; ?></td>
<td> <?php echo $fields['lname']." ".$fields['fname'];?></td>
<td><?php // php code that retrieves image path from the database and prints the image
//echo '<img width="120" height="110" SRC="' .$fields['image'] . '" alt="Image failed to load " />';
?></td>
<td> <?php echo $fields['role'];?></td>
<td> <?php echo $fields['username'];?></td>
<td> <?php echo $fields['password'];?></td>
</tr>
<?php
}//closing the while loop
}//closing the if statement
echo '</table>';
?>

How to Export data in Excel including images in php

i am exporting data from database (MySQL) in excel sheet. i also want to export images in Excel using PHP.if any demo link is available, please share it here
You have to use one of the followig library to do that.
URLS:
https://github.com/PHPOffice/PHPExcel
https://phpexcel.codeplex.com/
https://code.google.com/p/php-excel/
What you're looking for is PHPExcel.
Here are some examples.
This is how I solved mine. Hope this helps!
public function export_items_to_excel(){
$items = $this->transaction->view_all_items();
$output = '';
$output .= "<table class='table' border='1'>
<thead>
<th style='background-color:#c7c7c7;'>NAME</th>
<th style='background-color:#c7c7c7;'>DESCRIPTION</th>
<th style='background-color:#c7c7c7;'>QUANTITY</th>
<th style='background-color:#c7c7c7;'>WEIGHT (KG)</th>
<th style='background-color:#c7c7c7;'>HS CODE</th>
<th style='background-color:#c7c7c7;'>SERIAL NO.</th>
<th style='background-color:#c7c7c7;'>UNIT VALUE</th>
<th style='background-color:#c7c7c7;'>CURRENCY</th>
<th style='width:220px !important;background-color:#c7c7c7;'>PICTURE</th>
</thead>
<tbody>
";
foreach($items as $item){
$output .= "
<tr>
<td style='text-align:center;'>".$item->item_name."</td>
<td style='text-align:center;'>".$item->item_description."</td>
<td style='text-align:center;'>".$item->item_quantity."</td>
<td style='text-align:center;'>".number_format($item->item_weight, 2)."</td>
<td style='text-align:center;'>".$item->item_hs_code."</td>
<td style='text-align:center;'>".$item->item_serial_number."</td>
<td style='text-align:center;'>".number_format($item->item_unit_value, 2)."</td>
<td style='text-align:center;'>".$item->item_currency."</td>
<td style='text-align:center;width:220px !important;height:220px !important;'><img src='".base_url()."assets/uploads/".$item->item_picture."' style='width:200px !important;height:152px !important;'> </td>
</tr>
";
}
$output .= "</tbody>
</table>
";
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
header("Content-Disposition: attachment; filename=items.xls");
header("Cache-Control: max-age=0");
echo $output;
}

How do I export data and a base64 image to excel using PHP?

I'm trying to export the following to excel but the image is not coming through.
Example:
$today = date("d/m/y : H:i:s", time());
header ("Content-Type: application/x-msexcel");
header ("Content-Disposition: attachment; filename=\"export.xls\"" );
echo '
<table>
<tr>
<th nowrap="nowrap">Client ID</th>
<th nowrap="nowrap">Client Name</th>
<th nowrap="nowrap">No. of Staff</th>
<th nowrap="nowrap">No. of Events</th>
<th nowrap="nowrap">Fail all\'s</th>
<th nowrap="nowrap">Fail Section</th>
<th nowrap="nowrap">Fail all %</th>
</tr>
<tr>
<td nowrap="nowrap">8</td>
<td nowrap="nowrap">SEAI</td>
<td nowrap="nowrap"><div> 17 </div></td>
<td nowrap="nowrap"><div> 354 </div></td>
<td nowrap="nowrap"><div> 7 </div></td>
<td nowrap="nowrap"><div> 0 </div></td>
<td nowrap="nowrap"><div> 1.98% </div></td>
</tr>
</table>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA24AAAEsCAYAAAC7XuApAAAWw0lEQVR4nO3dT2scd57HcV/yiHKf257mT47zDPoQMAOzLJNkyBwNjcH4kmXsTMbgPmgV55SsmxmoYE1AMPgQDTQdCAi0B8HQGpCRs7HJzsB3D6Y61a1qqaXq+qm6fq8XvCFWWq1SLs6Hqq669fbgwVu/+OCzT3723qevf/fHr84efP71650vv4n/kiRJkiQlbefLb+LB51+//t0fvzr76W8+ff3O+589fHvw4K1b77z/5Pf/8Z9ffv/dqx8CAACAbnj5/Q/x64+K79/54MlHt37+3pNX//v6/276mAAAAFjy3asf4mfvffr61oeffPXypg8GAACAer/9+C8vb/3hi4N/3fSBAAAAUO/B5wf/vPX4T5ObPg4AAABWePynSRhuAAAAHWa4AQAAdJzhBgAA0HGGGwAAQMcZbgAAAB1nuAEAAHSc4QYAANBxhhtATz0Z78VPfvmrcz0Z7135vf568E385Je/ir8efNPCkV5deTzVVh3b8mtX/f5171l2/Pd/XPnYqsfT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AqDLcAMhe3XPcqpdPrnNzkrobkKx7qeTyz3dzEgCWGW4AAAAdZ7gBAAB0nOEGAADQcYYbAABAxxluAAAAHWe4AQAAdJzhBgAA0HGGGwAAQMcZbgAAQCfdv3+/ldduI8MNAADYuBcvXpwbU7u7u/HixYuIeDO0yn9exXD7keEGAABs3GXDbR2ph9tVjy8lww0AANi4q5xxK4oi7t+/H/fv3z/3moODg/nXS9XXF0Vx4WvL15X/vvoe5euPjo7m/1x93e7u7rn3q6o7jrqvvXjxInZ3d+fvd3R0NH/NukPRcAMAADauHG7LLQ+3o6Ojc0NrebhF/Dj6ytGzrO61y8ezPP6WB1n1+5Zfv6zuOJZ/l93d3Tg6Opr/t3jx4sV8IJbHcHR0tPJnVBluAADAxq17xu3g4GDhTNjya5a/fnBwMD+TVVX32vKfq2fzSnWjaXnwlSOr7ufVHcfy18rfrToCq68x3AAAgBu17nCrnqWqnpkqX7P8vRedcat77fLliqV1httFX7/qGTfDDQAA6JyrfMat+lmyy864RcTC59Gqn3Fb9XPK965eTlk3msrPpx0cHCx8Dm3VsKw7jos+41Z+z7WH28MvDv651qsBAABaUjf2eOP3n3/9z1sffvLVy5s+EAAAIE+r7vzIj3778V9e3vr5e09evfz+h5s+FgAAAJZ89+qH+Pl7T17deuf9J7//94++fPXdK+MNAACgK15+/0P8+qPi+3c+ePLRrbcHD976xQefffLT33z6+v2Hey8//uLgX3/477+FJEmSJCl9H39x8K/3H+69/OlvPn39iw8+e/D24MFb/w8FVkJZAxfZ3wAAAABJRU5ErkJggg==" />
';
I have tried the following with out success:
echo file_get_contents(base64_decode($img));
With and without the tag and with and without the file_get_contents and base64_decode.
I feel that is should be possible but I'm missing something :(. Does anyone have any ideas?
Thanks!!!
From what I see, you are trying to create an excel file (XLS) keeping headers.
Headers are not enough!
You need set of libraries. I would recommend you to do use PHPExcel
You can add images easily to it. Keep this library handy! It can do many more stuff.
Once you have installed it, you can refer to this answer for more step by step instructions.
Try complete solution using PHPExcel that I also recommend for this job.
http://phpexcel.codeplex.com/discussions/271473

Categories