VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Kuubs on March 04, 2020, 08:34:16 AM

Title: Image in footer invoice
Post by: Kuubs on March 04, 2020, 08:34:16 AM
Hello


I want to place an image full width at the bottom of my pages in my invoice. How can I do this? I tried using an img block, but position absolute does not work, and also just adding it into the HTML gives me white margins (because of the margins definced in the TCPDF). Can I use TCPDF commands to add a footer and image?
Title: Re: Image in footer invoice
Post by: Kuubs on March 16, 2020, 16:47:39 PM
Ok I found a file in the helper folder of Virtuemart component. There is a header section:

// get the current page break margin
        $bMargin = $this->getBreakMargin();
        // get current auto-page-break mode
        $auto_page_break = $this->AutoPageBreak;
        // disable auto-page-break
        $this->SetAutoPageBreak(false, 0);
        // set bacground image
        $img_file = K_PATH_IMAGES.'bg-footer.jpg';
        $this->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
        // restore auto-page-break status
        $this->SetAutoPageBreak($auto_page_break, $bMargin);
        // set the starting point for the page content
        $this->setPageMark();


I added this so it adds a full page background: https://tcpdf.org/examples/example_051/

But it's not working. Anyone has an idea why not?
Title: Re: Image in footer invoice
Post by: Kuubs on March 20, 2020, 09:55:04 AM
Can I change the topic to General questions, hoping someone could help me there?
Title: Re: Image in footer invoice
Post by: GJC Web Design on March 20, 2020, 11:16:57 AM
I gave up trying to have a background image with tcpdf...

In the end I set all margins to 0
added an image in a table .. again all margins and paddings 0
then the rest of the invoice with tables and tds

td width="10%"
td width="80%" // this contains all the sub templates
td width="10%"

Don't know how u will get the image to the footer though ..  I found a lot of the TCPDF code snippets simply didn't work for me in the helper
The above way at least avoids core change

Title: Re: Image in footer invoice
Post by: Kuubs on March 24, 2020, 13:55:53 PM
Quote from: GJC Web Design on March 20, 2020, 11:16:57 AM
I gave up trying to have a background image with tcpdf...

In the end I set all margins to 0
added an image in a table .. again all margins and paddings 0
then the rest of the invoice with tables and tds

td width="10%"
td width="80%" // this contains all the sub templates
td width="10%"

Don't know how u will get the image to the footer though ..  I found a lot of the TCPDF code snippets simply didn't work for me in the helper
The above way at least avoids core change

Hmm, maybe I should give this a try. Thanks for replying.
Title: Re: Image in footer invoice
Post by: StefanSTS on March 26, 2020, 00:05:51 AM
The easiest way to achieve this will be to get pre printed invoice paper with the header and footer done already.
Title: Re: Image in footer invoice
Post by: GJC Web Design on March 26, 2020, 10:53:20 AM
clever boy....  :)

except I never waste a tree and print mine..  ;)
Title: Re: Image in footer invoice
Post by: StefanSTS on March 26, 2020, 21:16:14 PM
Quote from: GJC Web Design on March 26, 2020, 10:53:20 AM
clever boy....  :)
except I never waste a tree and print mine..  ;)

True, me not too. ;-)