Giter Site home page Giter Site logo

berecont / contao-isotope-pdf-templates Goto Github PK

View Code? Open in Web Editor NEW

This project forked from inspiredminds/contao-isotope-pdf-templates

0.0 0.0 0.0 88 KB

Adds a new document type in Contao Isotope where you can define PDF templates.

License: GNU Lesser General Public License v3.0

PHP 100.00%

contao-isotope-pdf-templates's Introduction

Contao Isotope PDF Templates

Adds a new document type in Contao Isotope where you can define PDF templates.

Important: version 2.x of this extension uses mPDF instead of TCPDF. Here are some things to note:

  • mPDF only supports the following fonts: https://mpdf.github.io/fonts-languages/fonts-in-mpdf-7-x.html.
  • mPDF has superior HTML and CSS capabilities.
  • It is recommended to use a full HTML markup in your iso_document_โ€ฆ template.
  • By default only PDF documents up to PDF version 1.4 are supported by the FPDI PDF-Parser used by mPDF, thus you may need to convert them to this version beforehand. However, you can buy the commercial version in order to be able to convert any PDF.

Screenshot

Custom fonts

Since version 2.1.0 you are able to integrate custom fonts directly via the back end. First you need to upload the TTF files into a directory within /files. Then you need to chose that folder in the font settings of the document. After choosing the correct folder you need to save the settings, then you will be able to configure the discovered font files.

Screenshot

For each font you want to use you need enable it and set the variant and family name of the font.

Event

The extension provides a ModifyPdfEvent with which you can access the mPDF Isotope Document instance, in order to change some parameters or add additional variables etc.

// src/EventListener/ModifyPdfEventListener.php
namespace App\EventListener;

use InspiredMinds\ContaoIsotopePdfTemplatesBundle\Event\ModifyPdfEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

#[AsEventListener(ModifyPdfEvent::EVENT_NAME)]
class ModifyPdfEventListener
{
    public function __invoke(ModifyPdfEvent $event): void
    {
        // Access the mPDF object instance
        $mpdf = $event->getPdf();

        // Access the Isotope Document instance
        $document = $event->getDocument();
    }
}

contao-isotope-pdf-templates's People

Contributors

fritzmg avatar berecont avatar baumannsven avatar

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.