Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Mpdf Port Bundle Laravel Package

chrisandchris/mpdf-port-bundle

View on GitHub
Deep Wiki
Context7

Installation

Using Composer (Symfony 2.1+)

  • Add a new line to your composer.json file:
  • Run a command
  • Add a new line to app/AppKernel.php:

Using deps-file (Symfony 2.0.x)

  • Add a new entry to your deps file:
  • Add a new line to app/AppKernel.php:
  • Add a new line to app/autoload.php:
  • Run a command

A Quick Start guide

How to create a Response object

This small example creates a PDF document with format A4 and portrait orientation:

Generate a variable with PDF content

Sometimes it is necessary to get a variabe which content is PDF document. Obviously, you might generate a response from the previous example and then call a method:

But there is a shorter way to get a raw content:

How to get an instance of \mPDF class

If you would like to work with mPDF class itself, you can use a getMpdf method:

Warning

  • By default the bundle adds the two attributes 'utf-8' and 'A4' to the mPDF class constructor. To turn off these options, use the setAddDefaultConstructorArgs method:
  • As the bundle inserts the first two arguments to the mPDF constructor by default, additional constructor arguments should start from the 3rd argument (default_font_size).

  • If the setAddDefaultConstructorArgs(false) method is called, additional arguments for constructor should start from the first one (mode).

Additional arguments

As the bundle uses methods of mPDF class, some additional parameters can be added to these methods. There are 3 mPDF methods used in the bundle:

To pass additional arguments, an array with arguments should be created:

It is NOT necessary to have all the keys in array. This array might be passed to the generatePdf and generatePdfResponse methods as the second argument:

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui