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)
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;
}
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;
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,