Download the PHP package appotter/mpdf without Composer

On this page you can find all versions of the php package appotter/mpdf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mpdf

mPDF is a PHP class which generates PDF files from UTF-8 encoded HTML. It is based on FPDF and HTML2FPDF (see GNU GPL v2 licence.

Releases

Installation

To test the installation, point your browser to the basic example file:

[path_to_mpdf_folder]/mpdf/examples/example01_basic.php

If you wish to define a different folder for temporary files rather than /tmp/ 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.

Fonts

Let us refer to font names in 2 ways:

  1. "CSS font-family name" - mPDF is designed primarily to read HTML and CSS. This is the name used in CSS e.g.

    <p style="font-family: 'Trebuchet MS';">

  2. "mPDF font-family name" - the name used internally to process fonts. This could be anything you like, but by default mPDF will convert CSS font-family names by removing any spaces and changing to lowercase. Reading the name above, mPDF will look for a "mPDF font-family name" of:

    'trebuchetms'

The configurable values referred to below are set in the config_fonts.php file.

When parsing HTML/CSS, mPDF will read the CSS font-family name (e.g. 'Trebuchet MS') and convert by removing any spaces and changing to lowercase, to look for a mPDF font-family name (trebuchetms).

Next it will look for a translation (if set) in config_font.php e.g.:

$this->fonttrans = array(
    'trebuchetms' => 'trebuchet'
)

Now the mPDF font-family name to be used is 'trebuchet'

If you wish to make this font available, you need to specify the Truetype .ttf font files for each variant. These should be defined in config_font.php in the array:

$this->fontdata = array(
    "trebuchet" => array(
        'R' => "trebuc.ttf",
        'B' => "trebucbd.ttf",
        'I' => "trebucit.ttf",
        'BI' => "trebucbi.ttf",
        )
)

This is the array which determines whether a font is available to mPDF. Each font-family must have a Regular ['R'] file defined - the others (bold, italic, bold-italic) are optional.

mPDF will try to load the font-file. If you have defined _MPDF_SYSTEM_TTFONTS at the top of the config_fonts.php file, it will first look for the font-file there. This is useful if you are running mPDF on a computer which already has a folder with TTF fonts in (e.g. on Windows)

If the font-file is not there, or _MPDF_SYSTEM_TTFONTS is not defined, mPDF will look in the folder

/[your_path_to_mpdf]/ttfonts/

Note that the font-file names are case-sensitive and can contain capitals.

If the folder /ttfontdata/ is writeable (CHMOD 644 or 755), mPDF will save files there which it can re-use next time it accesses a particular font. This will significantly improve processing time and is strongly recommended.

mPDF should be able to read most TrueType Unicode font files with a .ttf extension. Truetype fonts with .otf extension that are OpenType also work OK. TrueType collections (.ttc) will also work if they contain TrueType Unicode fonts.

Character substitution

Most people will have access to a Pan-Unicode font with most Unicode characters in it such as Arial Unicode MS. Set:

$this->backupSubsFont = array('arialunicodems');

at the top of the config_fonts.php file to use this font when substituting any characters not found in the specific font being used.

Example: You can set:

$mpdf->useSubstitutions = true;

at runtime, or

$this->useSubstitutions = true;

in the config.php file

This text contains a Thai character ม which does not exist in the Comic Sans MS font file

When useSubstitutions is true, mPDF will try to find substitutions for any missing characters: 1) firstly looks if the character is available in the inbuilt Symbols or ZapfDingbats fonts; 2) [If defined] looks in each of the the font(s) set by $this->backupSubsFont array

NB There is an increase in processing time when using substitutions, and even more so if a backupSubsFont is defined.

Controlling mPDF mode

The first parameter of new mPDF('') works as follows:

For backwards compatibility, new mPDF('-s') and new mPDF('s') will force subsetting by setting

$this->percentSubset=100

new mPDF('utf-8-s') and new mPDF('ar-s') are also recognised

Configuration variables changed

Configuration variables are documented in the on-line manual.

Font folders

If you wish to define your own font file folders (perhaps to share), you can define the 2 constants in your script before including the mpdf.php script e.g.:

define('_MPDF_TTFONTPATH','your_path/ttfonts/');
define('_MPDF_TTFONTDATAPATH','your_path/ttfontdata/');     // should be writeable

All versions of mpdf with dependencies

PHP Build Version
Package Version
Requires php Version >=5.0.3
ext-mbstring Version *
appotter/jpgraph Version ~4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package appotter/mpdf contains the following files

Loading the files please wait ....