PDFPAGE_SetColorFill
IPDFDocument3 :: PDF page methods

See Also Example
Collapse All

This method sets the fill color to the specified color value.

Syntax

HRESULT PDFPAGE_SetColorFill (
DOUBLE colorComponent1,
DOUBLE colorComponent2,
DOUBLE colorComponent3,
DOUBLE colorComponent4
)
Parameters
colorComponent1
Value for the 1st color component

colorComponent2
Value for the 2nd color component

colorComponent3
Value for the 3rd color component

colorComponent4
Value for the 4th color component

Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.

Remarks

PDFPAGE_SetColorFill sets the fill color to the specified color value. Color values are interpreted using the current color mapping profile. Values should be in the range [0..1]. If the current color mapping profile is using less than 4 color components, then superfluous color components are ignored. (You can pass 0 for them.)

To convert an RGB color value to a valid parameter, use the following formula, where x is in the range [0..255]: x/255 -> [0..1]

Equivalent in new interface: IPDFDocument4::SetColorFill.

Example

Using the PDFPAGE_SetColorFill Method

Delphi
[copy to clipboard]
{ PDF object is supposed to be created                 }
PDF.BeginDoc;
PDF.PDFPAGE_SetDefaultCMYKColorSpace;
{ Replace line above with this one:                      }
{   PDF.PDFPAGE_SetDefaultRGBColorSpace                }
{ the CMYK color (0.7, 0.3, 0.8, 0.2) will be replaced }
{ by RGB color (0.7, 0.3, 0.8)                         }

PDF.PDFPAGE_SetColorFill(0.7, 0.3, 0.8, 0.2);
PDF.PDFPAGE_Rectangle(10, 10, 110, 110);
PDF.PDFPAGE_Fill;

PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
PDF->PDFPAGE_SetDefaultCMYKColorSpace();
// Replace line above with this one:
//   PDF->PDFPAGE_SetDefaultRGBColorSpace
// the CMYK color (0.7, 0.3, 0.8, 0.2) will be replaced
// by RGB color (0.7, 0.3, 0.8)

PDF->PDFPAGE_SetColorFill(0.7, 0.3, 0.8, 0.2);
PDF->PDFPAGE_Rectangle(10, 10, 110, 110);
PDF->PDFPAGE_Fill();

PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
PDF.PDFPAGE_SetDefaultCMYKColorSpace();
// Replace line above with this one:
//   PDF.PDFPAGE_SetDefaultRGBColorSpace
// the CMYK color (0.7, 0.3, 0.8, 0.2) will be replaced
// by RGB color (0.7, 0.3, 0.8)

PDF.PDFPAGE_SetColorFill(0.7, 0.3, 0.8, 0.2);
PDF.PDFPAGE_Rectangle(10, 10, 110, 110);
PDF.PDFPAGE_Fill();

PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
PDF.PDFPAGE_SetDefaultCMYKColorSpace
' Replace line above with this one:
'   PDF.PDFPAGE_SetDefaultRGBColorSpace
' the CMYK color (0.7, 0.3, 0.8, 0.2) will be replaced
' by RGB color (0.7, 0.3, 0.8)

PDF.PDFPAGE_SetColorFill 0.7, 0.3, 0.8, 0.2
PDF.PDFPAGE_Rectangle 10, 10, 110, 110
PDF.PDFPAGE_Fill

PDF.EndDoc

See Also

Reference