Wednesday 9 March 2011

ezPDF - adding a horizontal rule

The ezPdf class for PHP is fairly basic, but none the worse for that. I found I couldn't get a Horizontal Rule to go below the text I'd just output, but it was very easy to write a function that would do it:

function ezHR($lineThickness){
//writes horizontal rule of given thickness, respecting left and right margins
$this->setLineStyle($lineThickness);
$y=$this->ezGetDy()-10;
$r=$this->ez['pageWidth']-$this->ez['rightMargin'];
$this->line($this->ez['leftMargin'],$y,$r,$y);
}


Add this to class.ezpdf.php and then call it with 
$pdf->ezHR(2);

Friday 4 March 2011

Troubleshooting php.exe when run from Task Scheduler

I looked high and low for ideas on how to keep open the output that flashes up when you run a php page using task manager (unless you write a bit of vbs to hide it entirely).

eg, when Task Scheduler runs:

C:\wamp\bin\php\php5.3.4\php.exe d:\test.php

how can you check to see whether there are errors in test.php? Obviously you could open as any other php page but what if the errors are only applicable to the page being called from Task Scheduler?

The nearest I have got is to open cmd.exe, and then paste in the command-line string.