Skip to content

Commit 1ffed2e

Browse files
author
Ulf Wendel
committed
Added two new functions:
int pdf_get_minorversion() int pdf_get_majorversion() Both functions are taken from the C-Library. You should be able to determine the API version of the extension/library using pdf_get_value() or pdf_get_parameter() but these functions need a pdf object to work on. This means that you have to create an pdf object before you can find out the API version. Using pdf_get_minorversion() and pdf_get_majorversion() there's no need for this.
1 parent e140b35 commit 1ffed2e

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

ext/pdf/pdf.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ function_entry pdf_functions[] = {
8181
PHP_FE(pdf_close, NULL)
8282
PHP_FE(pdf_begin_page, NULL)
8383
PHP_FE(pdf_end_page, NULL)
84+
PHP_FE(pdf_get_majorversion, NULL)
85+
PHP_FE(pdf_get_minorversion, NULL)
8486
PHP_FE(pdf_get_value, NULL)
8587
PHP_FE(pdf_set_value, NULL)
8688
PHP_FE(pdf_get_parameter, NULL)
@@ -2245,6 +2247,29 @@ PHP_FUNCTION(pdf_new)
22452247

22462248
/* }}} */
22472249

2250+
/* {{{ proto int pdf_get_majorversion()
2251+
Returns the major version number of the PDFlib */
2252+
PHP_FUNCTION(pdf_get_majorversion)
2253+
{
2254+
if (ZEND_NUM_ARGS() != 0) {
2255+
WRONG_PARAM_COUNT;
2256+
}
2257+
2258+
RETURN_LONG(PDF_get_majorversion());
2259+
}
2260+
2261+
/* {{{ proto int pdf_get_minorversion()
2262+
Returns the minor version number of the PDFlib */
2263+
PHP_FUNCTION(pdf_get_minorversion)
2264+
{
2265+
if (ZEND_NUM_ARGS() != 0) {
2266+
WRONG_PARAM_COUNT;
2267+
}
2268+
2269+
RETURN_LONG(PDF_get_minorversion());
2270+
}
2271+
2272+
/* }}} */
22482273
/* {{{ proto void pdf_delete(int pdfdoc)
22492274
Deletes the PDF object */
22502275
PHP_FUNCTION(pdf_delete)

ext/pdf/php_pdf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ PHP_FUNCTION(pdf_get_buffer); /* new function */
4242
PHP_FUNCTION(pdf_close);
4343
PHP_FUNCTION(pdf_begin_page);
4444
PHP_FUNCTION(pdf_end_page);
45+
PHP_FUNCTION(pdf_get_majorversion);
46+
PHP_FUNCTION(pdf_get_minorversion);
4547
PHP_FUNCTION(pdf_get_value);
4648
PHP_FUNCTION(pdf_set_value);
4749
PHP_FUNCTION(pdf_get_parameter);

0 commit comments

Comments
 (0)