Coder Social home page Coder Social logo

pdfview's Introduction

PDF View

Extension for Kohana's View class that renders as a PDF instead of HTML. Uses DOMPDF to render normal HTML views as PDF Files.

Please report all bugs related to PDF rendering to the DOMPDF issue tracker.

Installation

If your application is a Git repository:

git submodule add git://github.com/shadowhand/pdfview.git modules/pdfview
git submodule update --init

Or clone the the module separately:

cd modules
git clone git://github.com/shadowhand/pdfview.git pdfview

Update DOMPDF

Now install DOMPDF using the submodule:

cd modules/pdfview
git submodule update --init

This will install DOMPDF to vendor/dompdf/dompdf from the DOMPDF Git mirror. For DOMPDF to work properly, the fonts directory must be writable:

# Replace "http" with your web server user and group!
chown http:http vendor/dompdf/dompdf/lib/fonts
# An insecure alternative:
# chmod 0777 vendor/dompdf/dompdf/lib/fonts

Configuration

Edit application/bootstrap.php and add a the module:

Kohana::modules(array(
    ...
    'pdfview' => 'modules/pdfview',
    ...
));

Usage

Placed in a controller action:

// Load a view using the PDF extension
$pdf = View_PDF::factory('pdf/example');

// Use the PDF as the request response
$this->request->response = $pdf;

// Display the PDF in the browser as "my_pdf.pdf"
// Remove "inline = TRUE" to force the PDF to be downloaded
$this->request->send_file(TRUE, 'my_pdf.pdf', array('inline' => TRUE));

pdfview's People

Contributors

shadowhand avatar

Watchers

 avatar  avatar

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.