Ejemplo n.º 1
0
        private static void DrawShadings(PdfPage page, PdfFont titleFont, PdfFont sectionFont)
        {
            PdfBrush brush    = new PdfBrush();
            PdfPen   blackPen = new PdfPen(PdfRgbColor.Black, 1);

            PdfRgbColor randomPenColor   = new PdfRgbColor();
            PdfPen      randomPen        = new PdfPen(randomPenColor, 1);
            PdfRgbColor randomBrushColor = new PdfRgbColor();
            PdfBrush    randomBrush      = new PdfBrush(randomBrushColor);

            page.Graphics.DrawString("Shadings", titleFont, brush, 20, 50);

            page.Graphics.DrawString("Horizontal", sectionFont, brush, 25, 70);

            PdfAxialShading horizontalShading = new PdfAxialShading();

            horizontalShading.StartColor = new PdfRgbColor(255, 0, 0);
            horizontalShading.EndColor   = new PdfRgbColor(0, 0, 255);
            horizontalShading.StartPoint = new PdfPoint(25, 90);
            horizontalShading.EndPoint   = new PdfPoint(175, 90);

            // Clip the shading to desired area.
            PdfPath hsArea = new PdfPath();

            hsArea.AddRectangle(25, 90, 150, 150);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(hsArea);
            page.Graphics.DrawShading(horizontalShading);
            page.Graphics.RestoreGraphicsState();

            page.Graphics.DrawString("Vertical", sectionFont, brush, 225, 70);

            PdfAxialShading verticalShading = new PdfAxialShading();

            verticalShading.StartColor = new PdfRgbColor(255, 0, 0);
            verticalShading.EndColor   = new PdfRgbColor(0, 0, 255);
            verticalShading.StartPoint = new PdfPoint(225, 90);
            verticalShading.EndPoint   = new PdfPoint(225, 240);

            // Clip the shading to desired area.
            PdfPath vsArea = new PdfPath();

            vsArea.AddRectangle(225, 90, 150, 150);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(vsArea);
            page.Graphics.DrawShading(verticalShading);
            page.Graphics.RestoreGraphicsState();

            page.Graphics.DrawString("Diagonal", sectionFont, brush, 425, 70);

            PdfAxialShading diagonalShading = new PdfAxialShading();

            diagonalShading.StartColor = new PdfRgbColor(255, 0, 0);
            diagonalShading.EndColor   = new PdfRgbColor(0, 0, 255);
            diagonalShading.StartPoint = new PdfPoint(425, 90);
            diagonalShading.EndPoint   = new PdfPoint(575, 240);

            // Clip the shading to desired area.
            PdfPath dsArea = new PdfPath();

            dsArea.AddRectangle(425, 90, 150, 150);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(dsArea);
            page.Graphics.DrawShading(diagonalShading);
            page.Graphics.RestoreGraphicsState();

            page.Graphics.DrawString("Extended shading", sectionFont, brush, 25, 260);

            PdfAxialShading extendedShading = new PdfAxialShading();

            extendedShading.StartColor  = new PdfRgbColor(255, 0, 0);
            extendedShading.EndColor    = new PdfRgbColor(0, 0, 255);
            extendedShading.StartPoint  = new PdfPoint(225, 280);
            extendedShading.EndPoint    = new PdfPoint(375, 280);
            extendedShading.ExtendStart = true;
            extendedShading.ExtendEnd   = true;

            // Clip the shading to desired area.
            PdfPath esArea = new PdfPath();

            esArea.AddRectangle(25, 280, 550, 30);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(esArea);
            page.Graphics.DrawShading(extendedShading);
            page.Graphics.RestoreGraphicsState();
            page.Graphics.DrawPath(blackPen, esArea);

            page.Graphics.DrawString("Limited shading", sectionFont, brush, 25, 330);

            PdfAxialShading limitedShading = new PdfAxialShading();

            limitedShading.StartColor  = new PdfRgbColor(255, 0, 0);
            limitedShading.EndColor    = new PdfRgbColor(0, 0, 255);
            limitedShading.StartPoint  = new PdfPoint(225, 350);
            limitedShading.EndPoint    = new PdfPoint(375, 350);
            limitedShading.ExtendStart = false;
            limitedShading.ExtendEnd   = false;

            // Clip the shading to desired area.
            PdfPath lsArea = new PdfPath();

            lsArea.AddRectangle(25, 350, 550, 30);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(lsArea);
            page.Graphics.DrawShading(limitedShading);
            page.Graphics.RestoreGraphicsState();
            page.Graphics.DrawPath(blackPen, lsArea);

            page.Graphics.DrawString("Multi-stop shading", sectionFont, brush, 25, 400);
            // Multi-stop shadings use a stitching function to combine the functions that define each gradient part.
            // Function for red to blue shading.
            PdfExponentialFunction redToBlueFunc = new PdfExponentialFunction();

            // Linear function
            redToBlueFunc.Exponent = 1;
            redToBlueFunc.Domain   = new double[] { 0, 1 };
            // Red color for start
            redToBlueFunc.C0 = new double[] { 1, 0, 0 };
            // Blue color for start
            redToBlueFunc.C1 = new double[] { 0, 0, 1 };
            // Function for blue to green shading.
            PdfExponentialFunction blueToGreenFunc = new PdfExponentialFunction();

            // Linear function
            blueToGreenFunc.Exponent = 1;
            blueToGreenFunc.Domain   = new double[] { 0, 1 };
            // Blue color for start
            blueToGreenFunc.C0 = new double[] { 0, 0, 1 };
            // Green color for start
            blueToGreenFunc.C1 = new double[] { 0, 1, 0 };

            //Stitching function for the shading.
            PdfStitchingFunction shadingFunction = new PdfStitchingFunction();

            shadingFunction.Functions.Add(redToBlueFunc);
            shadingFunction.Functions.Add(blueToGreenFunc);
            shadingFunction.Domain = new double[] { 0, 1 };
            shadingFunction.Encode = new double[] { 0, 1, 0, 1 };

            // Entire shading goes from 0 to 1 (100%).
            // We set the first shading (red->blue) to cover 30% (0 - 0.3) and
            // the second shading to cover 70% (0.3 - 1).
            shadingFunction.Bounds = new double[] { 0.3 };
            // The multistop shading
            PdfAxialShading multiStopShading = new PdfAxialShading();

            multiStopShading.StartPoint = new PdfPoint(25, 420);
            multiStopShading.EndPoint   = new PdfPoint(575, 420);
            // The colorspace must match the colors specified in C0 & C1
            multiStopShading.ColorSpace = new PdfRgbColorSpace();
            multiStopShading.Function   = shadingFunction;

            // Clip the shading to desired area.
            PdfPath mssArea = new PdfPath();

            mssArea.AddRectangle(25, 420, 550, 30);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(mssArea);
            page.Graphics.DrawShading(multiStopShading);
            page.Graphics.RestoreGraphicsState();
            page.Graphics.DrawPath(blackPen, lsArea);

            page.Graphics.DrawString("Radial shading", sectionFont, brush, 25, 470);

            PdfRadialShading rs1 = new PdfRadialShading();

            rs1.StartColor        = new PdfRgbColor(0, 255, 0);
            rs1.EndColor          = new PdfRgbColor(255, 0, 255);
            rs1.StartCircleCenter = new PdfPoint(50, 500);
            rs1.StartCircleRadius = 10;
            rs1.EndCircleCenter   = new PdfPoint(500, 570);
            rs1.EndCircleRadius   = 100;

            page.Graphics.DrawShading(rs1);

            PdfRadialShading rs2 = new PdfRadialShading();

            rs2.StartColor        = new PdfRgbColor(0, 255, 0);
            rs2.EndColor          = new PdfRgbColor(255, 0, 255);
            rs2.StartCircleCenter = new PdfPoint(80, 600);
            rs2.StartCircleRadius = 10;
            rs2.EndCircleCenter   = new PdfPoint(110, 690);
            rs2.EndCircleRadius   = 100;

            page.Graphics.DrawShading(rs2);

            page.Graphics.CompressAndClose();
        }
