Git Product home page Git Product logo

Comments (3)

bartoszpietrzak1994 avatar bartoszpietrzak1994 commented on June 14, 2024 1

Hello TELLO0815!

I've investigated your problem and passing the template path with @SyliusInvoicingPlugin prefix doesn't work for me either.

Unfortunately, I have not found any other Symfony and knp_snappy users with the same problem as yours but I assume that the missing part here is calling the Twig templating engine with the header path as an argument.

Therefore, I changed the logic in the InvoicePdfFileGenerator's generate() method a bit:

$pdf = $this->pdfGenerator->getOutputFromHtml(
            $this->templatingEngine->render($this->template, [
                'invoice' => $invoice,
                'channel' => $channel,
                'invoiceLogoPath' => $this->fileLocator->locate($this->invoiceLogoPath),
            ]), 
            ['header-html' => $this->templatingEngine->render('@SyliusInvoicingPlugin/Invoice/Download/_header.html.twig')]
        );

and it works like a charm. For now I think that there are two ways of generating the invoice's header via knp_snappy bundle:

  1. Pass the path to the file using %kernel.project.dir% parameter, just like you did in your solution
  2. Overwrite the default InvoicePdfFileGenerator class implementation with a customized one using the snippet provided above.

from invoicingplugin.

bartoszpietrzak1994 avatar bartoszpietrzak1994 commented on June 14, 2024

Hello TELLO0815!

Which version of InvoicingPlugin are you currently using?

from invoicingplugin.

TELLO0815 avatar TELLO0815 commented on June 14, 2024

v0.8.3

from invoicingplugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.