first of all, thanks for the great module,
i just wanted to know if there is a hidden option to set up a pdf footer or if it is a feature not yet available
thanks again
enrico

Comments

kaido.toomingas’s picture

No footer at this point. If you are interested in custom development you can contact me directly.

marco van bemmel’s picture

There is a simple way to add a footer:

You can copy 'views-view.tpl.php' (from the view module) to your theme folder and rename it to 'views-view--commerce_order2pdf.tpl.php'. This will be the theme file of your PDF.
Now you can modify the file and add a footer. You can also use tokens with:

print token_replace('[site:name]');

If you see the footer twice (below the line items) you should change the display of the line item of the view 'commerce_order2pdf' to the regular 'commerce_line_item_table'.

I hope this would help...

@Kaido, thank you for this awsome module. I use it in a multi site (domain access) because of its flexibility.

elpino’s picture

I've found it is possible to define/include both header and footer using mPDF's custom elements <htmlpageheader> and <htmlpagefooter> and setting them with <sethtmlpageheader> and <sethtmlpagefooter>.

You can find more info in mPDF's documentation here https://developer.gravitypdf.com/documentation/headers-and-footers-pdf-t...

But the gist is to add something like the following into the Set PDF order header field between <!--mpdf mdpf--> comment tags:

<!--mpdf
<htmlpageheader name="firstPageHeader">
<table id="pdf-header" class="front">
	<tr>
		<td>
			<h1 class="header__site-name" id="site-name">Some Frontpage Title</h1>
		<td>
	</tr>
</table>
</htmlpageheader>

<htmlpageheader name="PageHeader">
<table id="pdf-header" class="not-front">
	<tr>
		<td>
			<h1 class="header__site-name" id="site-name">Some Other Title</h1>
		<td>
	</tr>
</table>
</htmlpageheader>

<htmlpagefooter name="PageFooter">
<table id="pdf-footer">
	<tr>
		<td id="site-info">Legal notices, links, etc.</td>
	</tr>
</table>
</htmlpagefooter>

<sethtmlpageheader name="firstPageHeader" value="on" show-this-page="1" />
<sethtmlpageheader name="PageHeader" value="on" />
<sethtmlpagefooter name="PageFooter" value="on" />
mpdf-->

And setting the header y footers via CSS like so:

/*Named header/footer must match the ones defined beforehand and prepended by 'html_' */
@page {
	odd-header-name: html_PageHeader;
	odd-footer-name: html_PageFooter;
	
	even-header-name: html_PageHeader;
	even-footer-name: html_PageFooter;
	
	header-name: html_PageHeader;
	footer-name: html_PageFooter;
}