How To Print The Invoice In Pdf Format?

Hi friends,

this is my first post, CS-Cart is a complete e-commerce program, but still needs some modifications. I would like to make the invoice open in a more friendly pdf format (both in the catalog and admin area) and not in the web browers how its now, cos there are problems printing it.

If anyone has some idea… I’ll thanks him a lot.



Bye,

Andy

Unless you have your own script for converting HTML to PDF, I don’t think this will be a feature anytime soon. The cheapest I found is $600.

Also, you may need to have a way to view an order without the customer needing to be logged in.



I created a way to do this.


  1. Create a new file “/targets/print_invoice.php”


```php


if ( !defined('IN_CSCART') ) { die('Access denied'); }

if($target == "print_invoice") {
if (!empty($order_id)) {
$smarty_mail->assign('order_info', fn_get_order_info($order_id));
if (empty($smarty_mail->_tpl_vars['order_info'])) {
fn_set_exception('no_page');
}
fn_show_template("orders/invoice.tpl", $smarty_mail);
exit;
}
}

?>

```



2. In config.php, add to the list of targets



‘print_invoice’ => TARGETS_DIR . ‘print_invoice.php’,



3. Then go to the address “/index.php?target=print_invoice&order_id=[COLOR=Red]#[/COLOR]”

Thanks for your reply, but my intention is to make open, when a customer clicks on the Print Invoice button, a page in the Adobe Acrobat Pdf format, so can print the page without the upper and lower writings.

upper and lower writings?

[quote name=‘androquest’]I would like to make the invoice open in a more friendly pdf format (both in the catalog and admin area) and not in the web browers how its now, cos there are problems printing it.

If anyone has some idea.[/QUOTE]You might try using “dompdf”. Here is the link:



[url]http://www.digitaljunkies.ca/dompdf/about.php#overview[/url]

when you print a document with Internet Explorer in the upper right part of the sheet of paper you get “Page 1 of 1” and at the bottom of the sheet the date and the link of the page.

And so I need a pdf format to solve this problem, because I would like to print the plan invoice only.

As I said in the first post, you’ll need an HTML to PDF converter compatible with the new page I showed you how to make. Something like this (http://www.html-to-pdf.net/), but for PHP.



Using the live demo, I typed in my test url for the page created with the modification in the above post. I was returned the invoice with a “custom” footer and that’s it. I’m sure you can remove the footer if you desire.



Problem is, it’s for ASP.NET compliant hosts. I’m sure yours is as many are now a days.



The PDF toolkit is $600. However, the HTML to PDF part is $350.

[quote name=‘sculptingstudio’]You might try using “dompdf”. Here is the link:



[url]http://www.digitaljunkies.ca/dompdf/about.php#overview[/url][/QUOTE]



Thanks, but unfortunately my web server hosting still didn’t upgrade to PHP 5.

[quote name=‘mdekok3000’]As I said in the first post, you’ll need an HTML to PDF converter compatible with the new page I showed you how to make. Something like this (http://www.html-to-pdf.net/), but for PHP.



Using the live demo, I typed in my test url for the page created with the modification in the above post. I was returned the invoice with a “custom” footer and that’s it. I’m sure you can remove the footer if you desire.



Problem is, it’s for ASP.NET compliant hosts. I’m sure yours is as many are now a days.



The PDF toolkit is $600. However, the HTML to PDF part is $350.[/QUOTE]







Thanks mdekok3000 for your kind answer. Maybe there is even a free version of this programs available around :smiley: