Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
Common
Collapse All

This method sets the specified ICC profile to which all colors will be transformed.

Syntax

HRESULT TransformColors (
BSTR colorspaceFile
)
Parameters
colorspaceFile
Path to the file containing a color space

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

Remarks

Only CMYK out profiles are supported.

Example

Transforming Colors

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }

{ PDF will use icc file to transform colors.                       }
{ But we override 2 colors to our custom values:                   }
{  CMYK color (0, 0, 0, 0) -> CMYK color (0, 0, 0, 1)              }
{  CMYK while color (1, 1, 1, 0) -> CMYK yellow color (0, 0, 1, 0) }
PDF.TransformColors('USWebUncoated.icc');
PDF.AddColorTransformationRule(0, 0, 0, 0, 0, 0, 0, 1);
PDF.AddColorTransformationRule(1, 1, 1, 0, 0, 0, 1, 0);

PDF.SetTextRenderingMode(trFillAndStroke);
PDF.SetColorFill(0, 0, 0, 0);
PDF.SetColorStroke(0, 0, 0, 0);
PDF.ShowText('Hello, PDF');
PDF.SetColorFill(1, 1, 1, 0);
PDF.SetColorStroke(1, 1, 1, 0);
PDF.ShowText(' Hello, PDF');
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created

// PDF will use icc file to transform colors.
// But we override 2 colors to our custom values:
//  CMYK color (0, 0, 0, 0) -> CMYK color (0, 0, 0, 1)
//  CMYK while color (1, 1, 1, 0) -> CMYK yellow color (0, 0, 1, 0)
PDF->TransformColors("USWebUncoated.icc");
PDF->AddColorTransformationRule(0, 0, 0, 0, 0, 0, 0, 1);
PDF->AddColorTransformationRule(1, 1, 1, 0, 0, 0, 1, 0);

PDF->SetTextRenderingMode(trFillAndStroke);
PDF->SetColorFill(0, 0, 0, 0);
PDF->SetColorStroke(0, 0, 0, 0);
PDF->ShowText("Hello, PDF");
PDF->SetColorFill(1, 1, 1, 0);
PDF->SetColorStroke(1, 1, 1, 0);
PDF->ShowText(" Hello, PDF");
PDF->SaveToFile("test.pdf", TRUE);
C#
[copy to clipboard]
// PDF object is supposed to be created

// PDF will use icc file to transform colors.
// But we override 2 colors to our custom values:
//  CMYK color (0, 0, 0, 0) -> CMYK color (0, 0, 0, 1)
//  CMYK while color (1, 1, 1, 0) -> CMYK yellow color (0, 0, 1, 0)
PDF.TransformColors("USWebUncoated.icc");
PDF.AddColorTransformationRule(0, 0, 0, 0, 0, 0, 0, 1);
PDF.AddColorTransformationRule(1, 1, 1, 0, 0, 0, 1, 0);

PDF.SetTextRenderingMode(TextRenderingMode.trFillAndStroke);
PDF.SetColorFill(0, 0, 0, 0);
PDF.SetColorStroke(0, 0, 0, 0);
PDF.ShowText("Hello, PDF");
PDF.SetColorFill(1, 1, 1, 0);
PDF.SetColorStroke(1, 1, 1, 0);
PDF.ShowText(" Hello, PDF");
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created

' PDF will use icc file to transform colors.
' But we override 2 colors to our custom values:
'  CMYK color (0, 0, 0, 0) -> CMYK color (0, 0, 0, 1)
'  CMYK while color (1, 1, 1, 0) -> CMYK yellow color (0, 0, 1, 0)
PDF.TransformColors "USWebUncoated.icc"
PDF.AddColorTransformationRule 0, 0, 0, 0, 0, 0, 0, 1
PDF.AddColorTransformationRule 1, 1, 1, 0, 0, 0, 1, 0

PDF.SetTextRenderingMode 2 'trFillAndStroke
PDF.SetColorFill 0, 0, 0, 0
PDF.SetColorStroke 0, 0, 0, 0
PDF.ShowText "Hello, PDF"
PDF.SetColorFill 1, 1, 1, 0
PDF.SetColorStroke 1, 1, 1, 0
PDF.ShowText " Hello, PDF"
PDF.SaveToFile "test.pdf", true

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots