iTextSharp.text.pdf.PdfContentByte.SetCMYKColorFill C# (CSharp) Метод

SetCMYKColorFill() публичный метод

public SetCMYKColorFill ( int cyan, int magenta, int yellow, int black ) : void
cyan int
magenta int
yellow int
black int
Результат void
        public virtual void SetCMYKColorFill(int cyan, int magenta, int yellow, int black)
        {
            content.Append((float)(cyan & 0xFF) / 0xFF);
            content.Append(' ');
            content.Append((float)(magenta & 0xFF) / 0xFF);
            content.Append(' ');
            content.Append((float)(yellow & 0xFF) / 0xFF);
            content.Append(' ');
            content.Append((float)(black & 0xFF) / 0xFF);
            content.Append(" k").Append_i(separator);
        }

Usage Example

Пример #1
0
 // ---------------------------------------------------------------------------
 /**
  * Draws the image of the month to the calendar.
  * @param canvas the direct content layer
  * @param dt the DateTime (to know which picture to use)
  */
 public void DrawImageAndText(PdfContentByte canvas, DateTime dt)
 {
     string MM = dt.ToString("MM");
     // get the image
     Image img = Image.GetInstance(Path.Combine(
       RESOURCE, MM + ".jpg"
     ));
     img.ScaleToFit(PageSize.A4.Height, PageSize.A4.Width);
     img.SetAbsolutePosition(
       (PageSize.A4.Height - img.ScaledWidth) / 2,
       (PageSize.A4.Width - img.ScaledHeight) / 2
     );
     canvas.AddImage(img);
     // add metadata
     canvas.SaveState();
     canvas.SetCMYKColorFill(0x00, 0x00, 0x00, 0x80);
     Phrase p = new Phrase(string.Format(
         "{0} - \u00a9 Katharine Osborne",
         content[string.Format("{0}.jpg", dt.ToString("MM"))]
       ),
       small
     );
     ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, p, 5, 5, 0);
     p = new Phrase(
       "Calendar generated using iText - example for the book iText in Action 2nd Edition",
       small
     );
     ColumnText.ShowTextAligned(canvas, Element.ALIGN_RIGHT, p, 839, 5, 0);
     canvas.RestoreState();
 }
PdfContentByte