I am facing an abnormal problem when trying to write a rectangle with a color in PDF using Zend_PDF as shown in the below diagram:

Code is as follow :
require_once 'Zend/Loader/Autoloader.php';
// register auto-loader
$loader = Zend_Loader_Autoloader::getInstance();
try
{
// create PDF
$pdf = new Zend_Pdf();
// create A4 page
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$page->setFillColor(new Zend_Pdf_Color_Rgb(133,185,13));
$page->drawRectangle(40, 500, 560, 475);
...........................
...........................
}
catch (Exception $e)
{
die('Application error: ' . $e->getMessage());
}
Issue :
Rectangle is their in the PDF But the color is not shown. Also I tried to change some color code. And I found that if any one of the color code[i.e. R/G/B] is set to 0 then only the color is shown in the PDF doc.
What may be the possible reason? Or I made any mistake?
Please help.!
Thanks In Advance
You are not using in the proper way Zend_Pdf_Color_Rgb
It get float for each of $r, $g, $b.
But will be a pain to figure it out the proper color using RGB anyway.
You can swich to HTML colors using this:
If you really want to go with Rgb check Zend_Pdf_Color_Rgb Documentation
and Example page