Forums / Developer / Output non-html (pdf) code from ez extension

Output non-html (pdf) code from ez extension

Author Message

Dominik Pich

Monday 03 May 2004 7:07:42 am

Is it possible to output non-html (pdf) code from ez extensions?
e.g.

I have an extension download and a view get which gets POSTed a filename (or its id) - now it should determine its mime type and output it.

STEVO +

Thursday 06 May 2004 5:24:19 am

something like this:

    ob_clean();

    header( 'X-Powered-By: eZ publish' );
    header( 'Content-Length: '. filesize( $cacheFile ) );
    header( 'Content-Type: application/pdf' );
    header( 'Content-Transfer-Encoding: binary' );
    header( 'Accept-Ranges: bytes' );

    ob_end_clean();

    $fp = @fopen( $cacheFile, 'r' );
    @fpassthru( $fp );

    include_once( 'lib/ezutils/classes/ezexecution.php' );
    eZExecution::cleanExit();

from http://pubsvn.ez.no/nextgen/trunk/kernel/content/pdf.php