[PATCH] clibpdf -- get_buffer_length()
| From: | Justin Garrett | Date: | Sun, 28 Oct 2001 05:45:44 +0000 |
| Subject: | [PATCH] clibpdf -- get_buffer_length() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-69162@lists.php.net to get a copy of this message | ||
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-----------------------------------