Author Topic: Image in footer invoice  (Read 1054 times)

Huubs

  • Jr. Member
  • **
  • Posts: 198
Image in footer invoice
« 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?

Huubs

  • Jr. Member
  • **
  • Posts: 198
Re: Image in footer invoice
« Reply #1 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:

Code: [Select]
// 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?

Huubs

  • Jr. Member
  • **
  • Posts: 198
Re: Image in footer invoice
« Reply #2 on: March 20, 2020, 09:55:04 am »
Can I change the topic to General questions, hoping someone could help me there?

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9496
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Image in footer invoice
« Reply #3 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

GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Huubs

  • Jr. Member
  • **
  • Posts: 198
Re: Image in footer invoice
« Reply #4 on: March 24, 2020, 13:55:53 pm »
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.

StefanSTS

  • Global Moderator
  • Full Member
  • *
  • Posts: 534
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: Image in footer invoice
« Reply #5 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.
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9496
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Image in footer invoice
« Reply #6 on: March 26, 2020, 10:53:20 am »
clever boy....  :)

except I never waste a tree and print mine..  ;)
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

StefanSTS

  • Global Moderator
  • Full Member
  • *
  • Posts: 534
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: Image in footer invoice
« Reply #7 on: March 26, 2020, 21:16:14 pm »
clever boy....  :)
except I never waste a tree and print mine..  ;)

True, me not too. ;-)
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.