Giter VIP home page Giter VIP logo

fpdf-for-ci's Introduction

fpdf-for-CI

fpdf on CodeIgniter

Introduction The fpdf library found on fpdf.org must be loaded as a library to be used while following proper CI syntax.

HowTo You must first load the fpdf class as a CI Library. This can be done in the autoload file application/config/autoload.php (preferred) or within individual controllers.

$this->load->library('fpdf');

Now, you can use it natively within CI.

$this->load->library('fpdf');
$filename =  somefile;
$content = 'My Content';
$basepath = getcwd;

$this->fpdf->fpdf('P','mm','A4');
$this->fpdf->AddPage();
$this->fpdf->SetFont('Arial','B',16);
$this->fpdf->Cell(40, 10, $content);
$this->fpdf->Output($basepath.'/pdf/'.$filename.'.pdf');   // print to the filesystem, save for future download
$this0>fpdf->Output($filename.'.pdf', 'D');                // send to browser and force download, not saved on filesystem

Note: You must load initialize the class with parameters each time you use it, i.e. call $this->fpdf->('P','mm','A4').

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.