Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6358859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:26:34+00:00 2026-05-24T23:26:34+00:00

I am facing an abnormal problem when trying to write a rectangle with a

  • 0

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:
enter image description here

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:26:35+00:00Added an answer on May 24, 2026 at 11:26 pm

    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:

    $page->setFillColor(new Zend_Pdf_Color_Html('#cc0033'));
    $page->drawRectangle(40, 500, 560, 475);
    

    If you really want to go with Rgb check Zend_Pdf_Color_Rgb Documentation
    and Example page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing an abnormal problem in a site. Where when I was trying
I'm facing a real problem in understanding how to draw a variable diagram to
I am facing problem when comparing 2 strings values using C:When tag I am
Im facing a problem using the UIImagepicker. If i use the camera on my
I'm facing a problem while trying to create Checkboxes Dynamic in my application. The
I am facing some problem in playing multiple videos on iPAD. I am trying
i'm facing a kindof stupid problem: i'm not able to change the Foreground color
I am facing below errors when trying to statically link libDuma, Can you tell
I'm facing this abnormal situation. The following code doesn't work properly: string temp =
Facing some problem in setting up future date. Actually I m trying to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.