Hi,
I have written a fairly simple C# windows app that draws a background image then text on top of it.
I can not seem to set the font color to a "custom" color (RGB or CMYK) but the predefined colors work.
The custom colors appear black. I hope I'm missing something simple.
Any help is appreciated.
Thank you,
Joe
Code:
PdfDocument document = new PdfDocument();
// Create a new page
PdfPage page = document.AddPage();
page.Size = PageSize.Letter;
page.Orientation = PageOrientation.Portrait;
XGraphics gfx = XGraphics.FromPdfPage(page, XPageDirection.Downwards);
// Draw background
gfx.DrawImage(XImage.FromFile("Background.pdf"), 0, 0);
// Write on top of background with known colors
gfx.DrawString("Name", new XFont("Garamond", 12, XFontStyle.Regular), XBrushes.Firebrick, 100, 670, XStringFormats.TopLeft);
gfx.DrawString("Title", new XFont("Garamond", 10, XFontStyle.Italic), XBrushes.DodgerBlue, 100, 685, XStringFormats.TopLeft);
// Write on top of background with custom colors
// DOES NOT WORK, COMES OUT BLACK!!!!!!
gfx.DrawString("Phone", new XFont("Garamond", 12, XFontStyle.Regular), new XSolidBrush(XColor.FromCmyk(62, 28, 2, 3)), 100, 700, XStringFormats.TopLeft);
gfx.DrawString("Email", new XFont("Garamond", 10, XFontStyle.Regular), new XSolidBrush(XColor.FromCmyk(5, 95, 39, 16)), 100, 715, XStringFormats.TopLeft);
// Save the document...
document.Save("BackgroundWithText.pdf");