cvs: /php4 NEWS /php4/ext/pdf pdf.c php_pdf.h
| From: | Uwe Steinmann | Date: | Tue, 15 Feb 2000 08:10:32 +0000 |
| Subject: | cvs: /php4 NEWS /php4/ext/pdf pdf.c php_pdf.h | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-10288@lists.php.net to get a copy of this message | ||
steinm Tue Feb 15 00:10:32 2000 EDT
Modified files:
/php4 NEWS
/php4/ext/pdf pdf.c php_pdf.h
Log:
- initial support for pdflib 2.20, little testing till now
Index: php4/NEWS
diff -u php4/NEWS:1.128 php4/NEWS:1.129
--- php4/NEWS:1.128 Mon Feb 14 20:54:20 2000
+++ php4/NEWS Tue Feb 15 00:10:31 2000
@@ -2,6 +2,7 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ?? ????, Version 4.0 Beta 4
+- Initital support for pdflib 2.20 (Uwe)
- Added PostgreSQL support for DB (Rui Hirokawa <louis@cityfujisawa.ne.jp>)
- Re-introduced "none" for disabling auto_prepend/append_file (Stig)
- Added DB/storage to PEAR
Index: php4/ext/pdf/pdf.c
diff -u php4/ext/pdf/pdf.c:1.22 php4/ext/pdf/pdf.c:1.23
--- php4/ext/pdf/pdf.c:1.22 Thu Feb 10 02:20:29 2000
+++ php4/ext/pdf/pdf.c Tue Feb 15 00:10:32 2000
@@ -27,7 +27,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdf.c,v 1.22 2000/02/10 10:20:29 steinm Exp $ */
+/* $Id: pdf.c,v 1.23 2000/02/15 08:10:32 steinm Exp $ */
/* pdflib 2.01 is subject to the ALADDIN FREE PUBLIC LICENSE.
Copyright (C) 1997 Thomas Merz. */
@@ -40,6 +40,7 @@
#include "php.h"
#include "php_globals.h"
+#include "ext/standard/head.h"
#include <math.h>
@@ -224,6 +225,7 @@
static size_t pdf_flushwrite(PDF *p, void *data, size_t size){
if(php_header())
return(php_write(data, size));
+ return 0;
}
#endif
@@ -238,6 +240,13 @@
PHP_MINFO_FUNCTION(pdf) {
/* need to use a PHPAPI function here because it is external module in windows */
php_printf("pdflib %d.%02d<BR>", PDF_get_majorversion(), PDF_get_minorversion());
+#if PDFLIB_MAJORVERSION >= 3 | (PDFLIB_MAJORVERSION >= 2 & PDFLIB_MINORVERSION >= 20)
+ php_printf("The CJK fonts supported.");
+#endif
+#ifdef PDF_OPEN_MEM_SUPPORTED
+ php_printf("Support for in memory pdf creation.");
+#endif
+
#if PDFLIB_MINORVERSION > 0
php_printf("The function pdf_put_image() and pdf_execute_image() are <B>not</B>
available");
#else
@@ -415,9 +424,7 @@
WRONG_PARAM_COUNT;
if (argc != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
fp = NULL;
- php3_printf("No File\n");
} else {
- php3_printf("With File\n");
ZEND_FETCH_RESOURCE(fp, FILE *, file, -1, "File-Handle", php_file_le_fopen());
/* XXX should do anzend_list_addref for <fp> here! */
}
@@ -437,13 +444,17 @@
pdf = PDF_new();
#endif
-#if PDFLIB_MAJORVERSION >= 2 & PDFLIB_MINORVERSION >= 10
+#if PDFLIB_MAJORVERSION >= 2 & PDFLIB_MINORVERSION >= 10 & defined
PDF_OPEN_MEM_SUPPORTED
if(fp) {
if (0 > PDF_open_fp(pdf, fp))
RETURN_FALSE;
} else {
+#if PDFLIB_MAJORVERSION >= 3 | (PDFLIB_MAJORVERSION >= 2 & PDFLIB_MINORVERSION >= 20)
& defined PDF_OPEN_MEM_SUPPORTED
+ PDF_open_mem(pdf, pdf_flushwrite);
+#else
if (0 > PDF_open_mem(pdf, pdf_flushwrite))
RETURN_FALSE;
+#endif
}
#else
if (0 > PDF_open_fp(pdf, fp)) {
@@ -623,14 +634,22 @@
convert_to_long(arg1);
convert_to_string(arg2);
convert_to_double(arg3);
+#if PDFLIB_MAJORVERSION >= 2
+ convert_to_string(arg4);
+#else
convert_to_long(arg4);
+#endif
+
id=arg1->value.lval;
pdf = zend_list_find(id,&type);
if(!pdf || type!=PDF_GLOBAL(le_pdf)) {
php_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
-
+
+#if PDFLIB_MAJORVERSION >= 2
+ font = PDF_findfont(pdf, arg2->value.str.val, arg4->value.str.val, embed);
+#else
if((arg4->value.lval > 5) || (arg4->value.lval < 0)) {
php_error(E_WARNING,"Font encoding set to 4");
arg4->value.lval = 4;
@@ -656,7 +675,7 @@
php_error(E_WARNING,"Encoding out of range, using 0");
font = PDF_findfont(pdf, arg2->value.str.val, "builtin", embed);
}
-
+#endif
if (font < 0) {
php_error(E_WARNING,"Font %s not found", arg2->value.str.val);
RETURN_FALSE;
Index: php4/ext/pdf/php_pdf.h
diff -u php4/ext/pdf/php_pdf.h:1.3 php4/ext/pdf/php_pdf.h:1.4
--- php4/ext/pdf/php_pdf.h:1.3 Thu Feb 10 02:20:29 2000
+++ php4/ext/pdf/php_pdf.h Tue Feb 15 00:10:32 2000
@@ -26,13 +26,17 @@
| Authors: Uwe Steinmann |
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdf.h,v 1.3 2000/02/10 10:20:29 steinm Exp $ */
+/* $Id: php_pdf.h,v 1.4 2000/02/15 08:10:32 steinm Exp $ */
#ifndef _PHP_PDF_H
#define _PHP_PDF_H
#if HAVE_PDFLIB
+/* with version 2.20 of pdflib PDF_open_mem isn't available unless
+ the following define isn't there.
+ #define PDF_OPEN_MEM_SUPPORTED
+*/
#include <pdflib.h>
extern int le_fp;