Pdf Color-class

Hello,

I was wondering, is it a lot of work to add a "getColor" function to the color-class ?

On i-series it's "impossible" to retrieve class-fields, so I can't use the pre-defined colors. If you provide a function that returns a color-object for a specified "color-name" this would be a great help !

Thanks,

Goddeau Hendrik

Dear Goddeau,

Thank you for considering Aspose.

Color name is supported. Please refer to Class Color | Aspose.PDF for .NET API Reference.

Hello again,

I'm having some troubles using this method :

received Java exception "java.lang.NumberFormatException: For input string:
"Red"" when calling method "" with signature "(Ljava.lang.String;)V"
in class "com.aspose.pdf.elements.RgbColorSpace".

It seemes there 's a quote to much ?!

Sorry I don’t know you are using Java version. In Java version only the names listed at Color | Aspose.PDF for Java API Reference are supported. You can use them like the following:

text1.getTextInfo().setTextColor(Color.Red);

Btw, you can refer to the ColorExample.java and ColorSpaceExample.java in the examples of Aspose.Pdf for Java.

Ok, but “Red” is one of the valid colors !

I tested text1.getTextInfo().setTextColor(Color.Red);
and no error is found. If you still can’t use Red color please provide your code that can reproduce this error.

I know this works, but as I mentioned at the beginning of this topic "I can't use class fields on iseries" !

In your example you use Color.red, where red is a field of class "Color".

I'm looking for a function that returns a color-object for a given color-name. I thought the rgbColorspace constructor would solve my problem, but I get an error (see previous messages).

Something like Color RedColor = getColor("Red") would help me a lot.

Thanks,

Goddeau H.

It seems that is not supported. I will discuss with the developer and we will try to support it soon.

Color.getColor() has been added into the new version 2.2.

Which colors are supported ?

I tested some (Maroon, Lime, Fuchsia, ... that work), but 'Blue' doesn't work !?

Thanks

Hi,

Could you please share your code that can reproduce this problem.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team

Hi,

I have logged this issue. We will try to fix it soon.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team

This issue has also been fixed in the attachment at http://www.aspose.com/Community/Forums/83769/ShowThread.aspx#83769.