Download the PHP package arabel/pdf without Composer

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

arabel/pdf

Lightweight · Zero-Dependency · Fast — PDF generation for PHP 8.1+

PHP Version Downloads License

Generate PDFs with a fluent, semantic API — no mPDF, no dompdf, no TCPDF bloat.
Two layers: a high-level Document API for reports and invoices, and a low-level Pdf API for pixel-perfect control.

Work in progress. The API is functional and tested, but breaking changes may occur before v1.0.


Why arabel/pdf?

Most PHP PDF libraries are either too heavy (mPDF, TCPDF ship megabytes of dependencies) or too low-level (raw PDF forces you to think in millimetres for everything).

arabel/pdf gives you the best of both worlds:

arabel/pdf mPDF dompdf TCPDF
Dependencies 0 Many Many Some
Speed ⭐⭐⭐⭐⭐ ⭐⭐ ⭐⭐⭐ ⭐⭐⭐
Fluent API Partial
PHP 8.1+ native Partial Partial
Package size ~100 KB > 10 MB Large Large

Based on community benchmarks and package sizes. Formal benchmarks coming in v1.0.


Installation

Requirements: PHP 8.1+ · Extensions zlib and iconv (both enabled by default in most environments) · GD for PNG images with alpha channel


Two layers

Start with Document — no millimetres, no cursor math.
Drop down to Pdf via $doc->raw() when you need exact positioning.


Document API

Basic example

Named headers and footers

Define repeatable headers and footers once — they are applied automatically on every addPage().
Multiple named variants let you use different headers for different sections.

Automatic page break

Content never overlaps the footer. Before rendering each element, the Document measures its height and triggers a new page automatically if it would exceed the safe area.

Grid layout — row / col

The page is divided into a 12-column grid. Use col($span) to define how many columns a block occupies (1–12).

Images in columns

Use col()->image() to embed a JPEG or PNG directly inside the grid.
Height is auto-calculated from the image's aspect ratio — pass an explicit $h (mm) to override.
PNG files with alpha channel are supported: the alpha layer is composited against white.

Tables

widths(), align(), and tr() can be called in any order — rendering is deferred to endTable().

Colspan — merge cells across columns:

Colored panels

Background is measured and drawn before text — no coordinate math required.

DocumentStyle

Document methods reference

Method Description
setMargins(l, t, r, b) Override default 15 mm margins — call before addPage()
addPage('P'\|'L', $header) New page — portrait or landscape, optional named header
setHeader(string $name = 'default') Register a named header → Header
setFooter(string $name = 'default') Register a named footer → Footer
h1(string) Large heading
h2(string) Section heading
p(string) Body paragraph
b(string) Bold paragraph
i(string) Italic paragraph
bi(string) Bold + italic paragraph
hr() Horizontal rule
spacer(float $mm = 6) Vertical blank space
row() Open a 12-column grid row → Row
col(int)->image(file, h) Embed image in a column — auto height from aspect ratio
table(array $headers) Open a table → Table
panel() Open a colored content block → Panel
output(string, string) Finalize and output the PDF
raw() Access the underlying Pdf instance
getCursorY() Current Y position in mm
colX(int $startSpan) X coordinate of a grid column — use with raw()
colW(int $span) Width of N grid columns — use with raw()

Pdf API

Use Pdf directly when you need pixel-precise control.

All mutating methods return static — the full API is fluent.

Pdf methods reference

Method Description
addPage('P'\|'L') New page
setFont(family, size, style) Set font family, size in pt, style ('B', 'I', 'BI')
setTextColor(r, g, b) Text colour (0–255 per channel)
setFillColor(r, g, b) Fill colour for cells and rects
setDrawColor(r, g, b) Stroke colour for borders and lines
setLineWidth(float) Line thickness in mm
setMargins(l, t, r, b) Page margins in mm
setXY(x, y) Move cursor to absolute position (mm)
getX() / getY() Current cursor position in mm
getStringWidth(string) Measure string width in mm
text(x, y, string) Print text at absolute position
cell(w, h, text, border, ln, align) Render a cell, advance cursor
rect(x, y, w, h, style) Draw a rectangle
line(x1, y1, x2, y2) Draw a line
image(file, x, y, w, h) Embed a JPEG or PNG image
output(name, dest) Finalize and output the PDF

output() destinations

Dest Behaviour
'D' Force browser download (default)
'I' Open inline in browser
'F' Save to file ($name = full path)
'S' Return raw PDF bytes as string

Mixing both layers


Roadmap to v1.0


License

MIT © Arabel


⭐ If you find this useful, a star goes a long way.
Issues, feedback, and PRs are very welcome.


All versions of pdf with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-zlib Version *
ext-iconv Version *
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 arabel/pdf contains the following files

Loading the files please wait ...