Coder Social home page Coder Social logo

rtoi / mpdf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mpdf/mpdf

0.0 2.0 0.0 87.77 MB

mPDF is a PHP library generating PDF files from UTF-8 encoded HTML

Home Page: https://mpdf.github.io

License: GNU General Public License v2.0

PHP 99.70% CSS 0.30%

mpdf's Introduction

mPDF is a PHP class which generates PDF files from UTF-8 encoded HTML. It is based on FPDF and HTML2FPDF (see CREDITS), with a number of enhancements. mPDF was written by Ian Back and is released under the GNU GPL v2 licence.

Build Status

Note: If you are viewing this file on mPDF Github repository homepage, please note that the default repository branch is development which can differ from the last stable release.

Requirements

mPDF 7.0 requires PHP ^5.6 || ~7.0.0. PHP mbstring and gd extensions have to be loaded.

PHP ~7.1.0 should be compatible.

Additional extensions may be required for some advanced features such as zlib for compression of embedded resources such as fonts or bcmath for generating barcodes.

Installation

Official installation method is via composer and its packagist package mpdf/mpdf.

$ composer require mpdf/mpdf

Usage

The simplest usage of the library would be as follows:

<?php

require_once __DIR__ . '/vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<h1>Hello world!</h1>');
$mpdf->Output();

This will output the HTML inline to the browser.

Setup & Configuration

All configuration directives can be set by the $config parameter of the constructor.

It is recommended to set one's own temporary directory via tempDir and fontTempDir configuration variables. The directory must have write permissions (mode 775 is recommended).

<?php

$mpdf = new \Mpdf\Mpdf(['tempDir' => __DIR__ . '/tmp']);

By default, the temporary directory will be inside vendor directory and will have correct permissions from post_install composer script.

For more information about custom temporary directory see the note on Folder for temporary files in the section on Installation & Setup in the manual.

If you have problems, please read the section on troubleshooting in the manual.

Online manual

Online manual is available at https://mpdf.github.io/.

Contributing

See CONTRIBUTING.md file in the project.

Unit Testing

Unit testing for mPDF is done using PHPUnit.

To get started, run composer install from the command line while in the mPDF root directory (you'll need composer installed first).

To execute tests, run vendor/bin/phpunit from the command line while in the mPDF root directory.

Any assistance writing unit tests for mPDF is greatly appreciated. If you'd like to help, please note that any PHP file located in the /tests/ directory will be autoloaded when unit testing.

mpdf's People

Contributors

danielhjames avatar dundee avatar fglueck avatar finwe avatar heldchen avatar jakejackson1 avatar jamescarlos avatar janslabon avatar jayvdb avatar jdufresne avatar marclaporte avatar mgersten-caxy avatar palmic avatar patromo avatar ram4nd avatar rtoi avatar scottconnerly avatar seldaek avatar silverfire avatar tomk avatar verron avatar

Watchers

 avatar  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.