GithubHelp home page GithubHelp logo

Comments (3)

turbo124 avatar turbo124 commented on May 25, 2024 1

@hunterwebsiteservices

Yes, it is a native component to the app already. The only missing piece currently is the UI implementation.

You can inspect the react UI for this particular feature here:

invoiceninja/ui#1300

This PR should work with the current API and you can see how this would work in practice.

from invoiceninja.

turbo124 avatar turbo124 commented on May 25, 2024

@hunterwebsiteservices

The foundations of this have already been created in the application.

I have built a twig templating engine which can accept an array of objects (say tasks) and these can then be pushed through your own Twig Template Document to generate a PDF document as required.

The only thing that is yet to be included is the option to also push documents/attachments through the template engine, however there is associated functionality which can be reused to insert images onto these documents.

ie

        $dom = new \DOMDocument('1.0', 'UTF-8');

        $container =  $dom->createElement('div');
        $container->setAttribute('style', 'display:grid; grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);justify-items: center;');

        /** @var \App\Models\Document $document */
        foreach ($this->entity->documents()->where('is_public', true)->get() as $document) {
            if (!$document->isImage()) {
                continue;
            }

            $image = $dom->createElement('img');

            $image->setAttribute('src', "data:image/png;base64,".base64_encode($document->compress()));
            $image->setAttribute('style', 'max-width: 50%; margin-top: 20px;');

            $container->appendChild($image);
        }

        $dom->appendChild($container);

        $html = $dom->saveHTML();

        $dom = null;

        return $html;

We are yet to release the template engine, however when it is, your use case would be supported.

from invoiceninja.

hunterwebsiteservices avatar hunterwebsiteservices commented on May 25, 2024

Is there a roadmap or issue where progress of the template engine can be tracked, or read more?

Am I right in assuming the templating engine will be a native part of the core Invoice Ninja project? And is it a generic engine to grab any record (invoice, task, client), with customisable filters/search criterea, and produce a PDF?

from invoiceninja.

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.