Home › Forums › WordPress › Web Invoice – Invoicing and billing for WordPress › Creates template from HTML code for PDF
- This topic has 5 replies, 2 voices, and was last updated 12 years, 8 months ago by
bestnight.
-
AuthorPosts
-
June 15, 2010 at 01:52 #3619
bestnight
MemberHello,
Firstly, excellent plugin! After much research with dompdf and my very limited knowledge of PHP, I am attempting to completely customize the look of the PDF output using HTML.
I am running into trouble attempting to insert the variables into the PDF.
Am I taking on too much? or is it as simple as inserting <?php echo [variable goes here] ?> to the code?
I am also wondering which variables to use.
Thanks for any help you can provide, also are you looking to add a PDF customize feature in future releases?
June 15, 2010 at 19:09 #5167S H Mohanjith
MemberI’m considering a feature where you can customize the HTML invoice as well as the PDF invoice, still a work in progress and not a very high priority feature.
Back to your question about inserting a variable, yep, it’s as simple as <?php echo $variable_name ?>. I’m using output buffers capture the content. Hope I made sense.
Anyways, any changes to core files will be overwritten in future releases, please keep this in mind and preferably use a source code management system to make the upgrade process.
June 18, 2010 at 02:33 #5170bestnight
MemberThank you for response, I appreciate you taking the time to respond. I have one last question that might help someone else who is attempting the same hack.
In Frontend.php, there is a line (approx 322) that reads:
$content = preg_replace(array('/ /', '/nn/i', '/€/i'), array(" ", "n", ""), '<div id="invoice_page" class="clearfix"><h1>Invoice</h1>'.ob_get_contents().'</div>
test
test');Is that line creating the pdf content? If so, what are the arrays calling to? When I attempt to add an image to this code it is not displayed. However, if I add an image tag to html code stored in a separate variable and call that variable to the pdf creator, it will display.
I hope there isn’t too much in this question, but it should solve the issue I am having with getting the actual invoice content to be displayed on my html code.
Also what variables should I be using? When I attempt :
<?php echo $web_invoice_custom_invoice_id ?>
I receive an error: Parse error: syntax error, unexpected ‘<‘ in /wp-content/plugins/web-invoice/Frontend.php on line 339
Here is the code below:
$html =
'<html><body>'.
'<table width="1200" border="0">
<tr>
<td height="30">'.<?php echo $web_invoice_custom_invoice_id ?>'</td>
</tr>
</table>
'.
Thank you for your time and your help. I really do appreciate it. This is a terrific plugin! Do you accept donations for your contributions to the community?
June 22, 2010 at 08:11 #5173S H Mohanjith
MemberYep, you probably didn’t notice it because you need to scroll a lot to get to the download widget
. Here is the link with an anchor to help you find the widget https://www.mohanjith.com/2009/03/web-invoice-invoicing-and-billing-for-wordpress.html#donations . Thank you.
June 28, 2010 at 15:32 #5176S H Mohanjith
Member@bestnight, sorry for the delay in replying. But I got some good news, now you can add the logo by editing the template under e-mail template. It’s currently in the development version (http://downloads.wordpress.org/plugin/web-invoice.zip), will be releasing it main stream within this week.
I do accept donations, see https://www.mohanjith.com/2009/03/web-invoice-invoicing-and-billing-for-wordpress.html#donations
June 29, 2010 at 03:19 #5179bestnight
MemberThanks! I look forward to it! Keep up the great work!
-
AuthorPosts
- You must be logged in to reply to this topic.