Ejemplo n.º 2
0
        private static void DrawShadings(PdfPage page, PdfFont titleFont, PdfFont sectionFont)
        {
            PdfBrush brush = new PdfBrush();
            PdfPen blackPen = new PdfPen(PdfRgbColor.Black, 1);

            PdfRgbColor randomPenColor = new PdfRgbColor();
            PdfPen randomPen = new PdfPen(randomPenColor, 1);
            PdfRgbColor randomBrushColor = new PdfRgbColor();
            PdfBrush randomBrush = new PdfBrush(randomBrushColor);

            page.Graphics.DrawString("Shadings", titleFont, brush, 20, 50);

            page.Graphics.DrawString("Horizontal", sectionFont, brush, 25, 70);

            PdfAxialShading horizontalShading = new PdfAxialShading();
            horizontalShading.StartColor = new PdfRgbColor(255, 0, 0);
            horizontalShading.EndColor = new PdfRgbColor(0, 0, 255);
            horizontalShading.StartPoint = new PdfPoint(25, 90);
            horizontalShading.EndPoint = new PdfPoint(175, 90);

            // Clip the shading to desired area.
            PdfPath hsArea = new PdfPath();
            hsArea.AddRectangle(25, 90, 150, 150);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(hsArea);
            page.Graphics.DrawShading(horizontalShading);
            page.Graphics.RestoreGraphicsState();

            page.Graphics.DrawString("Vertical", sectionFont, brush, 225, 70);

            PdfAxialShading verticalShading = new PdfAxialShading();
            verticalShading.StartColor = new PdfRgbColor(255, 0, 0);
            verticalShading.EndColor = new PdfRgbColor(0, 0, 255);
            verticalShading.StartPoint = new PdfPoint(225, 90);
            verticalShading.EndPoint = new PdfPoint(225, 240);

            // Clip the shading to desired area.
            PdfPath vsArea = new PdfPath();
            vsArea.AddRectangle(225, 90, 150, 150);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(vsArea);
            page.Graphics.DrawShading(verticalShading);
            page.Graphics.RestoreGraphicsState();

            page.Graphics.DrawString("Diagonal", sectionFont, brush, 425, 70);

            PdfAxialShading diagonalShading = new PdfAxialShading();
            diagonalShading.StartColor = new PdfRgbColor(255, 0, 0);
            diagonalShading.EndColor = new PdfRgbColor(0, 0, 255);
            diagonalShading.StartPoint = new PdfPoint(425, 90);
            diagonalShading.EndPoint = new PdfPoint(575, 240);

            // Clip the shading to desired area.
            PdfPath dsArea = new PdfPath();
            dsArea.AddRectangle(425, 90, 150, 150);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(dsArea);
            page.Graphics.DrawShading(diagonalShading);
            page.Graphics.RestoreGraphicsState();

            page.Graphics.DrawString("Extended shading", sectionFont, brush, 25, 260);

            PdfAxialShading extendedShading = new PdfAxialShading();
            extendedShading.StartColor = new PdfRgbColor(255, 0, 0);
            extendedShading.EndColor = new PdfRgbColor(0, 0, 255);
            extendedShading.StartPoint = new PdfPoint(225, 280);
            extendedShading.EndPoint = new PdfPoint(375, 280);
            extendedShading.ExtendStart = true;
            extendedShading.ExtendEnd = true;

            // Clip the shading to desired area.
            PdfPath esArea = new PdfPath();
            esArea.AddRectangle(25, 280, 550, 30);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(esArea);
            page.Graphics.DrawShading(extendedShading);
            page.Graphics.RestoreGraphicsState();
            page.Graphics.DrawPath(blackPen, esArea);

            page.Graphics.DrawString("Limited shading", sectionFont, brush, 25, 330);

            PdfAxialShading limitedShading = new PdfAxialShading();
            limitedShading.StartColor = new PdfRgbColor(255, 0, 0);
            limitedShading.EndColor = new PdfRgbColor(0, 0, 255);
            limitedShading.StartPoint = new PdfPoint(225, 350);
            limitedShading.EndPoint = new PdfPoint(375, 350);
            limitedShading.ExtendStart = false;
            limitedShading.ExtendEnd = false;

            // Clip the shading to desired area.
            PdfPath lsArea = new PdfPath();
            lsArea.AddRectangle(25, 350, 550, 30);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(lsArea);
            page.Graphics.DrawShading(limitedShading);
            page.Graphics.RestoreGraphicsState();
            page.Graphics.DrawPath(blackPen, lsArea);

            page.Graphics.DrawString("Multi-stop shading", sectionFont, brush, 25, 400);
            // Multi-stop shadings use a stitching function to combine the functions that define each gradient part.
            // Function for red to blue shading.
            PdfExponentialFunction redToBlueFunc = new PdfExponentialFunction();
            // Linear function
            redToBlueFunc.Exponent = 1;
            redToBlueFunc.Domain = new double[] { 0, 1 };
            // Red color for start
            redToBlueFunc.C0 = new double[] { 1, 0, 0 };
            // Blue color for start
            redToBlueFunc.C1 = new double[] { 0, 0, 1 };
            // Function for blue to green shading.
            PdfExponentialFunction blueToGreenFunc = new PdfExponentialFunction();
            // Linear function
            blueToGreenFunc.Exponent = 1;
            blueToGreenFunc.Domain = new double[] { 0, 1 };
            // Blue color for start
            blueToGreenFunc.C0 = new double[] { 0, 0, 1 };
            // Green color for start
            blueToGreenFunc.C1 = new double[] { 0, 1, 0 };

            //Stitching function for the shading.
            PdfStitchingFunction shadingFunction = new PdfStitchingFunction();
            shadingFunction.Functions.Add(redToBlueFunc);
            shadingFunction.Functions.Add(blueToGreenFunc);
            shadingFunction.Domain = new double[] { 0, 1 };
            shadingFunction.Encode = new double[] { 0, 1, 0, 1 };

            // Entire shading goes from 0 to 1 (100%).
            // We set the first shading (red->blue) to cover 30% (0 - 0.3) and
            // the second shading to cover 70% (0.3 - 1).
            shadingFunction.Bounds = new double[] { 0.3 };
            // The multistop shading
            PdfAxialShading multiStopShading = new PdfAxialShading();
            multiStopShading.StartPoint = new PdfPoint(25, 420);
            multiStopShading.EndPoint = new PdfPoint(575, 420);
            // The colorspace must match the colors specified in C0 & C1
            multiStopShading.ColorSpace = new PdfRgbColorSpace();
            multiStopShading.Function = shadingFunction;

            // Clip the shading to desired area.
            PdfPath mssArea = new PdfPath();
            mssArea.AddRectangle(25, 420, 550, 30);
            page.Graphics.SaveGraphicsState();
            page.Graphics.SetClip(mssArea);
            page.Graphics.DrawShading(multiStopShading);
            page.Graphics.RestoreGraphicsState();
            page.Graphics.DrawPath(blackPen, lsArea);

            page.Graphics.DrawString("Radial shading", sectionFont, brush, 25, 470);

            PdfRadialShading rs1 = new PdfRadialShading();
            rs1.StartColor = new PdfRgbColor(0, 255, 0);
            rs1.EndColor = new PdfRgbColor(255, 0, 255);
            rs1.StartCircleCenter = new PdfPoint(50, 500);
            rs1.StartCircleRadius = 10;
            rs1.EndCircleCenter = new PdfPoint(500, 570);
            rs1.EndCircleRadius = 100;

            page.Graphics.DrawShading(rs1);

            PdfRadialShading rs2 = new PdfRadialShading();
            rs2.StartColor = new PdfRgbColor(0, 255, 0);
            rs2.EndColor = new PdfRgbColor(255, 0, 255);
            rs2.StartCircleCenter = new PdfPoint(80, 600);
            rs2.StartCircleRadius = 10;
            rs2.EndCircleCenter = new PdfPoint(110, 690);
            rs2.EndCircleRadius = 100;

            page.Graphics.DrawShading(rs2);

            page.Graphics.CompressAndClose();
        }
