cvs: php4 /ext/pdf/ pdf.c php_pdf.h

From: Date: Wed, 07 Jun 2000 18:06:10 +0000
Subject: cvs: php4 /ext/pdf/ pdf.c php_pdf.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-71@lists.php.net to get a copy of this message
steinm Wed Jun 7 11:06:10 2000 EDT Modified files: /php4/ext/pdf pdf.c php_pdf.h Log: - new function pdf_set_info() to replace pdf_set_info_xxx() Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.41 php4/ext/pdf/pdf.c:1.42 --- php4/ext/pdf/pdf.c:1.41 Tue Jun 6 12:59:29 2000 +++ php4/ext/pdf/pdf.c Wed Jun 7 11:06:10 2000 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdf.c,v 1.41 2000/06/06 19:59:29 steinm Exp $ */ +/* $Id: pdf.c,v 1.42 2000/06/07 18:06:10 steinm Exp $ */ /* pdflib 2.02 is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997 Thomas Merz. */ @@ -83,6 +83,7 @@ #endif function_entry pdf_functions[] = { + PHP_FE(pdf_set_info, NULL) PHP_FE(pdf_set_info_creator, NULL) PHP_FE(pdf_set_info_title, NULL) PHP_FE(pdf_set_info_subject, NULL) @@ -265,6 +266,35 @@ return SUCCESS; } +/* {{{ proto bool pdf_set_info(int pdfdoc, string fieldname, string value) + Fills an info field of the document */ +PHP_FUNCTION(pdf_set_info) { + pval *arg1, *arg2, *arg3; + int id, type; + PDF *pdf; + PDF_TLS_VARS; + + + if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(arg1); + convert_to_string(arg2); + convert_to_string(arg3); + id=arg1->value.lval; + pdf = zend_list_find(id,&type); + if (!pdf || type!=PDF_GLOBAL(le_pdf)) { + php_error(E_WARNING,"Unable to find file identifier %d (type=%d)",id, type); + RETURN_FALSE; + } + + PDF_set_info(pdf, arg2->value.str.val, arg3->value.str.val); + + RETURN_TRUE; +} +/* }}} */ + /* {{{ proto bool pdf_set_info_creator(int pdfdoc, string creator) Fills the creator field of the document */ PHP_FUNCTION(pdf_set_info_creator) { @@ -291,7 +321,6 @@ RETURN_TRUE; } - /* }}} */ /* {{{ proto bool pdf_set_info_title(int pdfdoc, string title) @@ -475,7 +504,7 @@ } /* }}} */ -/* {{{ proto void pdf_begin_page(int pdfdoc, double height, double width) +/* {{{ proto void pdf_begin_page(int pdfdoc, double width, double height) Starts page */ PHP_FUNCTION(pdf_begin_page) { pval *arg1, *arg2, *arg3; @@ -492,15 +521,15 @@ convert_to_double(arg2); convert_to_double(arg3); id=arg1->value.lval; - height = arg2->value.dval; - width = arg3->value.dval; + width = arg2->value.dval; + height = arg3->value.dval; pdf = zend_list_find(id,&type); if(!pdf || type!=PDF_GLOBAL(le_pdf)) { php_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } - PDF_begin_page(pdf, (float) height, (float) width); + PDF_begin_page(pdf, (float) width, (float) height); RETURN_TRUE; } @@ -1841,7 +1870,7 @@ RETURN_FALSE; } - value = PDF_get_parameter(pdf, arg2->value.str.val, arg3->value.dval); + value = PDF_get_parameter(pdf, arg2->value.str.val, (float) (arg3->value.dval)); RETURN_STRING(value, 1); } Index: php4/ext/pdf/php_pdf.h diff -u php4/ext/pdf/php_pdf.h:1.8 php4/ext/pdf/php_pdf.h:1.9 --- php4/ext/pdf/php_pdf.h:1.8 Tue Jun 6 12:59:29 2000 +++ php4/ext/pdf/php_pdf.h Wed Jun 7 11:06:10 2000 @@ -26,7 +26,7 @@ | Authors: Uwe Steinmann | +----------------------------------------------------------------------+ */ -/* $Id: php_pdf.h,v 1.8 2000/06/06 19:59:29 steinm Exp $ */ +/* $Id: php_pdf.h,v 1.9 2000/06/07 18:06:10 steinm Exp $ */ #ifndef _PHP_PDF_H #define _PHP_PDF_H @@ -47,6 +47,7 @@ extern PHP_MINFO_FUNCTION(pdf); extern PHP_MINIT_FUNCTION(pdf); extern PHP_MSHUTDOWN_FUNCTION(pdf); +PHP_FUNCTION(pdf_set_info); PHP_FUNCTION(pdf_set_info_creator); PHP_FUNCTION(pdf_set_info_title); PHP_FUNCTION(pdf_set_info_subject);

« previous php.cvs (#71) next »