Patch that allows retrieval of the length in bytes of the output buffer for
a finalized pdf document that has been created in memory.

This is good for sending a 'Content-Length' header before outputting the pdf
file from memory. MSIE requires a properly set 'Content-Length' header in
order to display the pdf document correctly.

--
Justin Garrett


----------START PATCH--------------------------------

/* {{{ proto int cpdf_buffer_length(int pdfdoc)
   Returns current length of the output buffer */
PHP_FUNCTION(cpdf_buffer_length) {
        pval *arg1;
        int id, type, length;
        CPDFdoc *pdf;
        CPDF_TLS_VARS;

        if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE)
{
                WRONG_PARAM_COUNT;
        }

        convert_to_long(arg1);
        id=arg1->value.lval;
        pdf = zend_list_find(id,&type);
        if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
                php_error(E_WARNING,"Unable to find identifier %d",id);
                RETURN_FALSE;
        }

        cpdf_getBufferForPDF(pdf, &length);

        RETURN_LONG(length);
}
/* }}} */

--------END PATCH-----------------------------------


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to