summaryrefslogtreecommitdiff
path: root/ext/fdf/fdf.c
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2001-07-13 16:58:09 +0000
committerRasmus Lerdorf <rasmus@php.net>2001-07-13 16:58:09 +0000
commitdf965e200c905de75c5c331b244c5f61f9c22c38 (patch)
tree5b81df06aee924772554eba1c674d3f3bbaffad0 /ext/fdf/fdf.c
parentf00791ce247e9aa5af4677cf4bcd625480992f1a (diff)
downloadphp-git-df965e200c905de75c5c331b244c5f61f9c22c38.tar.gz
Add fdf_set_encoding()
Diffstat (limited to 'ext/fdf/fdf.c')
-rw-r--r--ext/fdf/fdf.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c
index 78a08c3c91..6f7910813f 100644
--- a/ext/fdf/fdf.c
+++ b/ext/fdf/fdf.c
@@ -62,6 +62,7 @@ function_entry fdf_functions[] = {
PHP_FE(fdf_set_opt, NULL)
PHP_FE(fdf_set_submit_form_action, NULL)
PHP_FE(fdf_set_javascript_action, NULL)
+ PHP_FE(fdf_set_encoding, NULL)
{NULL, NULL, NULL}
};
/* }}} */
@@ -685,6 +686,38 @@ PHP_FUNCTION(fdf_set_javascript_action)
}
/* }}} */
+/* {{{ fdf_set_encoding(int fdf_document, string encoding)
+ Sets FDF encoding (either "Shift-JIS" or "Unicode") */
+PHP_FUNCTION(fdf_set_encoding) {
+ pval **arg1, **arg2;
+ int id, type;
+ FDFDoc fdf;
+ FDFErc err;
+ FDF_TLS_VARS;
+
+ if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long_ex(arg1);
+ convert_to_string_ex(arg2);
+ id=(*arg1)->value.lval;
+ fdf = zend_list_find(id,&type);
+ if(!fdf || type!=FDF_GLOBAL(le_fdf)) {
+ php_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ err = FDFSetEncoding(fdf, (*arg2)->value.str.val);
+
+ if(err != FDFErcOK) {
+ printf("error setting encoding\n");
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
+
/* {{{ SAPI_POST_HANDLER_FUNC
* SAPI post handler for FDF forms */
SAPI_POST_HANDLER_FUNC(fdf_post_handler)
@@ -757,6 +790,7 @@ SAPI_POST_HANDLER_FUNC(fdf_post_handler)
}
/* }}} */
+
#endif
/*