Derick, Here are the patch files (printer.c.patch to be applied on printer.c and printer.php.patch to be applied on printer.php). In order to make settings effect, the printer_set_option($handle,PRINTER_SET_OPTIONS,0) should be called after send a series of settings. The third parameter in this case is ignored (but it must be supplied since I didn't change the way original printer_set_option() check parameters. I'd love to take a look on any problems my change might cause. Just mail me.
Regards, Tanes Sriviroolchai >From: Derick Rethans <[EMAIL PROTECTED]> TS> If you point me out where I can get latest sources in php4/ext/printer, I TS> would love to provide a patch for this problem. I don't know why source TS> codes of this module (printer) is not included in php distribution source TS> code. DR>It was moved to pear/PECL: DR> DR>http://cvs.php.net/cvs.php/pear/PECL/printer DR> DR>regards, DR>Derick _________________________________________________________________ Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com
*** org\printer.c Fri May 17 18:49:42 2002 --- printer.c Mon Aug 26 15:11:08 2002 *************** *** 17,22 **** --- 17,36 ---- +----------------------------------------------------------------------+ */ + /* + * Modified by Tanes Sriviroolchai + * On Aug 26, 2002 + * + * Modified function: printer_set_option() + * Reason: To make setting options working, the printer_set_option() must + * call Win32 API DocumentProperties() with DM_OUT_BUFFER | + * DM_IN_BUFFER in order for all settings in resource->device to + * be effected. Also, while setting parameters dmXXX in resource-> + * device, a bit mask resource->dmFields of correspondent setting + * should be set too. + * + */ + /* $Id: printer.c,v 1.23 2002/05/17 18:49:42 fmk Exp $ */ #ifdef HAVE_CONFIG_H *************** *** 146,151 **** --- 160,166 ---- #define TEXT_ALIGN 12 #define DEVICENAME 13 #define DRIVER_VERSION 14 + #define SET_OPTIONS 99 #define BRUSH_SOLID -1 #define BRUSH_CUSTOM -2 *************** *** 176,181 **** --- 191,197 ---- REGP_CONSTANT("PRINTER_TITLE", TITLE); REGP_CONSTANT("PRINTER_DEVICENAME", DEVICENAME); REGP_CONSTANT("PRINTER_DRIVERVERSION", DRIVER_VERSION); + REGP_CONSTANT("PRINTER_SET_OPTIONS", SET_OPTIONS); REGP_CONSTANT("PRINTER_RESOLUTION_Y", YRESOLUTION); REGP_CONSTANT("PRINTER_RESOLUTION_X", XRESOLUTION); REGP_CONSTANT("PRINTER_SCALE", SCALE); *************** *** 484,489 **** --- 500,506 ---- case COPIES: convert_to_long_ex(arg3); resource->device->dmCopies = (short)Z_LVAL_PP(arg3); + resource->device->dmFields |= DM_COPIES; break; case MODE: *************** *** 501,536 **** --- 518,560 ---- case ORIENTATION: convert_to_long_ex(arg3); resource->device->dmOrientation = (short)Z_LVAL_PP(arg3); + resource->device->dmFields |= DM_ORIENTATION; break; case YRESOLUTION: convert_to_long_ex(arg3); resource->device->dmYResolution = (short)Z_LVAL_PP(arg3); + resource->device->dmFields |= DM_YRESOLUTION; break; case XRESOLUTION: convert_to_long_ex(arg3); resource->device->dmPrintQuality= (short)Z_LVAL_PP(arg3); + resource->device->dmFields |= DM_PRINTQUALITY; break; case PAPER_FORMAT: convert_to_long_ex(arg3); resource->device->dmPaperSize = (short)Z_LVAL_PP(arg3); + resource->device->dmFields |= DM_PAPERSIZE; break; case PAPER_LENGTH: convert_to_long_ex(arg3); resource->device->dmPaperLength = Z_LVAL_PP(arg3) * 10; + resource->device->dmFields |= DM_PAPERLENGTH; break; case PAPER_WIDTH: convert_to_long_ex(arg3); resource->device->dmPaperWidth = Z_LVAL_PP(arg3) * 10; + resource->device->dmFields |= DM_PAPERWIDTH; break; case SCALE: convert_to_long_ex(arg3); resource->device->dmScale = (short)Z_LVAL_PP(arg3); + resource->device->dmFields |= DM_SCALE; break; case BG_COLOR: *************** *** 548,553 **** --- 572,588 ---- SetTextAlign(resource->dc, Z_LVAL_PP(arg3)); break; + case SET_OPTIONS: + DocumentProperties(NULL, resource->handle, resource->name, resource->device, resource->device, DM_OUT_BUFFER | DM_IN_BUFFER); + + if( resource->dc != NULL ) { + php_error(E_NOTICE, "Deleting old DeviceContext in +order for new settings to be effective"); + DeleteDC(resource->dc); + } + + resource->dc = CreateDC(NULL, resource->name, NULL, +resource->device); + break; + default: php_error(E_WARNING,"unknown option passed to printer_set_option()"); RETURN_FALSE;
*** org\printer.php Thu Apr 5 12:36:00 2001 --- printer.php Mon Aug 26 15:33:34 2002 *************** *** 1,6 **** --- 1,11 ---- <?php $handle = printer_open(); + printer_set_option( $handle, PRINTER_ORIENTATION, PRINTER_ORIENTATION_LANSCAPE ); + printer_set_option( $handle, PRINTER_COPIES, 2 ); + printer_set_option( $handle, PRINTER_SET_OPTIONS, 0 ); + + printer_start_doc($handle, "PHP Test"); printer_start_page($handle);
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php