locked
The name 'Color' does not exist in the current context_ RRS feed

  • Question

  • User1472402676 posted

    I am using itextsharp dll for creating pdf. 

    I want to change my fond color. I found solution  in internet 

     FontFactory.GetFont("Arial", 28, Color.RED)

    But I try to my source code. It's show's an error The name 'Color' does not exist in the current context. Color class not fond. How to solve this error.

    Thank you.

    Tuesday, March 31, 2015 3:15 AM

Answers

  • User-1716253493 posted

    Try adding using

    using iTextSharp.text;

    Then use BaseColor.RED

    or change to

    iTextSharp.text.BaseColor.RED

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 31, 2015 4:16 AM

All replies

  • User-1716253493 posted

    Try change it to System.Drawing.Color.Red

    Tuesday, March 31, 2015 3:18 AM
  • User1472402676 posted

    Hi oned_gk,

    I am also try but not working System.Drawing.Color.Red.

    GetFont method need Basecolor.  

    Tuesday, March 31, 2015 3:27 AM
  • User-821857111 posted

    There is a problem somewhere else in your code. The Color class is in the same namespace as the FontFactory class, so they both should resolve or neither of them should. Do you have

    using iTextSharp.text;

    at the top of the file? If yes, can you show more of your code?

    Tuesday, March 31, 2015 3:29 AM
  • User1472402676 posted

    Hi Mikesdotnett..,

    Ya. Iam import iTextSharp.text; and iTextSharp.text.pdf this two namespace.

    Tuesday, March 31, 2015 3:37 AM
  • User1472402676 posted

    Any problem in my iTextSharp dll. My itextSharp dll size is 3.58MB

    Tuesday, March 31, 2015 3:41 AM
  • User-821857111 posted

    My itextSharp dll size is 3.58MB
    No - that seems about right. As I said, the problem must be somewhere else in your code.

    Tuesday, March 31, 2015 3:55 AM
  • User-1716253493 posted

    Try adding using

    using iTextSharp.text;

    Then use BaseColor.RED

    or change to

    iTextSharp.text.BaseColor.RED

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 31, 2015 4:16 AM
  • User1472402676 posted

    Thank you  oned_gk. It, work fine.( BaseColor)

    Try adding using

    using iTextSharp.text;

    Then use BaseColor.RED

    or change to

    iTextSharp.text.BaseColor.RED

    Tuesday, March 31, 2015 4:33 AM