Download the PHP package iwasherefirst2/pretty-pdf without Composer

On this page you can find all versions of the php package iwasherefirst2/pretty-pdf. 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 pretty-pdf

PrettyPdf

This package helps you to create invoices and letters with PHP with UTF8 support.

The invoice looks like this: image

The best thing about this package is that the invoices look absolutly fantastic and in addition, the address of your letter/invoice fully fits your envelope window! 20210326_173723

The default format is A4. If you need a different format, just the FPDF standard methods.

Each section of the invoice relates to a method: image

Required PHP Version

Min PHP Version Pretty PDF Version
PHP 7.4 v.2.0
PHP 5 v.1.1.0

Installation

Install via composer:

Example

Methods

Most important function is the output function which renders the pdf, either by saving it as a file or by viewing the PDF in the browser, or save it as a string.

You can call all other functions from FPDF.

In addition, the following functions are available:

Methods Description
localize('en') Set language of document. Currently only English (en) and German (de) is supported. Feel free to add more languages to the repository, merge requests are welcome.
setLocalizationPath(/full/path/) Full path to your custom localization files, if you don't want to use the repositorie ones.
logo(/full/path/logo.png) Adds the logo to your pdf to the top left corner.
receiverAdress(['Max Musterman', 'Victoria Luise Platz 97', '10777 Berlin', 'Germany') Address of document. Height will be adjustet so that it fits on the envelope. Each entry of the array has its own line.
returnAddress('My home address, Germany 121212') Return address. Will be written as single line above address.
invoiceBox(['Date' => 'Today', 'Invoice' => 'I 2020-03-22', 'Tax-Number' => '18/455/12345']) Will add a little box with heading "Invoice" right from the address.
headerInfoBox(['Max Mastermind', 'Your Adress', 'New York']) Your address in the top right corner.
items([$itemA, $itemB, $itemC], $vat) Receives an array (or any iterable object) of \BeautyBill\Partials\Body\Data\Item objects and the VAT in percent. For example, in Germany we have 19% VAT, so 19 has to be passed as a parameter. Each represents a row of your invoice
paymentInfo($paymentInfoData) Receives an object of \BeautyBill\Partials\Body\Data\PaymentInfo. This will create an info how to pay on the lower left side.
additionalNote(string $text) Showes a note for special rules that apply to invoice. Note appears on the lower right side.
date(string $text) Adds a date to the left side, usefull for letters. If no argument is passed, show current date
foldMarker() Add a mark where to fold the letter
tableBox(string $title, array $rows) Add a headline and a tablein the top right corner
text(string $text) A text. This is when you want to use this class for a letter. Use "\n" in your string for returns

How can I add my own styling?

Simply create a class that extends PrettyPdf\Partials\Drawable.

Next, you need to register your class or classes to PrettyPdf:

Now you can use the method by simply calling the classname on $prettyPdf:

How does testing work?

A pdf will be created during the test and compared to an existing pdf. Since comparing pdf documents is not feasible, since the file itself contain meta-data that are always distinct, our tests convert the pdf to an image and compare the images.

Thus, we require for testing the ImageMagic and GD library. To make your life easier, this package ships with a docker file.

You may use it like this:

Next, go inside the container to install composer and run phpunit:

Create a test class that extends from BeautyBillTestCase.

Here is an example:

When storeOnly is set to true, it will not compare pdfs but just store the pdf in Test.pdf or whatever name you put in the method assertEqualPDFs. Once the pdf looks as you want to have it, you may remove the storeOnly line.


All versions of pretty-pdf with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
setasign/tfpdf Version ^1.32
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 iwasherefirst2/pretty-pdf contains the following files

Loading the files please wait ....