[PHP-CVS] cvs: php4 /ext/pdf pdf.c php_pdf.h
rjs Wed Mar 21 12:55:35 2001 EDT Modified files: /php4/ext/pdf pdf.c php_pdf.h Log: Beta2 of PDFlib V4.0 will introduce on new function (PDF_place_pdi_page) and PDF_close_pdi_page will lose one parameter. These changes are done for the phpwrapper now. This has no impact on PDFlib V3.x. Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.77 php4/ext/pdf/pdf.c:1.78 --- php4/ext/pdf/pdf.c:1.77 Fri Mar 9 18:21:38 2001 +++ php4/ext/pdf/pdf.c Wed Mar 21 12:55:34 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: pdf.c,v 1.77 2001/03/10 02:21:38 hirokawa Exp $ */ +/* $Id: pdf.c,v 1.78 2001/03/21 20:55:34 rjs Exp $ */ /* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. @@ -185,6 +185,7 @@ PHP_FE(pdf_open_pdi, NULL) PHP_FE(pdf_close_pdi, NULL) PHP_FE(pdf_open_pdi_page, NULL) + PHP_FE(pdf_place_pdi_page, NULL) PHP_FE(pdf_close_pdi_page, NULL) PHP_FE(pdf_get_pdi_parameter, NULL) PHP_FE(pdf_get_pdi_value, NULL) @@ -293,7 +294,7 @@ #else php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); #endif - php_info_print_table_row(2, "Revision", "$Revision: 1.77 $" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.78 $" ); php_info_print_table_end(); } @@ -2684,24 +2685,50 @@ RETURN_LONG(pdi_image+PDFLIB_IMAGE_OFFSET); } -/* {{{ proto void pdf_close_pdi_page(int pdf, int doc, int page); +/* {{{ proto void pdf_place_pdi_page(int pdf, int page, double x, double y, double +sx, double sy) + * Place a PDF page with the lower left corner at (x, y), and scale it. */ +PHP_FUNCTION(pdf_place_pdi_page) { + zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6; + PDF *pdf; + + if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, +&arg4, &arg5, &arg6) == FAILURE) { + WRONG_PARAM_COUNT; + } + + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); + + convert_to_long_ex(arg2); + convert_to_double_ex(arg3); + convert_to_double_ex(arg4); + convert_to_double_ex(arg5); + convert_to_double_ex(arg6); + + PDF_place_pdi_page(pdf, + Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET, + (float) Z_DVAL_PP(arg3), + (float) Z_DVAL_PP(arg4), + (float) Z_DVAL_PP(arg5), + (float) Z_DVAL_PP(arg6)); + + RETURN_TRUE; +} + +/* {{{ proto void pdf_close_pdi_page(int pdf, int page); * Close the page handle, and free all page-related resources. */ PHP_FUNCTION(pdf_close_pdi_page) { - zval **arg1, **arg2, **arg3; + zval **arg1, **arg2; PDF *pdf; - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) { + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == +FAILURE) { WRONG_PARAM_COUNT; } ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_long_ex(arg2); - convert_to_long_ex(arg3); PDF_close_pdi_page(pdf, - Z_LVAL_PP(arg2)-PDFLIB_PDI_OFFSET, - Z_LVAL_PP(arg3)-PDFLIB_IMAGE_OFFSET); + Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET); RETURN_TRUE; } @@ -2854,7 +2881,7 @@ PHP_FUNCTION(pdf_setcolor) { zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7; PDF *pdf; - int c1; + double c1; if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) { WRONG_PARAM_COUNT; @@ -2870,11 +2897,11 @@ convert_to_double_ex(arg7); if (0 == (strcmp(Z_STRVAL_PP(arg3), "spot"))) { - c1 = (int) Z_DVAL_PP(arg4)-PDFLIB_SPOT_OFFSET; + c1 = Z_DVAL_PP(arg4)-PDFLIB_SPOT_OFFSET; } else if(0 == (strcmp(Z_STRVAL_PP(arg3), "pattern"))) { - c1 = (int) Z_DVAL_PP(arg4)-PDFLIB_PATTERN_OFFSET; + c1 = Z_DVAL_PP(arg4)-PDFLIB_PATTERN_OFFSET; } else { - c1 = (float) Z_DVAL_PP(arg4); + c1 = Z_DVAL_PP(arg4); } PDF_setcolor(pdf, Index: php4/ext/pdf/php_pdf.h diff -u php4/ext/pdf/php_pdf.h:1.15 php4/ext/pdf/php_pdf.h:1.16 --- php4/ext/pdf/php_pdf.h:1.15 Thu Mar 1 11:51:54 2001 +++ php4/ext/pdf/php_pdf.h Wed Mar 21 12:55:34 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_pdf.h,v 1.15 2001/03/01 19:51:54 rjs Exp $ */ +/* $Id: php_pdf.h,v 1.16 2001/03/21 20:55:34 rjs Exp $ */ #ifndef PHP_PDF_H #define PHP_PDF_H @@ -151,6 +151,7 @@ PHP_FUNCTION(pdf_open_pdi); PHP_FUNCTION(pdf_close_pdi); PHP_FUNCTION(pdf_open_pdi_page); +PHP_FUNCTION(pdf_place_pdi_page); PHP_FUNCTION(pdf_close_pdi_page); PHP_FUNCTION(pdf_get_p
[PHP-CVS] cvs: php4 /ext/pdf pdf.c
hirokawaFri Mar 9 18:21:38 2001 EDT Modified files: /php4/ext/pdf pdf.c Log: just reversed a previous patch. Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.76 php4/ext/pdf/pdf.c:1.77 --- php4/ext/pdf/pdf.c:1.76 Fri Mar 9 18:03:26 2001 +++ php4/ext/pdf/pdf.c Fri Mar 9 18:21:38 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: pdf.c,v 1.76 2001/03/10 02:03:26 hirokawa Exp $ */ +/* $Id: pdf.c,v 1.77 2001/03/10 02:21:38 hirokawa Exp $ */ /* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. @@ -27,7 +27,6 @@ #include "php.h" #include "php_ini.h" #include "php_globals.h" -#include "php_config.h" #include "ext/standard/head.h" #include "ext/standard/info.h" #include "ext/standard/file.h" @@ -294,7 +293,7 @@ #else php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); #endif - php_info_print_table_row(2, "Revision", "$Revision: 1.76 $" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.77 $" ); php_info_print_table_end(); } -- PHP CVS 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]
[PHP-CVS] cvs: php4 /ext/pdf pdf.c
rjs Mon Mar 5 08:18:50 2001 EDT Modified files: /php4/ext/pdf pdf.c Log: fixed bug in PDF_getbuffer (happend only on Windows) When using PDFlib V4.0 the pdf_set(grey/rgbcolor) functions are replaced by the PDFlib V4.0 function pdf_setcolor Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.74 php4/ext/pdf/pdf.c:1.75 --- php4/ext/pdf/pdf.c:1.74 Thu Mar 1 11:51:53 2001 +++ php4/ext/pdf/pdf.c Mon Mar 5 08:18:50 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: pdf.c,v 1.74 2001/03/01 19:51:53 rjs Exp $ */ +/* $Id: pdf.c,v 1.75 2001/03/05 16:18:50 rjs Exp $ */ /* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. @@ -293,7 +293,7 @@ #else php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); #endif - php_info_print_table_row(2, "Revision", "$Revision: 1.74 $" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.75 $" ); php_info_print_table_end(); } @@ -1498,7 +1498,11 @@ ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_double_ex(arg2); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "fill", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0); +#else PDF_setgray_fill(pdf, (float) Z_DVAL_PP(arg2)); +#endif RETURN_TRUE; } /* }}} */ @@ -1517,7 +1521,11 @@ ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_double_ex(arg2); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "stroke", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0); +#else PDF_setgray_stroke(pdf, (float) Z_DVAL_PP(arg2)); +#endif RETURN_TRUE; } /* }}} */ @@ -1536,7 +1544,11 @@ ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_double_ex(arg2); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "both", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0); +#else PDF_setgray(pdf, (float) Z_DVAL_PP(arg2)); +#endif RETURN_TRUE; } /* }}} */ @@ -1557,7 +1569,11 @@ convert_to_double_ex(arg2); convert_to_double_ex(arg3); convert_to_double_ex(arg4); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "fill", "rgb", (float) Z_DVAL_PP(arg2), (float) +Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0); +#else PDF_setrgbcolor_fill(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); +#endif RETURN_TRUE; } /* }}} */ @@ -1578,7 +1594,11 @@ convert_to_double_ex(arg2); convert_to_double_ex(arg3); convert_to_double_ex(arg4); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "stroke", "rgb", (float) Z_DVAL_PP(arg2), (float) +Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0); +#else PDF_setrgbcolor_stroke(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); +#endif RETURN_TRUE; } /* }}} */ @@ -1599,7 +1619,11 @@ convert_to_double_ex(arg2); convert_to_double_ex(arg3); convert_to_double_ex(arg4); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "both", "rgb", (float) Z_DVAL_PP(arg2), (float) +Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0); +#else PDF_setrgbcolor(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); +#endif RETURN_TRUE; } /* }}} */ @@ -2179,11 +2203,7 @@ if (argc == 2) { convert_to_string_ex(arg2); -#ifdef VIRTUAL_DIR - virtual_filepath(Z_STRVAL_PP(arg2), &filename); -#else filename = Z_STRVAL_PP(arg2); -#endif pdf_file = PDF_open_file(pdf, filename); } else { /* open in memory */ -- PHP CVS 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]
[PHP-CVS] cvs: php4 /ext/pdf pdf.c php_pdf.h
rjs Thu Mar 1 11:51:54 2001 EDT Modified files: /php4/ext/pdf pdf.c php_pdf.h Log: - integrated new functions vor PDFlib V4.0 (beta1) - all functions accepting strings now support binary strings, by calling the appropriate PDF*2() functions. Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.73 php4/ext/pdf/pdf.c:1.74 --- php4/ext/pdf/pdf.c:1.73 Sun Feb 25 22:07:11 2001 +++ php4/ext/pdf/pdf.c Thu Mar 1 11:51:53 2001 @@ -17,7 +17,8 @@ +--+ */ -/* $Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp $ */ +/* $Id: pdf.c,v 1.74 2001/03/01 19:51:53 rjs Exp $ */ +/* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ @@ -57,6 +58,9 @@ */ #define PDFLIB_IMAGE_OFFSET1 #define PDFLIB_FONT_OFFSET 1 +#define PDFLIB_PDI_OFFSET 1 +#define PDFLIB_PATTERN_OFFSET 1 +#define PDFLIB_SPOT_OFFSET 1 function_entry pdf_functions[] = { /* sorry for sorting this stuff like the pdflib manual, @@ -109,12 +113,6 @@ PHP_FE(pdf_closepath_fill_stroke, NULL) PHP_FE(pdf_clip, NULL) PHP_FE(pdf_endpath, NULL) - PHP_FE(pdf_setgray_fill, NULL) - PHP_FE(pdf_setgray_stroke, NULL) - PHP_FE(pdf_setgray, NULL) - PHP_FE(pdf_setrgbcolor_fill, NULL) - PHP_FE(pdf_setrgbcolor_stroke, NULL) - PHP_FE(pdf_setrgbcolor, NULL) PHP_FE(pdf_open_image_file, NULL) /* new parameters: [char *stringpram, int intparam] */ PHP_FE(pdf_open_ccitt, NULL)/* new function */ PHP_FE(pdf_open_image, NULL)/* new function */ @@ -174,6 +172,33 @@ #if HAVE_LIBGD13 PHP_FE(pdf_open_memory_image, NULL) #endif + /* depreciatet after V4.0 of PDFlib */ + PHP_FE(pdf_setgray_fill, NULL) + PHP_FE(pdf_setgray_stroke, NULL) + PHP_FE(pdf_setgray, NULL) + PHP_FE(pdf_setrgbcolor_fill, NULL) + PHP_FE(pdf_setrgbcolor_stroke, NULL) + PHP_FE(pdf_setrgbcolor, NULL) + +#if (PDFLIB_MAJORVERSION >= 4) +/* support for new functions in PDFlib V4.0 */ + PHP_FE(pdf_open_pdi, NULL) + PHP_FE(pdf_close_pdi, NULL) + PHP_FE(pdf_open_pdi_page, NULL) + PHP_FE(pdf_close_pdi_page, NULL) + PHP_FE(pdf_get_pdi_parameter, NULL) + PHP_FE(pdf_get_pdi_value, NULL) + PHP_FE(pdf_begin_pattern, NULL) + PHP_FE(pdf_end_pattern, NULL) + PHP_FE(pdf_begin_template, NULL) + PHP_FE(pdf_end_template, NULL) + PHP_FE(pdf_setcolor, NULL) + PHP_FE(pdf_makespotcolor, NULL) + PHP_FE(pdf_arcn, NULL) + PHP_FE(pdf_add_thumbnail, NULL) + PHP_FE(pdf_initgraphics, NULL) + PHP_FE(pdf_setmatrix, NULL) +#endif /* PDFlib >= V4 */ {NULL, NULL, NULL} }; @@ -263,14 +288,22 @@ php_info_print_table_start(); php_info_print_table_row(2, "PDF Support", "enabled" ); +#if (PDFLIB_MAJORVERSION >= 4) + php_info_print_table_row(2, "PDFlib GmbH Version", PDFLIB_VERSIONSTRING ); +#else php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); - php_info_print_table_row(2, "Revision", "$Revision: 1.73 $" ); +#endif + php_info_print_table_row(2, "Revision", "$Revision: 1.74 $" ); php_info_print_table_end(); } PHP_MINIT_FUNCTION(pdf) { + if ((PDF_get_majorversion() != PDFLIB_MAJORVERSION) || + (PDF_get_minorversion() != PDFLIB_MINORVERSION)) { + php_error(E_ERROR,"PDFlib error: Version mismatch in wrapper code"); + } le_pdf = zend_register_list_destructors_ex(_free_pdf_doc, NULL, "pdf object", module_number); /* this does something like setlocale("C", ...) in PDFlib 3.x */ @@ -469,7 +502,7 @@ ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); - PDF_show(pdf, Z_STRVAL_PP(arg2)); + PDF_show2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2)); RETURN_TRUE; } /* }}} */ @@ -490,7 +523,7 @@ convert_to_string_ex(arg2); convert_to_double_ex(arg3); convert_to_double_ex(arg4); - PDF_show_xy(pdf, Z_STRVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); + PDF_show_xy2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2), (float) +Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); RETURN_TRUE; } /* }}} */ @@ -803,7 +836,7 @@ ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); - PDF_continue_text(pdf, Z_STRVAL_PP(arg2)); + PDF_continue_text2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2)); RETURN_TRUE; } /* }}} */ @@ -843,7 +876,12 @@ convert_to_double_ex(arg4); size = Z_DVAL_PP(arg4); } - width = (double) PDF_stringwidth(pdf, Z_STRVAL_PP(arg2), font-PDFLIB_FONT_OFFSET, size)
[PHP-CVS] cvs: php4 /ext/pdf pdf.c
rjs Wed Feb 21 15:30:20 2001 EDT Modified files: /php4/ext/pdf pdf.c Log: When using pdf_get_buffer() and doing a correct cleanup by calling pdf_delete() this always resulted in a coredump (after everything was finished, so only visible in the logfile). So it seems to be neccesary to copy the contents of the result of get_buffer, to avoid this coredump. Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.71 php4/ext/pdf/pdf.c:1.72 --- php4/ext/pdf/pdf.c:1.71 Thu Feb 15 06:48:57 2001 +++ php4/ext/pdf/pdf.c Wed Feb 21 15:30:20 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: pdf.c,v 1.71 2001/02/15 14:48:57 thies Exp $ */ +/* $Id: pdf.c,v 1.72 2001/02/21 23:30:20 rjs Exp $ */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ @@ -264,7 +264,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "PDF Support", "enabled" ); php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); - php_info_print_table_row(2, "Revision", "$Revision: 1.71 $" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.72 $" ); php_info_print_table_end(); } @@ -2176,7 +2176,7 @@ buffer = PDF_get_buffer(pdf, &size); - RETURN_STRINGL((char *)buffer, size, 0); + RETURN_STRINGL((char *)buffer, size, 1); } /* }}} */ -- PHP CVS 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]
[PHP-CVS] cvs: php4 /ext/pdf pdf.c
steinm Wed Jan 31 23:07:09 2001 EDT Modified files: /php4/ext/pdf pdf.c Log: some modification from Rainer Schaaf * fixed prototype for pdf_new() * MINFO: included Revision of pdf.c, removed info about CJK + in-memory, this is standard with V3.x) * repaired PDF_open_CCITT * repaired PDF_setfont * eliminated many compiler warnings. * former resource "pdf document" is now called "pdf object" Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.68 php4/ext/pdf/pdf.c:1.69 --- php4/ext/pdf/pdf.c:1.68 Wed Jan 31 09:00:10 2001 +++ php4/ext/pdf/pdf.c Wed Jan 31 23:07:09 2001 @@ -13,10 +13,11 @@ | [EMAIL PROTECTED] so we can mail you a copy immediately. | +--+ | Authors: Uwe Steinmann <[EMAIL PROTECTED]> | + | Rainer Schaaf <[EMAIL PROTECTED]> | +--+ */ -/* $Id: pdf.c,v 1.68 2001/01/31 17:00:10 dbeu Exp $ */ +/* $Id: pdf.c,v 1.69 2001/02/01 07:07:09 steinm Exp $ */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ @@ -274,15 +275,14 @@ php_info_print_table_start(); php_info_print_table_row(2, "PDF Support", "enabled" ); php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); - php_info_print_table_row(2, "CJK Font Support", "yes" ); - php_info_print_table_row(2, "In-memory PDF Creation Support", "yes" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.69 $" ); php_info_print_table_end(); } PHP_MINIT_FUNCTION(pdf) { - le_pdf = zend_register_list_destructors_ex(_free_pdf_doc, NULL, "pdf document", module_number); + le_pdf = zend_register_list_destructors_ex(_free_pdf_doc, NULL, "pdf object", +module_number); /* this does something like setlocale("C", ...) in PDFlib 3.x */ PDF_boot(); @@ -305,7 +305,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); PDF_set_info(pdf, field, Z_STRVAL_PP(arg2)); @@ -324,7 +324,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); convert_to_string_ex(arg3); @@ -393,7 +393,6 @@ } pdf = PDF_new2(custom_errorhandler, pdf_emalloc, pdf_realloc, pdf_efree, NULL); - PDF_set_parameter(pdf, "imagewarning", "true"); if(fp) { if (PDF_open_fp(pdf, fp) < 0) RETURN_FALSE; @@ -401,6 +400,8 @@ PDF_open_mem(pdf, pdf_flushwrite); } + PDF_set_parameter(pdf, "imagewarning", "true"); + ZEND_REGISTER_RESOURCE(return_value, pdf, le_pdf); } @@ -417,7 +418,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); PDF_close(pdf); @@ -437,7 +438,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_double_ex(arg2); convert_to_double_ex(arg3); @@ -457,7 +458,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); PDF_end_page(pdf); RETURN_TRUE; @@ -475,7 +476,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); PDF_show(pdf, Z_STRVAL_PP(arg2)); @@ -494,7 +495,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); convert_to_double_ex(arg3); @@ -518,7 +519,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, argv[0], -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, argv[0], -1, "pdf object", le_pdf); convert_to_string_ex(argv[1]); convert_to_double_ex(argv[2]); @@ -572,7 +573,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); +
[PHP-CVS] cvs: php4 /ext/pdf pdf.c
dbeuWed Jan 31 09:00:10 2001 EDT Modified files: /php4/ext/pdf pdf.c Log: fix typo Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.67 php4/ext/pdf/pdf.c:1.68 --- php4/ext/pdf/pdf.c:1.67 Fri Jan 26 10:52:37 2001 +++ php4/ext/pdf/pdf.c Wed Jan 31 09:00:10 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: pdf.c,v 1.67 2001/01/26 18:52:37 eschmid Exp $ */ +/* $Id: pdf.c,v 1.68 2001/01/31 17:00:10 dbeu Exp $ */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ @@ -2368,7 +2368,7 @@ convert_to_long_ex(arg6); convert_to_long_ex(arg7); - pdf_image = PDF_open_ccitt(pdf, + pdf_image = PDF_open_CCITT(pdf, image, Z_LVAL_PP(arg3), Z_LVAL_PP(arg4), -- PHP CVS 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]
[PHP-CVS] cvs: php4 /ext/pdf pdf.c php_pdf.h
eschmid Fri Jan 26 10:52:37 2001 EDT Modified files: /php4/ext/pdf php_pdf.h pdf.c Log: Fixed some protos. Index: php4/ext/pdf/php_pdf.h diff -u php4/ext/pdf/php_pdf.h:1.12 php4/ext/pdf/php_pdf.h:1.13 --- php4/ext/pdf/php_pdf.h:1.12 Fri Jan 26 00:20:23 2001 +++ php4/ext/pdf/php_pdf.h Fri Jan 26 10:52:37 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_pdf.h,v 1.12 2001/01/26 08:20:23 steinm Exp $ */ +/* $Id: php_pdf.h,v 1.13 2001/01/26 18:52:37 eschmid Exp $ */ #ifndef PHP_PDF_H #define PHP_PDF_H @@ -89,7 +89,7 @@ PHP_FUNCTION(pdf_setrgbcolor_stroke); PHP_FUNCTION(pdf_setrgbcolor); PHP_FUNCTION(pdf_open_image_file); /* new parameters: [char *stringpram, int intparam] */ -PHP_FUNCTION(pdf_open_CCITT); /* new function */ +PHP_FUNCTION(pdf_open_ccitt); /* new function */ PHP_FUNCTION(pdf_open_image); /* new function: checkit not yet completeted :( */ PHP_FUNCTION(pdf_close_image); PHP_FUNCTION(pdf_place_image); Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.66 php4/ext/pdf/pdf.c:1.67 --- php4/ext/pdf/pdf.c:1.66 Fri Jan 26 00:20:23 2001 +++ php4/ext/pdf/pdf.c Fri Jan 26 10:52:37 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: pdf.c,v 1.66 2001/01/26 08:20:23 steinm Exp $ */ +/* $Id: pdf.c,v 1.67 2001/01/26 18:52:37 eschmid Exp $ */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ @@ -115,7 +115,7 @@ PHP_FE(pdf_setrgbcolor_stroke, NULL) PHP_FE(pdf_setrgbcolor, NULL) PHP_FE(pdf_open_image_file, NULL) /* new parameters: [char *stringpram, int intparam] */ - PHP_FE(pdf_open_CCITT, NULL)/* new function */ + PHP_FE(pdf_open_ccitt, NULL)/* new function */ PHP_FE(pdf_open_image, NULL)/* new function */ PHP_FE(pdf_close_image, NULL) PHP_FE(pdf_place_image, NULL) @@ -375,9 +375,7 @@ /* {{{ proto int pdf_open([int filedesc]) - Opens a new pdf document. If filedesc is NULL, document is created in memory. - This is the old interface, only for compatibility - use pdf_new + pdf_open_file instead */ + Opens a new pdf document. If filedesc is NULL, document is created in memory. This +is the old interface, only for compatibility use pdf_new + pdf_open_file instead */ PHP_FUNCTION(pdf_open) { zval **file; @@ -506,7 +504,7 @@ } /* }}} */ -/* {{{ proto int pdf_show_boxed(int pdfdoc, string text, double x-koor, double y-koor, double width, double height, string mode, [string feature]) +/* {{{ proto int pdf_show_boxed(int pdfdoc, string text, double x-koor, double +y-koor, double width, double height, string mode [, string feature]) Output text formated in a boxed */ PHP_FUNCTION(pdf_show_boxed) { @@ -781,7 +779,7 @@ /* }}} */ /* {{{ proto void pdf_set_text_pos(int pdfdoc, double x, double y) - Set the position of text for the next pdf_show call */ + Sets the position of text for the next pdf_show call */ PHP_FUNCTION(pdf_set_text_pos) { zval **arg1, **arg2, **arg3; @@ -820,7 +818,7 @@ /* }}} */ /* {{{ proto double pdf_stringwidth(int pdfdoc, string text [, int font, double size]) - Returns width of text in current font*/ + Returns width of text in current font */ PHP_FUNCTION(pdf_stringwidth) { zval **arg1, **arg2, **arg3, **arg4; @@ -1515,7 +1513,7 @@ /* }}} */ /* {{{ proto void pdf_setrgbcolor_fill(int pdfdoc, double red, double green, double blue) - Sets filling color to rgb color value */ + Sets filling color to RGB color value */ PHP_FUNCTION(pdf_setrgbcolor_fill) { zval **arg1, **arg2, **arg3, **arg4; @@ -1536,7 +1534,7 @@ /* }}} */ /* {{{ proto void pdf_setrgbcolor_stroke(int pdfdoc, double red, double green, double blue) - Sets drawing color to rgb color value */ + Sets drawing color to RGB color value */ PHP_FUNCTION(pdf_setrgbcolor_stroke) { zval **arg1, **arg2, **arg3, **arg4; @@ -1557,7 +1555,7 @@ /* }}} */ /* {{{ proto void pdf_setrgbcolor(int pdfdoc, double red, double green, double blue) - Sets drawing and filling color to rgb color value */ + Sets drawing and filling color to RGB color value */ PHP_FUNCTION(pdf_setrgbcolor) { zval **arg1, **arg2, **arg3, **arg4; @@ -1577,8 +1575,8 @@ } /* }}} */ -/* {{{ proto int pdf_add_bookmark(int pdfdoc, string text [, int parent, int open]); - Add bookmark for current page */ +/* {{{ proto int pdf_add_bookmark(int pdfdoc, string text [, int parent, int open]) + Adds bookmark for current page */ PHP_FUNCTION(pdf_add_bookmark) { zval **arg1, **arg2, **arg3, **arg4; @@ -1725,7 +1723,7 @@ } /* {{{ proto int pdf_open_gif(int pdf, string giffile) - Opens a gif file and returns an image for placement in a pdf document */ + Opens a GIF file and returns an i
[PHP-CVS] cvs: php4 /ext/pdf pdf.c php_pdf.h
steinm Fri Jan 26 00:20:23 2001 EDT Modified files: /php4/ext/pdf pdf.c php_pdf.h Log: - This is major change of the php pdf api to be closer to the pdflib api done by Rainer Schaaf from pdflib GmbH. - Some more functions has been implemented as well. - backwards compatibility has been maintained a much as possible Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.65 php4/ext/pdf/pdf.c:1.66 --- php4/ext/pdf/pdf.c:1.65 Wed Jan 3 08:52:59 2001 +++ php4/ext/pdf/pdf.c Fri Jan 26 00:20:23 2001 @@ -16,10 +16,10 @@ +--+ */ -/* $Id: pdf.c,v 1.65 2001/01/03 16:52:59 sniper Exp $ */ +/* $Id: pdf.c,v 1.66 2001/01/26 08:20:23 steinm Exp $ */ -/* pdflib 2.02 is subject to the ALADDIN FREE PUBLIC LICENSE. - Copyright (C) 1997 Thomas Merz. */ +/* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. + Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ /* Note that there is no code from the pdflib package in this file */ #include "php.h" @@ -46,93 +46,134 @@ #include "php_pdf.h" -static int le_pdf_image, le_outline, le_pdf; +static int le_pdf; +/* + * to adopt the php way of error handling to PDFlib + * The image related functions in PDFlib return -1 on error + * but they may return 0 (FALSE) in normal cases + * so this offset will repair this + */ +#define PDFLIB_IMAGE_OFFSET1 +#define PDFLIB_FONT_OFFSET 1 + function_entry pdf_functions[] = { - PHP_FE(pdf_set_info,NULL) - PHP_FE(pdf_set_info_creator,NULL) /* deprecated */ - PHP_FE(pdf_set_info_title, NULL) /* deprecated */ - PHP_FE(pdf_set_info_subject,NULL) /* deprecated */ - PHP_FE(pdf_set_info_author, NULL) /* deprecated */ - PHP_FE(pdf_set_info_keywords, NULL) /* deprecated */ - PHP_FE(pdf_open,NULL) - PHP_FE(pdf_close, NULL) - PHP_FE(pdf_begin_page, NULL) - PHP_FE(pdf_end_page,NULL) - PHP_FE(pdf_show,NULL) - PHP_FE(pdf_show_xy, NULL) - PHP_FE(pdf_show_boxed, NULL) - PHP_FE(pdf_skew,NULL) - PHP_FE(pdf_set_font,NULL) - PHP_FE(pdf_set_leading, NULL) /* deprecated */ - PHP_FE(pdf_set_text_rendering, NULL) /* deprecated */ - PHP_FE(pdf_set_horiz_scaling, NULL) /* deprecated */ - PHP_FE(pdf_set_text_rise, NULL) /* deprecated */ - PHP_FE(pdf_set_text_pos,NULL) - PHP_FE(pdf_set_char_spacing,NULL) /* deprecated */ - PHP_FE(pdf_set_word_spacing,NULL) /* deprecated */ - PHP_FE(pdf_get_font,NULL) - PHP_FE(pdf_get_fontname,NULL) - PHP_FE(pdf_get_fontsize,NULL) - PHP_FE(pdf_continue_text, NULL) - PHP_FE(pdf_stringwidth, NULL) - PHP_FE(pdf_save,NULL) - PHP_FE(pdf_restore, NULL) - PHP_FE(pdf_translate, NULL) - PHP_FE(pdf_scale, NULL) - PHP_FE(pdf_rotate, NULL) - PHP_FE(pdf_setflat, NULL) - PHP_FE(pdf_setlinejoin, NULL) - PHP_FE(pdf_setlinecap, NULL) - PHP_FE(pdf_setmiterlimit, NULL) - PHP_FE(pdf_setlinewidth,NULL) - PHP_FE(pdf_setdash, NULL) - PHP_FE(pdf_moveto, NULL) - PHP_FE(pdf_lineto, NULL) - PHP_FE(pdf_curveto, NULL) - PHP_FE(pdf_circle, NULL) - PHP_FE(pdf_arc, NULL) - PHP_FE(pdf_rect,NULL) - PHP_FE(pdf_closepath, NULL) - PHP_FE(pdf_stroke, NULL) - PHP_FE(pdf_closepath_stroke,NULL) - PHP_FE(pdf_fill,NULL) - PHP_FE(pdf_fill_stroke, NULL) - PHP_FE(pdf_closepath_fill_stroke, NULL) - PHP_FE(pdf_endpath, NULL) - PHP_FE(pdf_clip,NULL) - PHP_FE(pdf_set_parameter, NULL) - PHP_FE(pdf_get_parameter, NULL) - PHP_FE(pdf_set_value, NULL) - PHP_FE(pdf_get_value, NULL) - PHP_FE(pdf_setgray_fill,NULL) - PHP_FE(pdf_setgray_stroke, NULL) - PHP_FE(pd