Hello
I know this function has been removed from 1.4, but I still believe this is greatly needed... I did a bit of work, and here is a solution - fairly easy in my pow !!!
given that this feature has been removed after 1.3.4, and that I am not sure of how much support I can provide (I'll do my best anyway !), I am not proposing to integrate this in the main code of A2B... also, it seems that
dompdf is evolving constantly, and I am not sure as how to maintain this dependency.
enjoy...
J.
How does it work:
I've modified A2B_invoice_view.pdf to output all text to a file (using a class ob_filewriter that I did not write myself...).
Then, at the end, I convert this html data to pdf and display it !
How to:
1. download this bit of code:
http://codeutopia.net/files/obfw.txtand save it in the customer directory, under the name 'obfw.php'
make sure that the ownership & rights are the same as a2b
2. download
DOMPDF version 0.5.1 :
http://dompdf.googlecode.com/files/dompdf-0.5.1.zipinstall under var/www/html (at the same location as a2billing)
with a dirname '
dompdf' -
make sure that the ownership & rights are the same as a2b
3. alter var/www/html/a2billing/customer/A2B_invoice_view.pdf as follows
(line # refer to rev 2293)
line 7: add
include ("./obfw.php");
require_once("../../
dompdf/dompdf_config.inc.php");
line 43 (before: $smarty->display('main.tpl'); )
add:
if($popup_select)
{
$obfilename="/tmp/invoice".date("YmdHis").".html";
$obfw = new OB_FileWriter($obfilename);
$obfw->start();
}
at the very end, add:
if($popup_select){
$obfw->end();
$bp = getcwd();
$
dompdf = new
DOMPDF();
$
dompdf->load_html_file($obfilename);
$
dompdf->set_base_path($bp);
$
dompdf->set_paper("a4");
$
dompdf->render();
unlink ($obfilename);
$options = array ('Attachment' => 0);
$
dompdf->stream("invoice.pdf",$options);
}
Now, this should work only IF YOU USE A2B CUSTOMER UI IN ENGLISH
To get it working in other languages (that use the , as decimal separator - french for instance), you need a bit of extra work:
go to the
dompdf/lib directory
and edit class.pdf.php
then replace in the code all the %f format with %F (note that there is mostly %.3f and some other, so just dont simply search for %f)
save... and you should be good (alternatively, PM me and I'll email the corrected file)
if something goes wrong, check first the logs (var/log/httpd/error_log), and if you cant find whats wrong, then post a reply on this topic !