From: Antony Dovgal Date: Tue, 8 Feb 2005 13:40:37 +0000 (+0000) Subject: move ext/cpdf to PECL X-Git-Tag: RELEASE_0_2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc27a2af7a9c4bfa679f3fff389c8b3885607799;p=php move ext/cpdf to PECL --- diff --git a/NEWS b/NEWS index a203bb99b4..df5e8bc7c7 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ PHP NEWS . ext/dio (Jani, Derick) . ext/yp (Jani, Derick) . ext/w32api (Jani, Derick) + . ext/cpdf (Tony, Derick) - Changed stream_filter_(ap|pre)pend() to return resource. (Sara) - Changed mysqli_exception and sqlite_exception to use RuntimeException as base if SPL extension is present. (Georg, Marcus) diff --git a/ext/cpdf/CREDITS b/ext/cpdf/CREDITS deleted file mode 100644 index 94cc1de43c..0000000000 --- a/ext/cpdf/CREDITS +++ /dev/null @@ -1,2 +0,0 @@ -cpdf -Uwe Steinmann diff --git a/ext/cpdf/config.m4 b/ext/cpdf/config.m4 deleted file mode 100644 index 2ee5e601d5..0000000000 --- a/ext/cpdf/config.m4 +++ /dev/null @@ -1,84 +0,0 @@ -dnl $Id$ - -AC_DEFUN([CPDF_JPEG_TEST],[ - AC_ARG_WITH(jpeg-dir, - [ --with-jpeg-dir[=DIR] CPDF: Set the path to libjpeg install prefix.],[ - for i in $withval /usr/local /usr; do - if test -f "$i/$PHP_LIBDIR/libjpeg.$SHLIB_SUFFIX_NAME" -o -f "$i/$PHP_LIBDIR/libjpeg.a"; then - CPDF_JPEG_DIR=$i - break; - fi - done - if test -z "$CPDF_JPEG_DIR"; then - AC_MSG_ERROR([libjpeg.(a|so) not found.]) - fi - PHP_CHECK_LIBRARY(jpeg, jpeg_read_header, [ - PHP_ADD_LIBRARY_WITH_PATH(jpeg, $CPDF_JPEG_DIR/lib, CPDF_SHARED_LIBADD) - ] ,[ - AC_MSG_ERROR([CPDF: Problem with libjpeg.(a|so). Please check config.log for more information.]) - ], [ - -L$CPDF_JPEG_DIR/lib - ]) - ],) -]) - -AC_DEFUN([CPDF_TIFF_TEST],[ - AC_ARG_WITH(tiff-dir, - [ --with-tiff-dir[=DIR] CPDF: Set the path to libtiff install prefix.],[ - for i in $withval /usr/local /usr; do - if test -f "$i/$PHP_LIBDIR/libtiff.$SHLIB_SUFFIX_NAME" -o -f "$i/$PHP_LIBDIR/libtiff.a"; then - CPDF_TIFF_DIR=$i - break; - fi - done - if test -z "$CPDF_TIFF_DIR"; then - AC_MSG_ERROR([libtiff.(a|so) not found.]) - fi - PHP_CHECK_LIBRARY(tiff, TIFFOpen, [ - PHP_ADD_LIBRARY_WITH_PATH(tiff, $CPDF_TIFF_DIR/lib, CPDF_SHARED_LIBADD) - ] ,[ - AC_MSG_ERROR([CPDF: Problem with libtiff.(a|so). Please check config.log for more information.]) - ], [ - -L$CPDF_TIFF_DIR/lib - ]) - ],) -]) - -PHP_ARG_WITH(cpdflib, for cpdflib support, -[ --with-cpdflib[=DIR] Include cpdflib support (requires cpdflib >= 2).]) - -if test "$PHP_CPDFLIB" != "no"; then - PHP_NEW_EXTENSION(cpdf, cpdf.c, $ext_shared,, \\$(GDLIB_CFLAGS)) - PHP_SUBST(CPDF_SHARED_LIBADD) - CPDF_JPEG_TEST - CPDF_TIFF_TEST - - for i in $PHP_CPDFLIB /usr/local /usr; do - if test -f "$i/include/cpdflib.h"; then - CPDFLIB_INCLUDE=$i/include - - PHP_CHECK_LIBRARY(cpdf, cpdf_open, [ - cpdf_libname=cpdf - ], [ - PHP_CHECK_LIBRARY(cpdfm, cpdf_open, [ - cpdf_libname=cpdfm - ], [ - AC_MSG_ERROR([Cpdflib module requires cpdflib >= 2.]) - ], [ - -L$i/$PHP_LIBDIR $CPDF_SHARED_LIBADD - ]) - ], [ - -L$i/$PHP_LIBDIR $CPDF_SHARED_LIBADD - ]) - - PHP_ADD_LIBRARY_WITH_PATH($cpdf_libname, $i/$PHP_LIBDIR, CPDF_SHARED_LIBADD) - PHP_ADD_INCLUDE($CPDFLIB_INCLUDE) - AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib]) - break - fi - done - - if test -z "$CPDFLIB_INCLUDE"; then - AC_MSG_ERROR([cpdflib.h not found]) - fi -fi diff --git a/ext/cpdf/config.w32 b/ext/cpdf/config.w32 deleted file mode 100644 index 91724182b7..0000000000 --- a/ext/cpdf/config.w32 +++ /dev/null @@ -1,14 +0,0 @@ -// $Id$ -// vim:ft=javascript - -ARG_WITH("cpdflib", "cpdflib >= 2", "no"); - -if (PHP_CPDFLIB != "no") { - if (CHECK_LIB("cpdf.lib", "cpdf", PHP_CPDFLIB) && - CHECK_HEADER_ADD_INCLUDE("cpdflib.h", "CFLAGS_CPDF")) { - EXTENSION("cpdf", "cpdf.c", PHP_CPDFLIB_SHARED); - AC_DEFINE('HAVE_CPDFLIB', 1, 'Have CPDF library'); - } else { - WARNING("cpdf not enabled; libraries and headers not found"); - } -} diff --git a/ext/cpdf/cpdf.c b/ext/cpdf/cpdf.c deleted file mode 100644 index 594f1ca6f7..0000000000 --- a/ext/cpdf/cpdf.c +++ /dev/null @@ -1,2267 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Uwe Steinmann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ -/* cpdflib.h -- C language API definitions for ClibPDF library - * Copyright (C) 1998 FastIO Systems, All Rights Reserved. -*/ - -/* Note that there is no code from the cpdflib package in this file */ - -#if defined(THREAD_SAFE) -#undef THREAD_SAFE -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_globals.h" -#include "zend_list.h" -#include "ext/standard/php_standard.h" -#include "ext/standard/head.h" -#include -#if HAVE_GD_BUNDLED -# include "../gd/libgd/gd.h" -#else -# if HAVE_LIBGD13 -# include -# endif -#endif - -#include - -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef PHP_WIN32 -# include -# include -#endif - -#if HAVE_CPDFLIB -#include "php_cpdf.h" -#include "ext/standard/info.h" - -#ifdef THREAD_SAFE -DWORD CPDFlibTls; -static int numthreads=0; - -typedef struct cpdflib_global_struct{ - int le_cpdf; - int le_outline; -#if HAVE_LIBGD13 - int le_gd; -#endif -} cpdflib_global_struct; - -# define CPDF_GLOBAL(v) TSRMG(CPDFlibTls, cpdflib_global_struct *, v) - -#else -# define CPDF_GLOBAL(a) a -static int le_cpdf; -static int le_outline; -#if HAVE_LIBGD13 -static int le_gd; -#endif -#endif - -#define CPDF_FETCH_CPDFDOC(pdf_zval) \ - convert_to_long_ex(pdf_zval); \ - id = Z_LVAL_PP(pdf_zval); \ - pdf = zend_list_find(id, &type); \ - if(!pdf || type != CPDF_GLOBAL(le_cpdf)) { \ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find identifier %d", id); \ - RETURN_FALSE; \ - } \ - -function_entry cpdf_functions[] = { - PHP_FE(cpdf_global_set_document_limits, NULL) - PHP_FE(cpdf_set_creator, NULL) - PHP_FE(cpdf_set_title, NULL) - PHP_FE(cpdf_set_subject, NULL) - PHP_FE(cpdf_set_keywords, NULL) - PHP_FE(cpdf_open, NULL) - PHP_FE(cpdf_close, NULL) - PHP_FE(cpdf_set_viewer_preferences, NULL) - PHP_FE(cpdf_page_init, NULL) - PHP_FE(cpdf_finalize_page, NULL) - PHP_FE(cpdf_set_current_page, NULL) - PHP_FE(cpdf_begin_text, NULL) - PHP_FE(cpdf_end_text, NULL) - PHP_FE(cpdf_show, NULL) - PHP_FE(cpdf_show_xy, NULL) - PHP_FE(cpdf_text, NULL) - PHP_FE(cpdf_continue_text, NULL) - PHP_FE(cpdf_set_font, NULL) - PHP_FE(cpdf_set_font_directories, NULL) - PHP_FE(cpdf_set_font_map_file, NULL) - PHP_FE(cpdf_set_leading, NULL) - PHP_FE(cpdf_set_text_rendering, NULL) - PHP_FE(cpdf_set_horiz_scaling, NULL) - PHP_FE(cpdf_set_text_rise, NULL) - PHP_FE(cpdf_set_text_matrix, NULL) - PHP_FE(cpdf_set_text_pos, NULL) - PHP_FE(cpdf_rotate_text, NULL) - PHP_FE(cpdf_set_char_spacing, NULL) - PHP_FE(cpdf_set_word_spacing, NULL) - PHP_FE(cpdf_stringwidth, NULL) - PHP_FE(cpdf_save, NULL) - PHP_FE(cpdf_restore, NULL) - PHP_FE(cpdf_translate, NULL) - PHP_FE(cpdf_scale, NULL) - PHP_FE(cpdf_rotate, NULL) - PHP_FE(cpdf_setflat, NULL) - PHP_FE(cpdf_setlinejoin, NULL) - PHP_FE(cpdf_setlinecap, NULL) - PHP_FE(cpdf_setmiterlimit, NULL) - PHP_FE(cpdf_setlinewidth, NULL) - PHP_FE(cpdf_setdash, NULL) - PHP_FE(cpdf_moveto, NULL) - PHP_FE(cpdf_rmoveto, NULL) - PHP_FE(cpdf_lineto, NULL) - PHP_FE(cpdf_rlineto, NULL) - PHP_FE(cpdf_curveto, NULL) - PHP_FE(cpdf_circle, NULL) - PHP_FE(cpdf_arc, NULL) - PHP_FE(cpdf_rect, NULL) - PHP_FE(cpdf_newpath, NULL) - PHP_FE(cpdf_closepath, NULL) - PHP_FE(cpdf_stroke, NULL) - PHP_FE(cpdf_closepath_stroke, NULL) - PHP_FE(cpdf_fill, NULL) - PHP_FE(cpdf_fill_stroke, NULL) - PHP_FE(cpdf_closepath_fill_stroke, NULL) - PHP_FE(cpdf_clip, NULL) - PHP_FE(cpdf_setgray_fill, NULL) - PHP_FE(cpdf_setgray_stroke, NULL) - PHP_FE(cpdf_setgray, NULL) - PHP_FE(cpdf_setrgbcolor_fill, NULL) - PHP_FE(cpdf_setrgbcolor_stroke, NULL) - PHP_FE(cpdf_setrgbcolor, NULL) - PHP_FE(cpdf_set_page_animation, NULL) - PHP_FE(cpdf_finalize, NULL) - PHP_FE(cpdf_output_buffer, NULL) - PHP_FE(cpdf_save_to_file, NULL) - PHP_FE(cpdf_import_jpeg, NULL) -#if HAVE_LIBGD13 - PHP_FE(cpdf_place_inline_image, NULL) -#endif - PHP_FE(cpdf_add_annotation, NULL) - PHP_FE(cpdf_add_outline, NULL) - PHP_FE(cpdf_set_action_url, NULL) - {NULL, NULL, NULL} -}; - -zend_module_entry cpdf_module_entry = { - STANDARD_MODULE_HEADER, - "cpdf", - cpdf_functions, - PHP_MINIT(cpdf), - PHP_MSHUTDOWN(cpdf), - PHP_RINIT(cpdf), - NULL, - PHP_MINFO(cpdf), - NO_VERSION_YET, - STANDARD_MODULE_PROPERTIES -}; - -#ifdef COMPILE_DL_CPDF -ZEND_GET_MODULE(cpdf) -#endif - -static void _free_outline(zend_rsrc_list_entry *rsrc TSRMLS_DC) -{ -} - -static void _free_doc(zend_rsrc_list_entry *rsrc TSRMLS_DC) -{ - CPDFdoc *pdf = (CPDFdoc *)rsrc->ptr; - - cpdf_close(pdf); -} - -PHP_MINIT_FUNCTION(cpdf) -{ - CPDF_GLOBAL(le_outline) = zend_register_list_destructors_ex(_free_outline, NULL, "cpdf outline", module_number); - CPDF_GLOBAL(le_cpdf) = zend_register_list_destructors_ex(_free_doc, NULL, "cpdf", module_number); - - REGISTER_LONG_CONSTANT("CPDF_PM_NONE", PM_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CPDF_PM_OUTLINES", PM_OUTLINES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CPDF_PM_THUMBS", PM_THUMBS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CPDF_PM_FULLSCREEN", PM_FULLSCREEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CPDF_PL_SINGLE", PL_SINGLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CPDF_PL_1COLUMN", PL_1COLUMN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CPDF_PL_2LCOLUMN", PL_2LCOLUMN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CPDF_PL_2RCOLUMN", PL_2RCOLUMN, CONST_CS | CONST_PERSISTENT); - - - return SUCCESS; -} - -PHP_RINIT_FUNCTION(cpdf) -{ -/* CPDF_GLOBAL(le_outline) = NULL; */ - return SUCCESS; -} - -PHP_MINFO_FUNCTION(cpdf) { - /* need to use a PHPAPI function here because it is external module in windows */ - /* (don't knwo if that still applies (cmv) */ - php_info_print_table_start(); - php_info_print_table_row(2, "CPDF Support", "enabled"); - php_info_print_table_row(2, "Version", cpdf_version() ); - php_info_print_table_end(); -} - -PHP_MSHUTDOWN_FUNCTION(cpdf) -{ - return SUCCESS; -} - -/* {{{ proto bool cpdf_global_set_document_limits(int maxPages, int maxFonts, int maxImages, int maxAnnots, int maxObjects) - Sets document settings for all documents */ -PHP_FUNCTION(cpdf_global_set_document_limits) -{ - zval **argv[5]; - - if (ZEND_NUM_ARGS() != 5 || (zend_get_parameters_array_ex(5, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - convert_to_long_ex(argv[0]); - convert_to_long_ex(argv[1]); - convert_to_long_ex(argv[2]); - convert_to_long_ex(argv[3]); - convert_to_long_ex(argv[4]); - - cpdf_setGlobalDocumentLimits(Z_LVAL_PP(argv[0]), Z_LVAL_PP(argv[1]), Z_LVAL_PP(argv[2]), Z_LVAL_PP(argv[3]), Z_LVAL_PP(argv[4])); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_creator(int pdfdoc, string creator) - Sets the creator field */ -PHP_FUNCTION(cpdf_set_creator) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - - cpdf_setCreator(pdf, Z_STRVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_title(int pdfptr, string title) - Fills the title field of the info structure */ -PHP_FUNCTION(cpdf_set_title) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - - cpdf_setTitle(pdf, Z_STRVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_subject(int pdfptr, string subject) - Fills the subject field of the info structure */ -PHP_FUNCTION(cpdf_set_subject) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - - cpdf_setSubject(pdf, Z_STRVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_keywords(int pdfptr, string keywords) - Fills the keywords field of the info structure */ -PHP_FUNCTION(cpdf_set_keywords) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - - cpdf_setKeywords(pdf, Z_STRVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_viewer_preferences(int pdfdoc, array preferences) - How to show the document in the viewer */ -PHP_FUNCTION(cpdf_set_viewer_preferences) -{ - zval **arg1, **arg2; - zval **zvalue; - int id, type; - CPDFdoc *pdf; - CPDFviewerPrefs vP = { 0, 0, 0, 0, 0, 0, 0, 0 }; - - if(ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_array_ex(arg2); - - if (zend_hash_find (Z_ARRVAL_PP(arg2), "pagemode", sizeof ("pagemode"), (void **) &zvalue) == SUCCESS) { - convert_to_long_ex(zvalue); - vP.pageMode = Z_LVAL_PP(zvalue); - } - if (zend_hash_find (Z_ARRVAL_PP(arg2), "hidetoolbar", sizeof ("hidetoolbar"), (void **) &zvalue) == SUCCESS) { - convert_to_long_ex(zvalue); - vP.hideToolbar = Z_LVAL_PP(zvalue); - } - if (zend_hash_find (Z_ARRVAL_PP(arg2), "hidemenubar", sizeof ("hidemenubar"), (void **) &zvalue) == SUCCESS) { - convert_to_long_ex(zvalue); - vP.hideMenubar = Z_LVAL_PP(zvalue); - } - if (zend_hash_find (Z_ARRVAL_PP(arg2), "hidewindowui", sizeof ("hidewindowui"), (void **) &zvalue) == SUCCESS) { - convert_to_long_ex(zvalue); - vP.hideWindowUI = Z_LVAL_PP(zvalue); - } - if (zend_hash_find (Z_ARRVAL_PP(arg2), "fitwindow", sizeof ("fitwindow"), (void **) &zvalue) == SUCCESS) { - convert_to_long_ex(zvalue); - vP.fitWindow = Z_LVAL_PP(zvalue); - } - if (zend_hash_find (Z_ARRVAL_PP(arg2), "centerwindow", sizeof ("centerwindow"), (void **) &zvalue) == SUCCESS) { - convert_to_long_ex(zvalue); - vP.centerWindow = Z_LVAL_PP(zvalue); - } - if (zend_hash_find (Z_ARRVAL_PP(arg2), "pagelayout", sizeof ("pagelayout"), (void **) &zvalue) == SUCCESS) { - convert_to_long_ex(zvalue); - vP.pageLayout = Z_LVAL_PP(zvalue); - } - if (zend_hash_find (Z_ARRVAL_PP(arg2), "nonfspagemode", sizeof ("nonfspagemode"), (void **) &zvalue) == SUCCESS) { - convert_to_long_ex(zvalue); - vP.nonFSPageMode = Z_LVAL_PP(zvalue); - } - - cpdf_setViewerPreferences(pdf, &vP); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int cpdf_open(int compression [, string filename [, array doc_limits]]) - Opens a new pdf document */ -PHP_FUNCTION(cpdf_open) -{ - zval **arg1, **arg2 = NULL, **arg3 = NULL; - int id; - CPDFdoc *cpdf; - - if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 3 || (zend_get_parameters_ex(ZEND_NUM_ARGS(), &arg1, &arg2, &arg3) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - convert_to_long_ex(arg1); - - cpdf = cpdf_open(0, NULL); - if(!cpdf) - RETURN_FALSE; - if(Z_LVAL_PP(arg1) == 1) - cpdf_enableCompression(cpdf, YES); - else - cpdf_enableCompression(cpdf, NO); - - if(arg2) { - convert_to_string_ex(arg2); -#if APACHE - if(strcmp(Z_STRVAL_PP(arg2), "-") == 0) - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Write to a memory stream and use cpdf_output_buffer() instead."); -#endif - - if (php_check_open_basedir(Z_STRVAL_PP(arg2) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(arg2), "rb+", CHECKUID_CHECK_MODE_PARAM))) { - cpdf_close(cpdf); - RETURN_FALSE; - } - - cpdf_setOutputFilename(cpdf, Z_STRVAL_PP(arg2)); - } - cpdf_init(cpdf); - - id = zend_list_insert(cpdf, CPDF_GLOBAL(le_cpdf)); - RETURN_LONG(id); -} -/* }}} */ - -/* {{{ proto bool cpdf_close(int pdfdoc) - Closes the pdf document */ -PHP_FUNCTION(cpdf_close) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - zend_list_delete(id); - - RETURN_TRUE; -} -/* }}} */ - -#define BUFFERLEN 40 -/* {{{ proto bool cpdf_page_init(int pdfdoc, int pagenr, int orientation, int height, int width [, float unit]) - Starts page */ -PHP_FUNCTION(cpdf_page_init) -{ - zval **argv[6]; - int id, type, pagenr, orientation; - int height, width; - char buffer[BUFFERLEN]; - CPDFdoc *pdf; - int argc = ZEND_NUM_ARGS(); - - if(argc < 5 || argc > 6 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_long_ex(argv[1]); - convert_to_long_ex(argv[2]); - convert_to_long_ex(argv[3]); - convert_to_long_ex(argv[4]); - pagenr=Z_LVAL_PP(argv[1]); - orientation=Z_LVAL_PP(argv[2]); - height = Z_LVAL_PP(argv[3]); - width = Z_LVAL_PP(argv[4]); - - if(argc > 5) { - convert_to_double_ex(argv[5]); - if(Z_DVAL_PP(argv[5]) > 0.0) - cpdf_setDefaultDomainUnit(pdf, Z_DVAL_PP(argv[5])); - } - snprintf(buffer, BUFFERLEN, "0 0 %d %d", width, height); - cpdf_pageInit(pdf, pagenr, orientation, buffer, buffer); - - RETURN_TRUE; -} -/* }}} */ -#undef BUFFERLEN - -/* {{{ proto bool cpdf_finalize_page(int pdfdoc, int pagenr) - Ends the page to save memory */ -PHP_FUNCTION(cpdf_finalize_page) -{ - zval **arg1, **arg2; - int id, type, pagenr; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_long_ex(arg2); - pagenr=Z_LVAL_PP(arg2); - - cpdf_finalizePage(pdf, pagenr); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_current_page(int pdfdoc, int pagenr) - Sets page for output */ -PHP_FUNCTION(cpdf_set_current_page) -{ - zval **arg1, **arg2; - int id, type, pagenr; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_long_ex(arg2); - pagenr=Z_LVAL_PP(arg2); - - cpdf_setCurrentPage(pdf, pagenr); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_begin_text(int pdfdoc) - Starts text section */ -PHP_FUNCTION(cpdf_begin_text) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_beginText(pdf, 0); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_end_text(int pdfdoc) - Ends text section */ -PHP_FUNCTION(cpdf_end_text) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_endText(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_show(int pdfdoc, string text) - Output text at current position */ -PHP_FUNCTION(cpdf_show) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - - cpdf_textShow(pdf, Z_STRVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_show_xy(int pdfdoc, string text, float x-koor, float y-koor [, int mode]) - Output text at position */ -PHP_FUNCTION(cpdf_show_xy) -{ - zval **argv[5]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - - argc = ZEND_NUM_ARGS(); - if(argc < 4 || argc > 5 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_string_ex(argv[1]); - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - - if(argc == 5) { - convert_to_long_ex(argv[4]); - mode = Z_LVAL_PP(argv[4]); - } - if(mode == 1) - cpdf_rawText(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), 0.0, Z_STRVAL_PP(argv[1])); - else - cpdf_text(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), 0.0, Z_STRVAL_PP(argv[1])); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_continue_text(int pdfdoc, string text) - Outputs text in next line */ -PHP_FUNCTION(cpdf_continue_text) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - - cpdf_textCRLFshow(pdf, Z_STRVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_text(int pdfdoc, string text [, float x-koor, float y-koor [, int mode [, float orientation [, int alignmode]]]]) - Outputs text */ -PHP_FUNCTION(cpdf_text) -{ - zval **argv[7]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - - if(argc < 2 || argc == 3 || argc > 7 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_string_ex(argv[1]); - - if(argc > 4) { - convert_to_long_ex(argv[4]); - mode = Z_LVAL_PP(argv[2]); - } - switch(argc) { - case 2: - cpdf_textShow(pdf, Z_STRVAL_PP(argv[1])); - break; - case 4: - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - cpdf_text(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), 0.0, Z_STRVAL_PP(argv[1])); - break; - case 5: - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - if(mode == 1) - cpdf_rawText(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), 0.0, Z_STRVAL_PP(argv[1])); - else - cpdf_text(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), 0.0, Z_STRVAL_PP(argv[1])); - break; - case 6: - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - convert_to_double_ex(argv[5]); - if(mode == 1) - cpdf_rawText(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[5]), Z_STRVAL_PP(argv[1])); - else - cpdf_text(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[5]), Z_STRVAL_PP(argv[1])); - break; - case 7: - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - convert_to_double_ex(argv[5]); - convert_to_long_ex(argv[6]); - if(mode == 1) - cpdf_rawTextAligned(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[5]), Z_LVAL_PP(argv[6]), Z_STRVAL_PP(argv[1])); - else - cpdf_textAligned(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[5]), Z_LVAL_PP(argv[6]), Z_STRVAL_PP(argv[1])); - break; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_font(int pdfdoc, string font, float size, string encoding) - Selects the current font face, size and encoding */ -PHP_FUNCTION(cpdf_set_font) -{ - zval **arg1, **arg2, **arg3, **arg4; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - convert_to_double_ex(arg3); - convert_to_string_ex(arg4); - -/* if(Z_LVAL_PP(arg4) > 6) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Font encoding set to 5"); - Z_LVAL_PP(arg4) = 5; - } -*/ - cpdf_setFont(pdf, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg4), (float) Z_DVAL_PP(arg3)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_font_directories(int pdfdoc, string pfmdir, string pfbdir) - Sets directories to search when using external fonts */ -PHP_FUNCTION(cpdf_set_font_directories) -{ - zval **arg1, **arg2, **arg3; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - convert_to_string_ex(arg3); - - cpdf_setFontDirectories(pdf, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_font_map_file(int pdfdoc, string filename) - Sets fontname to filename translation map when using external fonts */ -PHP_FUNCTION(cpdf_set_font_map_file) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - - if (php_check_open_basedir(Z_STRVAL_PP(arg2) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(arg2), "rb+", CHECKUID_CHECK_MODE_PARAM))) { - RETURN_FALSE; - } - - cpdf_setFontMapFile(pdf, Z_STRVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_leading(int pdfdoc, float distance) - Sets distance between text lines */ -PHP_FUNCTION(cpdf_set_leading) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_setTextLeading(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_text_rendering(int pdfdoc, int rendermode) - Determines how text is rendered */ -PHP_FUNCTION(cpdf_set_text_rendering) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_long_ex(arg2); - - cpdf_setTextRenderingMode(pdf, Z_LVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_horiz_scaling(int pdfdoc, float scale) - Sets horizontal scaling of text */ -PHP_FUNCTION(cpdf_set_horiz_scaling) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_setHorizontalScaling(pdf, (float) Z_DVAL_PP(arg2) * 100.0); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_text_rise(int pdfdoc, float value) - Sets the text rise */ -PHP_FUNCTION(cpdf_set_text_rise) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_setTextRise(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_text_matrix(int pdfdoc, arry matrix) - Sets the text matrix */ -PHP_FUNCTION(cpdf_set_text_matrix) -{ - zval **arg1, **arg2, *data; - int id, type, i; - HashTable *matrix; - CPDFdoc *pdf; - float *pdfmatrixptr; - float pdfmatrix[6]; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_array_ex(arg2); - matrix = Z_ARRVAL_PP(arg2); - - if(zend_hash_num_elements(matrix) != 6) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Text matrix must have 6 elements"); - RETURN_FALSE; - } - - pdfmatrixptr = pdfmatrix; - zend_hash_internal_pointer_reset(matrix); - for(i=0; i 4 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - - if(argc > 3) { - convert_to_long_ex(argv[3]); - mode = Z_LVAL_PP(argv[3]); - } - if(mode == 1) - cpdf_rawSetTextPosition(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2])); - else - cpdf_setTextPosition(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2])); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_rotate_text(int pdfdoc, float angle) - Sets text rotation angle */ -PHP_FUNCTION(cpdf_rotate_text) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_rotateText(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_char_spacing(int pdfdoc, float space) - Sets character spacing */ -PHP_FUNCTION(cpdf_set_char_spacing) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_setCharacterSpacing(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_word_spacing(int pdfdoc, float space) - Sets spacing between words */ -PHP_FUNCTION(cpdf_set_word_spacing) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_setWordSpacing(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto float cpdf_stringwidth(int pdfdoc, string text) - Returns width of text in current font */ -PHP_FUNCTION(cpdf_stringwidth) -{ - zval **arg1, **arg2; - int id, type; - double width; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - - width = (double) cpdf_stringWidth(pdf, Z_STRVAL_PP(arg2)); - - RETURN_DOUBLE((double)width); -} -/* }}} */ - -/* {{{ proto bool cpdf_save(int pdfdoc) - Saves current enviroment */ -PHP_FUNCTION(cpdf_save) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_gsave(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_restore(int pdfdoc) - Restores formerly saved enviroment */ -PHP_FUNCTION(cpdf_restore) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_grestore(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_translate(int pdfdoc, float x, float y) - Sets origin of coordinate system */ -PHP_FUNCTION(cpdf_translate) -{ - zval **arg1, **arg2, **arg3; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - convert_to_double_ex(arg3); - - cpdf_rawTranslate(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_scale(int pdfdoc, float x_scale, float y_scale) - Sets scaling */ -PHP_FUNCTION(cpdf_scale) -{ - zval **arg1, **arg2, **arg3; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - convert_to_double_ex(arg3); - - cpdf_scale(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_rotate(int pdfdoc, float angle) - Sets rotation */ -PHP_FUNCTION(cpdf_rotate) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_rotate(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setflat(int pdfdoc, float value) - Sets flatness */ -PHP_FUNCTION(cpdf_setflat) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - if((Z_LVAL_PP(arg2) > 100) && (Z_LVAL_PP(arg2) < 0)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter has to between 0 and 100"); - RETURN_FALSE; - } - - cpdf_setflat(pdf, (int) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setlinejoin(int pdfdoc, int value) - Sets linejoin parameter */ -PHP_FUNCTION(cpdf_setlinejoin) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_long_ex(arg2); - - if((Z_LVAL_PP(arg2) > 2) && (Z_LVAL_PP(arg2) < 0)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter has to between 0 and 2"); - RETURN_FALSE; - } - - cpdf_setlinejoin(pdf, Z_LVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setlinecap(int pdfdoc, int value) - Sets linecap parameter */ -PHP_FUNCTION(cpdf_setlinecap) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_long_ex(arg2); - - if((Z_LVAL_PP(arg2) > 2) && (Z_LVAL_PP(arg2) < 0)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter has to be > 0 and =< 2"); - RETURN_FALSE; - } - - cpdf_setlinecap(pdf, Z_LVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setmiterlimit(int pdfdoc, float value) - Sets miter limit */ -PHP_FUNCTION(cpdf_setmiterlimit) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - if(Z_DVAL_PP(arg2) < 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter has to be >= 1"); - RETURN_FALSE; - } - - cpdf_setmiterlimit(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setlinewidth(int pdfdoc, float width) - Sets line width */ -PHP_FUNCTION(cpdf_setlinewidth) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_setlinewidth(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -#define BUFFERLEN 20 -/* {{{ proto bool cpdf_setdash(int pdfdoc, long white, long black) - Sets dash pattern */ -PHP_FUNCTION(cpdf_setdash) -{ - zval **arg1, **arg2, **arg3; - int id, type; - char buffer[BUFFERLEN]; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_long_ex(arg2); - convert_to_long_ex(arg3); - - if (!pdf->currentMemStream) { - RETURN_FALSE; - } - - snprintf(buffer, BUFFERLEN, "[%d %d] 0", (int) Z_LVAL_PP(arg2), (int) Z_LVAL_PP(arg3)); - cpdf_setdash(pdf, buffer); - - RETURN_TRUE; -} -/* }}} */ -#undef BUFFERLEN - -/* {{{ proto bool cpdf_moveto(int pdfdoc, float x, float y [, int mode]) - Sets current point */ -PHP_FUNCTION(cpdf_moveto) -{ - zval **argv[4]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - - if(argc < 3 || argc > 4 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - - if(argc > 3) { - convert_to_long_ex(argv[3]); - mode = Z_LVAL_PP(argv[3]); - } - if(mode == 1) - cpdf_rawMoveto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2])); - else - cpdf_moveto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2])); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_rmoveto(int pdfdoc, float x, float y [, int mode]) - Sets current point */ -PHP_FUNCTION(cpdf_rmoveto) -{ - zval **argv[4]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - - if(argc < 3 || argc > 4 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - - if(argc > 3) { - convert_to_long_ex(argv[3]); - mode = Z_LVAL_PP(argv[3]); - } - if(mode == 1) - cpdf_rawRmoveto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2])); - else - cpdf_rmoveto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2])); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_curveto(int pdfdoc, float x1, float y1, float x2, float y2, float x3, float y3 [, int mode]) - Draws a curve */ -PHP_FUNCTION(cpdf_curveto) -{ - zval **argv[8]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - - if(argc < 7 || argc > 8 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - convert_to_double_ex(argv[4]); - convert_to_double_ex(argv[5]); - convert_to_double_ex(argv[6]); - - if(argc > 7) { - convert_to_long_ex(argv[7]); - mode = Z_LVAL_PP(argv[7]); - } - if(mode == 1) - cpdf_rawCurveto(pdf, (float) Z_DVAL_PP(argv[1]), - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4]), - (float) Z_DVAL_PP(argv[5]), - (float) Z_DVAL_PP(argv[6])); - else - cpdf_curveto(pdf, (float) Z_DVAL_PP(argv[1]), - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4]), - (float) Z_DVAL_PP(argv[5]), - (float) Z_DVAL_PP(argv[6])); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_lineto(int pdfdoc, float x, float y [, int mode]) - Draws a line */ -PHP_FUNCTION(cpdf_lineto) -{ - zval **argv[4]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - - if(argc < 3 || argc > 4 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - - if(argc > 3) { - convert_to_long_ex(argv[3]); - mode = Z_LVAL_PP(argv[3]); - } - if(mode == 1) - cpdf_rawLineto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2])); - else - cpdf_lineto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2])); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_rlineto(int pdfdoc, float x, float y [, int mode]) - Draws a line relative to current point */ -PHP_FUNCTION(cpdf_rlineto) -{ - zval **argv[4]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - - if(argc < 3 || argc > 4 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - - if(argc > 3) { - convert_to_long_ex(argv[3]); - mode = Z_LVAL_PP(argv[3]); - } - if(mode == 1) - cpdf_rawRlineto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2])); - else - cpdf_rlineto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2])); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_circle(int pdfdoc, float x, float y, float radius [, int mode]) - Draws a circle */ -PHP_FUNCTION(cpdf_circle) -{ - zval **argv[5]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - - if(argc < 4 || argc > 5 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - - if(argc > 4) { - convert_to_long_ex(argv[4]); - mode = Z_LVAL_PP(argv[4]); - } - if(mode == 1) - cpdf_rawCircle(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3])); - else - cpdf_circle(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3])); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_arc(int pdfdoc, float x, float y, float radius, float start, float end [, int mode]) - Draws an arc */ -PHP_FUNCTION(cpdf_arc) -{ - zval **argv[7]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - - if(argc < 6 || argc > 7 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - convert_to_double_ex(argv[4]); - convert_to_double_ex(argv[5]); - - if(argc > 6) { - convert_to_long_ex(argv[6]); - mode = Z_LVAL_PP(argv[6]); - } - if(mode == 1) - cpdf_rawArc(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[4]), (float) Z_DVAL_PP(argv[5]), 1); - else - cpdf_arc(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[4]), (float) Z_DVAL_PP(argv[5]), 1); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_rect(int pdfdoc, float x, float y, float width, float height [, int mode]) - Draws a rectangle */ -PHP_FUNCTION(cpdf_rect) -{ - zval **argv[6]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - - if(argc < 5 || argc > 6 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - convert_to_double_ex(argv[4]); - - if(argc > 5) { - convert_to_long_ex(argv[5]); - mode = Z_LVAL_PP(argv[5]); - } - if(mode == 1) - cpdf_rawRect(pdf, (float) Z_DVAL_PP(argv[1]), - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4])); - else - cpdf_rect(pdf, (float) Z_DVAL_PP(argv[1]), - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4])); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_newpath(int pdfdoc) - Starts new path */ -PHP_FUNCTION(cpdf_newpath) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_newpath(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_closepath(int pdfdoc) - Close path */ -PHP_FUNCTION(cpdf_closepath) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_closepath(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_closepath_stroke(int pdfdoc) - Close path and draw line along path */ -PHP_FUNCTION(cpdf_closepath_stroke) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_closepath(pdf); - cpdf_stroke(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_stroke(int pdfdoc) - Draws line along path path */ -PHP_FUNCTION(cpdf_stroke) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_stroke(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_fill(int pdfdoc) - Fills current path */ -PHP_FUNCTION(cpdf_fill) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_fill(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_fill_stroke(int pdfdoc) - Fills and stroke current path */ -PHP_FUNCTION(cpdf_fill_stroke) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_fill(pdf); - cpdf_stroke(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_closepath_fill_stroke(int pdfdoc) - Close, fill and stroke current path */ -PHP_FUNCTION(cpdf_closepath_fill_stroke) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_closepath(pdf); - cpdf_fill(pdf); - cpdf_stroke(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_clip(int pdfdoc) - Clips to current path */ -PHP_FUNCTION(cpdf_clip) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_clip(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setgray_fill(int pdfdoc, float value) - Sets filling color to gray value */ -PHP_FUNCTION(cpdf_setgray_fill) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_setgrayFill(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setgray_stroke(int pdfdoc, float value) - Sets drawing color to gray value */ -PHP_FUNCTION(cpdf_setgray_stroke) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_setgrayStroke(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setgray(int pdfdoc, float value) - Sets drawing and filling color to gray value */ -PHP_FUNCTION(cpdf_setgray) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - - cpdf_setgray(pdf, (float) Z_DVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setrgbcolor_fill(int pdfdoc, float red, float green, float blue) - Sets filling color to rgb color value */ -PHP_FUNCTION(cpdf_setrgbcolor_fill) -{ - zval **arg1, **arg2, **arg3, **arg4; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - convert_to_double_ex(arg3); - convert_to_double_ex(arg4); - - cpdf_setrgbcolorFill(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setrgbcolor_stroke(int pdfdoc, float red, float green, float blue) - Sets drawing color to RGB color value */ -PHP_FUNCTION(cpdf_setrgbcolor_stroke) -{ - zval **arg1, **arg2, **arg3, **arg4; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - convert_to_double_ex(arg3); - convert_to_double_ex(arg4); - - cpdf_setrgbcolorStroke(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_setrgbcolor(int pdfdoc, float red, float green, float blue) - Sets drawing and filling color to RGB color value */ -PHP_FUNCTION(cpdf_setrgbcolor) -{ - zval **arg1, **arg2, **arg3, **arg4; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_double_ex(arg2); - convert_to_double_ex(arg3); - convert_to_double_ex(arg4); - - cpdf_setrgbcolor(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_page_animation(int pdfdoc, int transition, float duration, float direction, int orientation, int inout) - Sets transition between pages */ -PHP_FUNCTION(cpdf_set_page_animation) -{ - zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_long_ex(arg2); - convert_to_double_ex(arg3); - convert_to_double_ex(arg4); - convert_to_long_ex(arg5); - convert_to_long_ex(arg6); - - cpdf_setPageTransition(pdf, Z_LVAL_PP(arg2), Z_DVAL_PP(arg3), Z_DVAL_PP(arg4), - Z_LVAL_PP(arg5), Z_LVAL_PP(arg6)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_finalize(int pdfdoc) - Creates PDF doc in memory */ -PHP_FUNCTION(cpdf_finalize) -{ - zval **arg1; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - cpdf_finalizeAll(pdf); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_output_buffer(int pdfdoc) - Returns the internal memory stream as string */ -PHP_FUNCTION(cpdf_output_buffer) -{ - zval **arg1; - int id, type, lenght; - CPDFdoc *pdf; - char *buffer; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - - buffer = cpdf_getBufferForPDF(pdf, &lenght); - - php_write(buffer, lenght TSRMLS_CC); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_save_to_file(int pdfdoc, string filename) - Saves the internal memory stream to a file */ -PHP_FUNCTION(cpdf_save_to_file) -{ - zval **arg1, **arg2; - int id, type; - CPDFdoc *pdf; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(arg1); - convert_to_string_ex(arg2); - -#if APACHE - if(strcmp(Z_STRVAL_PP(arg2), "-") == 0) - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Use cpdf_output_buffer() instead."); -#endif - - if (php_check_open_basedir(Z_STRVAL_PP(arg2) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(arg2), "wb+", CHECKUID_CHECK_MODE_PARAM))) { - RETURN_FALSE; - } - - cpdf_savePDFmemoryStreamToFile(pdf, Z_STRVAL_PP(arg2)); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_import_jpeg(int pdfdoc, string filename, float x, float y, float angle, float width, float height, float x_scale, float y_scale, int gsave [, int mode]) - Includes JPEG image */ -PHP_FUNCTION(cpdf_import_jpeg) -{ - zval **argv[11]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - float width, height, xscale, yscale; - CPDFdoc *pdf; - - if(argc < 10 || argc > 11 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_string_ex(argv[1]); - - if (php_check_open_basedir(Z_STRVAL_PP(argv[1]) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(argv[1]), "rb+", CHECKUID_CHECK_MODE_PARAM))) { - RETURN_FALSE; - } - - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - convert_to_double_ex(argv[4]); - convert_to_double_ex(argv[5]); - width = (float) Z_DVAL_PP(argv[5]); - convert_to_double_ex(argv[6]); - height = (float) Z_DVAL_PP(argv[6]); - convert_to_double_ex(argv[7]); - xscale = (float) Z_DVAL_PP(argv[7]); - convert_to_double_ex(argv[8]); - yscale = (float) Z_DVAL_PP(argv[8]); - convert_to_long_ex(argv[9]); - - if(argc > 10) { - convert_to_long_ex(argv[10]); - mode = Z_LVAL_PP(argv[10]); - } - if(mode == 1) - cpdf_rawImportImage(pdf, Z_STRVAL_PP(argv[1]), - JPEG_IMG, - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4]), - &width, - &height, - &xscale, - &yscale, - Z_LVAL_PP(argv[9])); - else - cpdf_rawImportImage(pdf, Z_STRVAL_PP(argv[1]), - JPEG_IMG, - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4]), - &width, - &height, - &xscale, - &yscale, - Z_LVAL_PP(argv[9])); - - RETURN_TRUE; -} -/* }}} */ - -#if HAVE_LIBGD13 -/* {{{ proto bool cpdf_place_inline_image(int pdfdoc, int gdimage, float x, float y, float angle, fload width, float height, int gsave [, int mode]) - Includes image */ -PHP_FUNCTION(cpdf_place_inline_image) -{ - zval **argv[11]; - int id, gid, type, mode = 0, argc = ZEND_NUM_ARGS(); - int count, i, j, color; - CPDFdoc *pdf; - unsigned char *buffer, *ptr; - gdImagePtr im; - - if(argc < 8 || argc > 9 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_long_ex(argv[1]); - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - convert_to_double_ex(argv[4]); - convert_to_double_ex(argv[5]); - convert_to_double_ex(argv[6]); - convert_to_long_ex(argv[7]); - - gid=Z_LVAL_PP(argv[1]); - im = zend_list_find(gid, &type); - - ZEND_GET_RESOURCE_TYPE_ID(CPDF_GLOBAL(le_gd), "gd"); - if(!CPDF_GLOBAL(le_gd)) - { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to find handle for GD image stream. Please check the GD extension is loaded."); - } - - if (!im || type != CPDF_GLOBAL(le_gd)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - if(argc > 8) { - convert_to_long_ex(argv[8]); - mode = Z_LVAL_PP(argv[8]); - } - - count = 3 * im->sx * im->sy; - buffer = (unsigned char *) safe_emalloc(3 * im->sx, im->sy, 0); - - ptr = buffer; - for(i=0; isy; i++) { - for(j=0; jsx; j++) { -#if HAVE_LIBGD20 - if(gdImageTrueColor(im)) { - if (im->tpixels && gdImageBoundsSafe(im, j, i)) { - color = gdImageTrueColorPixel(im, j, i); - *ptr++ = (color >> 16) & 0xFF; - *ptr++ = (color >> 8) & 0xFF; - *ptr++ = color & 0xFF; - } - } else { -#endif - if (im->pixels && gdImageBoundsSafe(im, j, i)) { - color = im->pixels[i][j]; - *ptr++ = im->red[color]; - *ptr++ = im->green[color]; - *ptr++ = im->blue[color]; - } -#if HAVE_LIBGD20 - } -#endif - } - } - - if(mode == 1) - cpdf_placeInLineImage(pdf, buffer, count, - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4]), - (float) Z_DVAL_PP(argv[5]), - (float) Z_DVAL_PP(argv[6]), - im->sx, - im->sy, - 8, 2, Z_LVAL_PP(argv[7])); - else - cpdf_rawPlaceInLineImage(pdf, buffer, count, - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4]), - (float) Z_DVAL_PP(argv[5]), - (float) Z_DVAL_PP(argv[6]), - im->sx, - im->sy, - 8, 2, Z_LVAL_PP(argv[7])); - - efree(buffer); - RETURN_TRUE; -} -/* }}} */ -#endif - -/* {{{ proto bool cpdf_add_annotation(int pdfdoc, float xll, float yll, float xur, float xur, string title, string text [, int mode]) - Sets annotation */ -PHP_FUNCTION(cpdf_add_annotation) -{ - zval **argv[11]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - CPDFannotAttrib attrib; - - if(argc < 7 || argc > 8 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - convert_to_double_ex(argv[4]); - convert_to_string_ex(argv[5]); - convert_to_string_ex(argv[6]); - - attrib.flags = AF_NOZOOM | AF_NOROTATE | AF_READONLY; - attrib.border_array = "[0 0 1 [4 2]]"; - attrib.BS = NULL; - attrib.r = 0.00; - attrib.g = 1.00; - attrib.b = 1.00; - if(argc > 7) { - convert_to_long_ex(argv[7]); - mode = Z_LVAL_PP(argv[7]); - } - if(mode == 1) - cpdf_rawSetAnnotation(pdf, (float) Z_DVAL_PP(argv[1]), - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4]), - Z_STRVAL_PP(argv[5]), - Z_STRVAL_PP(argv[6]), - &attrib); - else - cpdf_setAnnotation(pdf, (float) Z_DVAL_PP(argv[1]), - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4]), - Z_STRVAL_PP(argv[5]), - Z_STRVAL_PP(argv[6]), - &attrib); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool cpdf_set_action_url(int pdfdoc, float xll, float yll, float xur, float xur, string url [, int mode]) - Sets hyperlink */ -PHP_FUNCTION(cpdf_set_action_url) -{ - zval **argv[11]; - int id, type, mode = 0, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - CPDFannotAttrib attrib; - - if(argc < 6 || argc > 7 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_double_ex(argv[1]); - convert_to_double_ex(argv[2]); - convert_to_double_ex(argv[3]); - convert_to_double_ex(argv[4]); - convert_to_string_ex(argv[5]); - - attrib.flags = AF_NOZOOM | AF_NOROTATE | AF_READONLY; - attrib.border_array = "[0 0 1 [4 0]]"; - attrib.BS = NULL; - attrib.r = 0.00; - attrib.g = 0.00; - attrib.b = 1.00; - if(argc > 6) { - convert_to_long_ex(argv[6]); - mode = Z_LVAL_PP(argv[6]); - } - if(mode == 1) - cpdf_rawSetActionURL(pdf, (float) Z_DVAL_PP(argv[1]), - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4]), - Z_STRVAL_PP(argv[5]), - &attrib); - else - cpdf_setActionURL(pdf, (float) Z_DVAL_PP(argv[1]), - (float) Z_DVAL_PP(argv[2]), - (float) Z_DVAL_PP(argv[3]), - (float) Z_DVAL_PP(argv[4]), - Z_STRVAL_PP(argv[5]), - &attrib); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int cpdf_add_outline(int pdfdoc, int lastoutline, int sublevel, int open, int pagenr, string title) - Adds outline */ -PHP_FUNCTION(cpdf_add_outline) -{ - zval **argv[11]; - int id, oid, type, argc = ZEND_NUM_ARGS(); - CPDFdoc *pdf; - CPDFoutlineEntry *lastoutline; - - if(argc != 6 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) { - WRONG_PARAM_COUNT; - } - - CPDF_FETCH_CPDFDOC(argv[0]); - convert_to_long_ex(argv[1]); - convert_to_long_ex(argv[2]); - convert_to_long_ex(argv[3]); - convert_to_long_ex(argv[4]); - convert_to_string_ex(argv[5]); - - oid=Z_LVAL_PP(argv[1]); - lastoutline = zend_list_find(oid, &type); - if(!lastoutline || type!=CPDF_GLOBAL(le_outline)) { - lastoutline = NULL; -/* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find last outline entry %d", id); - RETURN_FALSE; */ - } - - lastoutline = cpdf_addOutlineEntry(pdf, lastoutline, - Z_LVAL_PP(argv[2]), - Z_LVAL_PP(argv[3]), - Z_LVAL_PP(argv[4]), - Z_STRVAL_PP(argv[5]), - 1, 0.0, 0.0, 0.0, 0.0); - - id = zend_list_insert(lastoutline, CPDF_GLOBAL(le_outline)); - RETURN_LONG(id); -} -/* }}} */ - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ext/cpdf/cpdf.dsp b/ext/cpdf/cpdf.dsp deleted file mode 100644 index 6b952944eb..0000000000 --- a/ext/cpdf/cpdf.dsp +++ /dev/null @@ -1,111 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cpdf" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=cpdf - Win32 Release_TS -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "cpdf.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cpdf.mak" CFG="cpdf - Win32 Release_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cpdf - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cpdf - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cpdf - Win32 Release_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release_TS" -# PROP BASE Intermediate_Dir "Release_TS" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_TS" -# PROP Intermediate_Dir "Release_TS" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CPDF" /D ZTS=1 /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\bindlib_w32" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPDF_EXPORTS" /D "COMPILE_DL_CPDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CPDFLIB=1 /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x406 /d "NDEBUG" -# ADD RSC /l 0x406 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib cpdfi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 -# ADD LINK32 php5ts.lib cpdf.lib user32.lib winspool.lib kernel32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_cpdf.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cpdf - Win32 Debug_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Debug_TS" -# PROP BASE Intermediate_Dir "Debug_TS" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Debug_TS" -# PROP Intermediate_Dir "Debug_TS" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CPDF" /D ZTS=1 /D MSSQL70=1 /YX /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\bindlib_w32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPDF_EXPORTS" /D "COMPILE_DL_CPDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CPDFLIB=1 /FR /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x406 /d "NDEBUG" -# ADD RSC /l 0x406 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib cpdfi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 -# ADD LINK32 cpdf.lib php5ts_debug.lib user32.lib winspool.lib kernel32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_cpdf.dll" /libpath:"..\..\Debug_TS" -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "cpdf - Win32 Release_TS" -# Name "cpdf - Win32 Debug_TS" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\cpdf.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\php_cpdf.h -# End Source File -# End Group -# End Target -# End Project diff --git a/ext/cpdf/package.xml b/ext/cpdf/package.xml deleted file mode 100644 index c3a572db82..0000000000 --- a/ext/cpdf/package.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - cpdf - Clib PDF functions - - - steinm - Uwe Steinmann - steinm@php.net - lead - - - -ClibPDF lets you create PDF documents with PHP. -ClibPDF functionality and API are similar to PDFlib. - - PHP - - beta - 5.0rc1 - 2004-03-19 - -package.xml added to support intallation using pear installer - - - - - - - - - - - - - - - - - - diff --git a/ext/cpdf/php_cpdf.h b/ext/cpdf/php_cpdf.h deleted file mode 100644 index e0c6394fd4..0000000000 --- a/ext/cpdf/php_cpdf.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Uwe Steinmann | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#ifndef PHP_CPDF_H -#define PHP_CPDF_H - -#if HAVE_CPDFLIB - -/* The macro T is defined in the IMAP headers and clashes with a function - declaration here. Get rid of it. */ - -#ifdef T -#undef T -#endif - -extern zend_module_entry cpdf_module_entry; -#define cpdf_module_ptr &cpdf_module_entry - -PHP_MINFO_FUNCTION(cpdf); -PHP_MINIT_FUNCTION(cpdf); -PHP_RINIT_FUNCTION(cpdf); -PHP_MSHUTDOWN_FUNCTION(cpdf); -PHP_FUNCTION(cpdf_global_set_document_limits); -PHP_FUNCTION(cpdf_set_creator); -PHP_FUNCTION(cpdf_set_title); -PHP_FUNCTION(cpdf_set_subject); -PHP_FUNCTION(cpdf_set_keywords); -PHP_FUNCTION(cpdf_set_viewer_preferences); -PHP_FUNCTION(cpdf_open); -PHP_FUNCTION(cpdf_close); -PHP_FUNCTION(cpdf_page_init); -PHP_FUNCTION(cpdf_finalize_page); -PHP_FUNCTION(cpdf_set_current_page); -PHP_FUNCTION(cpdf_begin_text); -PHP_FUNCTION(cpdf_end_text); -PHP_FUNCTION(cpdf_show); -PHP_FUNCTION(cpdf_show_xy); -PHP_FUNCTION(cpdf_continue_text); -PHP_FUNCTION(cpdf_text); -PHP_FUNCTION(cpdf_set_font); -PHP_FUNCTION(cpdf_set_font_directories); -PHP_FUNCTION(cpdf_set_font_map_file); -PHP_FUNCTION(cpdf_set_leading); -PHP_FUNCTION(cpdf_set_text_rendering); -PHP_FUNCTION(cpdf_set_horiz_scaling); -PHP_FUNCTION(cpdf_set_text_rise); -PHP_FUNCTION(cpdf_set_text_matrix); -PHP_FUNCTION(cpdf_set_text_pos); -PHP_FUNCTION(cpdf_rotate_text); -PHP_FUNCTION(cpdf_set_char_spacing); -PHP_FUNCTION(cpdf_set_word_spacing); -PHP_FUNCTION(cpdf_continue_text); -PHP_FUNCTION(cpdf_stringwidth); -PHP_FUNCTION(cpdf_save); -PHP_FUNCTION(cpdf_restore); -PHP_FUNCTION(cpdf_translate); -PHP_FUNCTION(cpdf_scale); -PHP_FUNCTION(cpdf_rotate); -PHP_FUNCTION(cpdf_setflat); -PHP_FUNCTION(cpdf_setlinejoin); -PHP_FUNCTION(cpdf_setlinecap); -PHP_FUNCTION(cpdf_setmiterlimit); -PHP_FUNCTION(cpdf_setlinewidth); -PHP_FUNCTION(cpdf_setdash); -PHP_FUNCTION(cpdf_moveto); -PHP_FUNCTION(cpdf_rmoveto); -PHP_FUNCTION(cpdf_curveto); -PHP_FUNCTION(cpdf_lineto); -PHP_FUNCTION(cpdf_rlineto); -PHP_FUNCTION(cpdf_circle); -PHP_FUNCTION(cpdf_arc); -PHP_FUNCTION(cpdf_rect); -PHP_FUNCTION(cpdf_newpath); -PHP_FUNCTION(cpdf_closepath); -PHP_FUNCTION(cpdf_closepath_stroke); -PHP_FUNCTION(cpdf_stroke); -PHP_FUNCTION(cpdf_fill); -PHP_FUNCTION(cpdf_fill_stroke); -PHP_FUNCTION(cpdf_closepath_fill_stroke); -PHP_FUNCTION(cpdf_endpath); -PHP_FUNCTION(cpdf_clip); -PHP_FUNCTION(cpdf_setgray_fill); -PHP_FUNCTION(cpdf_setgray_stroke); -PHP_FUNCTION(cpdf_setgray); -PHP_FUNCTION(cpdf_setrgbcolor_fill); -PHP_FUNCTION(cpdf_setrgbcolor_stroke); -PHP_FUNCTION(cpdf_setrgbcolor); -PHP_FUNCTION(cpdf_add_outline); -PHP_FUNCTION(cpdf_set_page_animation); -PHP_FUNCTION(cpdf_finalize); -PHP_FUNCTION(cpdf_output_buffer); -PHP_FUNCTION(cpdf_save_to_file); -PHP_FUNCTION(cpdf_add_annotation); -PHP_FUNCTION(cpdf_import_jpeg); -#if HAVE_LIBGD13 -PHP_FUNCTION(cpdf_place_inline_image); -#endif -PHP_FUNCTION(cpdf_set_action_url); -#else -#define cpdf_module_ptr NULL -#endif -#define phpext_cpdf_ptr cpdf_module_ptr -#endif /* _PHP_PDF_H */