TCPDF Warper: Create PDF documents using TCPDF fluent interface

Recommend this page to a friend!
  Info   Example   Screenshots   View files (74)   Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 489 All time: 5,811 This week: 242
Version License PHP version Categories
tcpdf-warper 0.2.4Custom (specified...5.4PHP 5, Files and Folders, Printing, L..., T...
Description Author

This class can create PDF documents using fluent interface around the TCPDF library.

It provides several classes and traits that can be used to compose and render PDF documents using the TCPDF package.

Currently it provides wrappers for adding text, images, barcodes and cell elements.

Recommendations

What is the best PHP pdf creation class?
CREATE PDF

Extract database table data
Get database content into a PDF file

Picture of Michal Kowalik
  Performance   Level  
Name: Michal Kowalik <contact>
Classes: 3 packages by
Country: Poland Poland
Age: ???
All time rank: 245860 in Poland Poland
Week rank: 771 19 in Poland Poland
Innovation award
Innovation award
Nominee: 1x

Details

TCPDF Warper

Build Status SensioLabsInsight Code Climate Test Coverage Latest Stable Version Latest Unstable Version PHP Version License

Installation

 composer require tecnick.com/tcpdf       ### or any TCPDF library
 composer require org.majkel/tcpdfwarper

About

Provides fluent statement builders for TCPDF library.

Mine intention was to make calls to methods, with many arguments, clearer and more maintainable.

// instead of
$pdf = new \TCPDF();
$pdf->Image($file, $x, $y, $w, $h, '', '', '', true, 300, '',
         true, false, 10, true, false, false, true, $altimgs);

// you can use this
$pdf = new \org\majkel\tcpdfwarper\TCPDFWarper();
$pdf->buildImage()->setFile($file)
    ->setPos(20, 20)->setSize(64, 64)
    ->setAlt(true)->setAltImgs($altimgs)
    ->render();

No more hassle with remembering which argument is which or hardcodeing long list of parameters just to change last one of them.

Following methods are supported

* Cell (buildCell) * Multicell (buildMulticell) * Image (buildImage) * ImageSvg (buildImageSvg) * ImageEps (buildImageEps) * Text (buildText) * writeHTML (buildHtml) * writeHTMLCell (buildHtmlCell) * write1DBarcode (buildBarcode1d) * write2DBarcode (buildBarcode2d) * Write (buildWrite)

If you are using some kind of fork of TCPDF, you can write your own warper. Every statement builder allows you to inject $tcpdf object.

 $image = new \org\majkel\tcpdfwarper\ImageOp($tcpdf);
 $image->setFile($file)
     ->setPos(20, 20)->setSize(64, 64)
     ->render();

Features

- Fully unit tested - Full code coverage - Code completion friendly (including documentation) - Tested against multiple php versions (5.4 - 7.0, hhvm) - Tested against multiple TCPDF libraries (see travis)

License

The MIT License (MIT)

Copyright (c) 2015 Micha? (majkel) Kowalik

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Bitdeli Badge

Screenshots  
  • tcpdfwarper-demo
  Files  
File Role Description
build (7 files)
examples (2 files)
src (1 directory)
style (1 file)
tests (1 file, 2 directories)
.codeclimate.yml Data Code Climate confguration
.travis.yml Data travis config
composer.json Data composer config
composer.lock Data composer lock
LICENSE.md Lic. LICENSE
phpunit.xml Data phpunit conf
README.md Doc. readme

  Files  /  build  
File Role Description
   generator.class.template.php Aux. generator class template
   generator.config.php Aux. generator config
   generator.php Aux. generator
   generator.trait.template.php Aux. generator trait template
   run_phpcs.sh Data phpcs command
   travis.composer.json Data travis composer
   travis.phpunit.xml Data travis phpunit

  Files  /  examples  
File Role Description
   example-01.php Example Example script 01
   image-01.jpg Data image for example 01

  Files  /  src  
File Role Description
org (1 directory)

  Files  /  src  /  org  
File Role Description
majkel (1 directory)

  Files  /  src  /  org  /  majkel  
File Role Description
tcpdfwarper (18 files, 1 directory)

  Files  /  src  /  org  /  majkel  /  tcpdfwarper  
File Role Description
generator (7 files)
   AbstractException.php Class Exception base class
   AbstractOp.php Class Call base class
   Barcode1dOp.php Class write1DBarcode
   Barcode2dOp.php Class write2DBarcode
   CellOp.php Class Cell call class
   HtmlCellOp.php Class writeHTMLCell
   HtmlOp.php Class writeHTML
   ImageEpsOp.php Class ImageEps
   ImageOp.php Class Image call class
   ImageSvgOp.php Class ImageSvg
   MissingArgException.php Class Missing argument exception
   MissingMethodException.php Class Missing method exception
   MultiCellOp.php Class Multicell call class
   TCPDFWarper.php Class The warper
   TCPDFWarperTrait.php Class Warper trait
   TextOp.php Class Text call class
   Utils.php Class Utility functions
   WriteOp.php Class Write

  Files  /  src  /  org  /  majkel  /  tcpdfwarper  /  generator  
File Role Description
   Argument.php Aux. generator
   ClassDefinition.php Aux. generator
   ClassMetaMethod.php Aux. generator
   ConfigItem.php Aux. generator
   ConfigMetaMethod.php Aux. generator
   Generator.php Aux. generator
   GeneratorException.php Aux. generator

  Files  /  style  
File Role Description
   ruleset.xml Data style rulset

  Files  /  tests  
File Role Description
org (1 directory)
report (1 file)
   bootstrap.php Test tests

  Files  /  tests  /  org  
File Role Description
majkel (1 directory)

  Files  /  tests  /  org  /  majkel  
File Role Description
tcpdfwarper (19 files, 1 directory)

  Files  /  tests  /  org  /  majkel  /  tcpdfwarper  
File Role Description
generator (7 files, 1 directory)
   AbstractOpTest.php Test tests
   AbstractTestCase.php Test tests
   Barcode1dOpTest.php Test test write1DBarcode
   Barcode2dOpTest.php Test test write2DBarcode
   CellOpTest.php Test tests
   DummyTcpdf.php Test dummy test tcpdf
   HtmlCellOpTest.php Test test writeHTMLCell
   HtmlOpTest.php Test test writeHTML
   ImageEpsOpTest.php Test test ImageEps
   ImageOpTest.php Test tests
   ImageSvgOpTest.php Test test ImageSvg
   MissingArgExceptionTest.php Test tests
   MissingMethodExceptionTest.php Test tests
   MulticellOpTest.php Test tests
   OpTestAbstract.php Test tests
   TCPDFWarperTest.php Test tests
   TextOpTest.php Test tests
   UtilsTest.php Test Utility functions tests
   WriteOpTest.php Test test Write

  Files  /  tests  /  org  /  majkel  /  tcpdfwarper  /  generator  
File Role Description
data (4 files)
   ClassDefinitionMock.php Aux. test generator
   ClassDefinitionSampleClass.php Aux. test generator
   ClassDefinitionTest.php Test test generator
   ConfigItemTest.php Test test generator
   ConfigMetaMethodTest.php Test test generator
   FuncMock.php Aux. test generator
   GeneratorTest.php Test test generator

  Files  /  tests  /  org  /  majkel  /  tcpdfwarper  /  generator  /  data  
File Role Description
   class.template.php Aux. test generator
   config.invalid.php Aux. test generator
   config.test.php Aux. test generator
   trait.template.php Aux. test generator

  Files  /  tests  /  report  
File Role Description
   .gitignore Data .gitignore

 Version Control Unique User Downloads Download Rankings  
 98%
Total:489
This week:0
All time:5,811
This week:242

For more information send a message to info at phpclasses dot org.