Ejemplo n.º 3
0
        private static void DrawColorsAndColorSpaces(PdfPage page, PdfFont titleFont, PdfFont sectionFont, Stream iccStream)
        {
            PdfBrush brush = new PdfBrush();

            page.Graphics.DrawString("Colors and colorspaces", titleFont, brush, 20, 50);

            page.Graphics.DrawString("DeviceRGB", sectionFont, brush, 20, 70);
            PdfPen   rgbPen   = new PdfPen(PdfRgbColor.DarkRed, 4);
            PdfBrush rgbBrush = new PdfBrush(PdfRgbColor.LightGoldenrodYellow);

            page.Graphics.DrawRectangle(rgbPen, rgbBrush, 20, 85, 250, 100);

            page.Graphics.DrawString("DeviceCMYK", sectionFont, brush, 340, 70);
            PdfPen   cmykPen   = new PdfPen(new PdfCmykColor(1, 0.5, 0, 0.1), 4);
            PdfBrush cmykBrush = new PdfBrush(new PdfCmykColor(0, 0.5, 0.43, 0));

            page.Graphics.DrawRectangle(cmykPen, cmykBrush, 340, 85, 250, 100);

            page.Graphics.DrawString("DeviceGray", sectionFont, brush, 20, 200);
            PdfPen   grayPen   = new PdfPen(new PdfGrayColor(0.1), 4);
            PdfBrush grayBrush = new PdfBrush(new PdfGrayColor(0.75));

            page.Graphics.DrawRectangle(grayPen, grayBrush, 20, 215, 250, 100);

            page.Graphics.DrawString("Indexed", sectionFont, brush, 340, 200);
            PdfIndexedColorSpace indexedColorSpace = new PdfIndexedColorSpace();

            indexedColorSpace.ColorCount     = 2;
            indexedColorSpace.BaseColorSpace = new PdfRgbColorSpace();
            indexedColorSpace.ColorTable     = new byte[] { 192, 0, 0, 0, 0, 128 };
            PdfIndexedColor indexedColor0 = new PdfIndexedColor(indexedColorSpace);

            indexedColor0.ColorIndex = 0;
            PdfIndexedColor indexedColor1 = new PdfIndexedColor(indexedColorSpace);

            indexedColor1.ColorIndex = 1;
            PdfPen   indexedPen   = new PdfPen(indexedColor0, 4);
            PdfBrush indexedBrush = new PdfBrush(indexedColor1);

            page.Graphics.DrawRectangle(indexedPen, indexedBrush, 340, 215, 250, 100);

            page.Graphics.DrawString("CalGray", sectionFont, brush, 20, 330);
            PdfCalGrayColorSpace calGrayColorSpace = new PdfCalGrayColorSpace();
            PdfCalGrayColor      calGrayColor1     = new PdfCalGrayColor(calGrayColorSpace);

            calGrayColor1.Gray = 0.6;
            PdfCalGrayColor calGrayColor2 = new PdfCalGrayColor(calGrayColorSpace);

            calGrayColor2.Gray = 0.2;
            PdfPen   calGrayPen   = new PdfPen(calGrayColor1, 4);
            PdfBrush calGrayBrush = new PdfBrush(calGrayColor2);

            page.Graphics.DrawRectangle(calGrayPen, calGrayBrush, 20, 345, 250, 100);

            page.Graphics.DrawString("CalRGB", sectionFont, brush, 340, 330);
            PdfCalRgbColorSpace calRgbColorSpace = new PdfCalRgbColorSpace();
            PdfCalRgbColor      calRgbColor1     = new PdfCalRgbColor(calRgbColorSpace);

            calRgbColor1.Red   = 0.1;
            calRgbColor1.Green = 0.5;
            calRgbColor1.Blue  = 0.25;
            PdfCalRgbColor calRgbColor2 = new PdfCalRgbColor(calRgbColorSpace);

            calRgbColor2.Red   = 0.6;
            calRgbColor2.Green = 0.1;
            calRgbColor2.Blue  = 0.9;
            PdfPen   calRgbPen   = new PdfPen(calRgbColor1, 4);
            PdfBrush calRgbBrush = new PdfBrush(calRgbColor2);

            page.Graphics.DrawRectangle(calRgbPen, calRgbBrush, 340, 345, 250, 100);

            page.Graphics.DrawString("L*a*b", sectionFont, brush, 20, 460);
            PdfLabColorSpace labColorSpace = new PdfLabColorSpace();
            PdfLabColor      labColor1     = new PdfLabColor(labColorSpace);

            labColor1.L = 90;
            labColor1.A = -40;
            labColor1.B = 120;
            PdfLabColor labColor2 = new PdfLabColor(labColorSpace);

            labColor2.L = 45;
            labColor2.A = 90;
            labColor2.B = -34;
            PdfPen   labPen   = new PdfPen(labColor1, 4);
            PdfBrush labBrush = new PdfBrush(labColor2);

            page.Graphics.DrawRectangle(labPen, labBrush, 20, 475, 250, 100);

            page.Graphics.DrawString("Icc", sectionFont, brush, 340, 460);
            PdfIccColorSpace iccColorSpace = new PdfIccColorSpace();

            byte[] iccData = new byte[iccStream.Length];
            iccStream.Read(iccData, 0, iccData.Length);
            iccColorSpace.IccProfile          = iccData;
            iccColorSpace.AlternateColorSpace = new PdfRgbColorSpace();
            iccColorSpace.ColorComponents     = 3;
            PdfIccColor iccColor1 = new PdfIccColor(iccColorSpace);

            iccColor1.ColorComponents = new double[] { 0.45, 0.1, 0.22 };
            PdfIccColor iccColor2 = new PdfIccColor(iccColorSpace);

            iccColor2.ColorComponents = new double[] { 0.21, 0.76, 0.31 };
            PdfPen   iccPen   = new PdfPen(iccColor1, 4);
            PdfBrush iccBrush = new PdfBrush(iccColor2);

            page.Graphics.DrawRectangle(iccPen, iccBrush, 340, 475, 250, 100);

            page.Graphics.DrawString("Separation", sectionFont, brush, 20, 590);
            PdfExponentialFunction tintTransform = new PdfExponentialFunction();

            tintTransform.Domain   = new double[] { 0, 1 };
            tintTransform.Range    = new double[] { 0, 1, 0, 1, 0, 1, 0, 1 };
            tintTransform.Exponent = 1;
            tintTransform.C0       = new double[] { 0, 0, 0, 0 };
            tintTransform.C1       = new double[] { 1, 0.5, 0, 0.1 };

            PdfSeparationColorSpace separationColorSpace = new PdfSeparationColorSpace();

            separationColorSpace.AlternateColorSpace = new PdfCmykColorSpace();
            separationColorSpace.Colorant            = "Custom Blue";
            separationColorSpace.TintTransform       = tintTransform;

            PdfSeparationColor separationColor1 = new PdfSeparationColor(separationColorSpace);

            separationColor1.Tint = 0.23;
            PdfSeparationColor separationColor2 = new PdfSeparationColor(separationColorSpace);

            separationColor2.Tint = 0.74;

            PdfPen   separationPen   = new PdfPen(separationColor1, 4);
            PdfBrush separationBrush = new PdfBrush(separationColor2);

            page.Graphics.DrawRectangle(separationPen, separationBrush, 20, 605, 250, 100);

            page.Graphics.DrawString("Pantone", sectionFont, brush, 340, 590);
            PdfPen   pantonePen   = new PdfPen(PdfPantoneColor.ReflexBlue, 4);
            PdfBrush pantoneBrush = new PdfBrush(PdfPantoneColor.RhodamineRed);

            page.Graphics.DrawRectangle(pantonePen, pantoneBrush, 340, 605, 250, 100);

            page.Graphics.CompressAndClose();
        }
Ejemplo n.º 4
0
        private static void DrawColorsAndColorSpaces(PdfPage page, PdfFont titleFont, PdfFont sectionFont, Stream iccStream)
        {
            PdfBrush brush = new PdfBrush();

            page.Graphics.DrawString("Colors and colorspaces", titleFont, brush, 20, 50);

            page.Graphics.DrawString("DeviceRGB", sectionFont, brush, 20, 70);
            PdfPen rgbPen = new PdfPen(PdfRgbColor.DarkRed, 4);
            PdfBrush rgbBrush = new PdfBrush(PdfRgbColor.LightGoldenrodYellow);
            page.Graphics.DrawRectangle(rgbPen, rgbBrush, 20, 85, 250, 100);

            page.Graphics.DrawString("DeviceCMYK", sectionFont, brush, 340, 70);
            PdfPen cmykPen = new PdfPen(new PdfCmykColor(1, 0.5, 0, 0.1), 4);
            PdfBrush cmykBrush = new PdfBrush(new PdfCmykColor(0, 0.5, 0.43, 0));
            page.Graphics.DrawRectangle(cmykPen, cmykBrush, 340, 85, 250, 100);

            page.Graphics.DrawString("DeviceGray", sectionFont, brush, 20, 200);
            PdfPen grayPen = new PdfPen(new PdfGrayColor(0.1), 4);
            PdfBrush grayBrush = new PdfBrush(new PdfGrayColor(0.75));
            page.Graphics.DrawRectangle(grayPen, grayBrush, 20, 215, 250, 100);

            page.Graphics.DrawString("Indexed", sectionFont, brush, 340, 200);
            PdfIndexedColorSpace indexedColorSpace = new PdfIndexedColorSpace();
            indexedColorSpace.ColorCount = 2;
            indexedColorSpace.BaseColorSpace = new PdfRgbColorSpace();
            indexedColorSpace.ColorTable = new byte[] { 192, 0, 0, 0, 0, 128 };
            PdfIndexedColor indexedColor0 = new PdfIndexedColor(indexedColorSpace);
            indexedColor0.ColorIndex = 0;
            PdfIndexedColor indexedColor1 = new PdfIndexedColor(indexedColorSpace);
            indexedColor1.ColorIndex = 1;
            PdfPen indexedPen = new PdfPen(indexedColor0, 4);
            PdfBrush indexedBrush = new PdfBrush(indexedColor1);
            page.Graphics.DrawRectangle(indexedPen, indexedBrush, 340, 215, 250, 100);

            page.Graphics.DrawString("CalGray", sectionFont, brush, 20, 330);
            PdfCalGrayColorSpace calGrayColorSpace = new PdfCalGrayColorSpace();
            PdfCalGrayColor calGrayColor1 = new PdfCalGrayColor(calGrayColorSpace);
            calGrayColor1.Gray = 0.6;
            PdfCalGrayColor calGrayColor2 = new PdfCalGrayColor(calGrayColorSpace);
            calGrayColor2.Gray = 0.2;
            PdfPen calGrayPen = new PdfPen(calGrayColor1, 4);
            PdfBrush calGrayBrush = new PdfBrush(calGrayColor2);
            page.Graphics.DrawRectangle(calGrayPen, calGrayBrush, 20, 345, 250, 100);

            page.Graphics.DrawString("CalRGB", sectionFont, brush, 340, 330);
            PdfCalRgbColorSpace calRgbColorSpace = new PdfCalRgbColorSpace();
            PdfCalRgbColor calRgbColor1 = new PdfCalRgbColor(calRgbColorSpace);
            calRgbColor1.Red = 0.1;
            calRgbColor1.Green = 0.5;
            calRgbColor1.Blue = 0.25;
            PdfCalRgbColor calRgbColor2 = new PdfCalRgbColor(calRgbColorSpace);
            calRgbColor2.Red = 0.6;
            calRgbColor2.Green = 0.1;
            calRgbColor2.Blue = 0.9;
            PdfPen calRgbPen = new PdfPen(calRgbColor1, 4);
            PdfBrush calRgbBrush = new PdfBrush(calRgbColor2);
            page.Graphics.DrawRectangle(calRgbPen, calRgbBrush, 340, 345, 250, 100);

            page.Graphics.DrawString("L*a*b", sectionFont, brush, 20, 460);
            PdfLabColorSpace labColorSpace = new PdfLabColorSpace();
            PdfLabColor labColor1 = new PdfLabColor(labColorSpace);
            labColor1.L = 90;
            labColor1.A = -40;
            labColor1.B = 120;
            PdfLabColor labColor2 = new PdfLabColor(labColorSpace);
            labColor2.L = 45;
            labColor2.A = 90;
            labColor2.B = -34;
            PdfPen labPen = new PdfPen(labColor1, 4);
            PdfBrush labBrush = new PdfBrush(labColor2);
            page.Graphics.DrawRectangle(labPen, labBrush, 20, 475, 250, 100);

            page.Graphics.DrawString("Icc", sectionFont, brush, 340, 460);
            PdfIccColorSpace iccColorSpace = new PdfIccColorSpace();
            byte[] iccData = new byte[iccStream.Length];
            iccStream.Read(iccData, 0, iccData.Length);
            iccColorSpace.IccProfile = iccData;
            iccColorSpace.AlternateColorSpace = new PdfRgbColorSpace();
            iccColorSpace.ColorComponents = 3;
            PdfIccColor iccColor1 = new PdfIccColor(iccColorSpace);
            iccColor1.ColorComponents = new double[] { 0.45, 0.1, 0.22 };
            PdfIccColor iccColor2 = new PdfIccColor(iccColorSpace);
            iccColor2.ColorComponents = new double[] { 0.21, 0.76, 0.31 };
            PdfPen iccPen = new PdfPen(iccColor1, 4);
            PdfBrush iccBrush = new PdfBrush(iccColor2);
            page.Graphics.DrawRectangle(iccPen, iccBrush, 340, 475, 250, 100);

            page.Graphics.DrawString("Separation", sectionFont, brush, 20, 590);
            PdfExponentialFunction tintTransform = new PdfExponentialFunction();
            tintTransform.Domain = new double[] { 0, 1 };
            tintTransform.Range = new double[] { 0, 1, 0, 1, 0, 1, 0, 1 };
            tintTransform.Exponent = 1;
            tintTransform.C0 = new double[] { 0, 0, 0, 0 };
            tintTransform.C1 = new double[] { 1, 0.5, 0, 0.1 };

            PdfSeparationColorSpace separationColorSpace = new PdfSeparationColorSpace();
            separationColorSpace.AlternateColorSpace = new PdfCmykColorSpace();
            separationColorSpace.Colorant = "Custom Blue";
            separationColorSpace.TintTransform = tintTransform;

            PdfSeparationColor separationColor1 = new PdfSeparationColor(separationColorSpace);
            separationColor1.Tint = 0.23;
            PdfSeparationColor separationColor2 = new PdfSeparationColor(separationColorSpace);
            separationColor2.Tint = 0.74;

            PdfPen separationPen = new PdfPen(separationColor1, 4);
            PdfBrush separationBrush = new PdfBrush(separationColor2);
            page.Graphics.DrawRectangle(separationPen, separationBrush, 20, 605, 250, 100);

            page.Graphics.DrawString("Pantone", sectionFont, brush, 340, 590);
            PdfPen pantonePen = new PdfPen(PdfPantoneColor.ReflexBlue, 4);
            PdfBrush pantoneBrush = new PdfBrush(PdfPantoneColor.RhodamineRed);
            page.Graphics.DrawRectangle(pantonePen, pantoneBrush, 340, 605, 250, 100);

            page.Graphics.CompressAndClose();
        }