public virtual void HandleEvent(Event @event) { PdfDocumentEvent docEvent = (PdfDocumentEvent)@event; PdfDocument pdfDoc = docEvent.GetDocument(); PdfPage page = docEvent.GetPage(); int pageNumber = pdfDoc.GetPageNumber(page); Rectangle pageSize = page.GetPageSize(); PdfCanvas pdfCanvas = new PdfCanvas(page.NewContentStreamBefore(), page.GetResources(), pdfDoc); Color limeColor = new DeviceCmyk(0.208f, 0, 0.584f, 0); Color blueColor = new DeviceCmyk(0.445f, 0.0546f, 0, 0.0667f); pdfCanvas.SaveState().SetFillColor(pageNumber % 2 == 1 ? limeColor : blueColor).Rectangle(pageSize.GetLeft(), pageSize.GetBottom(), pageSize.GetWidth(), pageSize.GetHeight()).Fill().RestoreState(); pdfCanvas.BeginText().SetFontAndSize(PdfFontFactory.CreateFont(StandardFonts.HELVETICA), 9).MoveText(pageSize.GetWidth() / 2 - 60, pageSize.GetTop() - 20).ShowText("MILAGRES SAO REAIS SE VOCE ACREDITA NELES").MoveText(60, -pageSize.GetTop() + 30) .ShowText(pageNumber.ToString()).EndText(); Canvas canvas = new Canvas(pdfCanvas, page.GetPageSize()); canvas.SetFontColor(ColorConstants.WHITE); canvas.SetProperty(Property.FONT_SIZE, UnitValue.CreatePointValue(60)); canvas.SetProperty(Property.FONT, PdfFontFactory.CreateFont(StandardFonts.HELVETICA_BOLD)); canvas.ShowTextAligned(new Paragraph("FALA DELE"), 298, 421, pdfDoc.GetPageNumber(page), TextAlignment.CENTER, VerticalAlignment.MIDDLE, 45); pdfCanvas.Release(); }
private Color GetColor(IList colorArgs) { Color color = null; switch (colorArgs.Count) { case 1: { color = new DeviceGray(((PdfNumber)colorArgs[0]).FloatValue()); break; } case 3: { color = new DeviceRgb(((PdfNumber)colorArgs[0]).FloatValue(), ((PdfNumber)colorArgs[1]).FloatValue(), ((PdfNumber )colorArgs[2]).FloatValue()); break; } case 4: { color = new DeviceCmyk(((PdfNumber)colorArgs[0]).FloatValue(), ((PdfNumber)colorArgs[1]).FloatValue(), ((PdfNumber )colorArgs[2]).FloatValue(), ((PdfNumber)colorArgs[3]).FloatValue()); break; } } return(color); }
public Table GetComment() { Text content = new Text(Content).SetFont(regularFont); Text title = new Text($"{Title}. ").SetFont(boldFont); Paragraph titleParagraph = new Paragraph(title); // Create the container for the comment Table commentTable = new Table(new float[] { 1, 1 }); commentTable.UseAllAvailableWidth(); Color cellColour = new DeviceCmyk(0, 0, 0, 0.175f); Color cellFontColour = new DeviceCmyk(0, 0, 0, 0.950f); content.SetFontColor(cellFontColour); Cell contentCell = new Cell(1, 1); contentCell.SetBackgroundColor(cellColour); contentCell.SetBorderRadius(new BorderRadius(5.0f)); contentCell.SetBorder(Border.NO_BORDER); contentCell.SetPaddings(5.0f, 10.0f, 5.0f, 10.0f); contentCell.Add(new Paragraph().Add(title).Add("\n").Add(content)); commentTable.AddCell(contentCell); return(commentTable); }
public virtual void HandleEvent(Event @event) { PdfDocumentEvent docEvent = (PdfDocumentEvent)@event; PdfDocument pdfDoc = docEvent.GetDocument(); PdfPage page = docEvent.GetPage(); int pageNumber = pdfDoc.GetPageNumber(page); Rectangle pageSize = page.GetPageSize(); PdfCanvas pdfCanvas = new PdfCanvas(page.NewContentStreamBefore(), page.GetResources(), pdfDoc); //Set background Color limeColor = new DeviceCmyk(0.208f, 0, 0.584f, 0); Color blueColor = new DeviceCmyk(0.445f, 0.0546f, 0, 0.0667f); pdfCanvas.SaveState() .SetFillColor(pageNumber % 2 == 1 ? limeColor : blueColor) .Rectangle(pageSize.GetLeft(), pageSize.GetBottom(), pageSize.GetWidth(), pageSize.GetHeight()) .Fill() .RestoreState(); //Add header and footer pdfCanvas.BeginText() .SetFontAndSize(Helvetica, 9) .MoveText(pageSize.GetWidth() / 2 - 60, pageSize.GetTop() - 20) .ShowText("THE TRUTH IS OUT THERE") .MoveText(60, -pageSize.GetTop() + 30) .ShowText(pageNumber.ToString()) .EndText(); //Add watermark Canvas canvas = new iText.Layout.Canvas(pdfCanvas, pdfDoc, page.GetPageSize()); canvas.SetProperty(Property.FONT_COLOR, DeviceRgb.WHITE); canvas.SetProperty(Property.FONT_SIZE, 60); canvas.SetProperty(Property.FONT, HelveticaBold); //canvas.ShowTextAligned(new Paragraph("CONFIDENTIAL"), 298.0f, 421.0f, pageNumber, // TextAlignment.CENTER, VerticalAlignment.MIDDLE, 45.0f); // not working pdfCanvas.Release(); }
public virtual void CreatePdf(String dest) { //Initialize PDF document PdfDocument pdf = new PdfDocument(new PdfWriter(dest)); PageSize ps = PageSize.A4.Rotate(); PdfPage page = pdf.AddNewPage(ps); PdfCanvas canvas = new PdfCanvas(page); //Replace the origin of the coordinate system to the center of the page canvas.ConcatMatrix(1, 0, 0, 1, ps.GetWidth() / 2, ps.GetHeight() / 2); Color grayColor = new DeviceCmyk(0f, 0f, 0f, 0.875f); Color greenColor = new DeviceCmyk(1f, 0f, 1f, 0.176f); Color blueColor = new DeviceCmyk(1f, 0.156f, 0f, 0.118f); canvas.SetLineWidth(0.5f).SetStrokeColor(blueColor); //Draw horizontal grid lines for (int i = -((int)ps.GetHeight() / 2 - 57); i < ((int)ps.GetHeight() / 2 - 56); i += 40) { canvas.MoveTo(-(ps.GetWidth() / 2 - 15), i).LineTo(ps.GetWidth() / 2 - 15, i); } //Draw vertical grid lines for (int j = -((int)ps.GetWidth() / 2 - 61); j < ((int)ps.GetWidth() / 2 - 60); j += 40) { canvas.MoveTo(j, -(ps.GetHeight() / 2 - 15)).LineTo(j, ps.GetHeight() / 2 - 15); } canvas.Stroke(); //Draw axes canvas.SetLineWidth(3).SetStrokeColor(grayColor); C02E01_Axes.DrawAxes(canvas, ps); //Draw plot canvas.SetLineWidth(2).SetStrokeColor(greenColor).SetLineDash(10, 10, 8).MoveTo(-(ps.GetWidth() / 2 - 15), -(ps.GetHeight() / 2 - 15)).LineTo(ps.GetWidth() / 2 - 15, ps.GetHeight() / 2 - 15).Stroke(); //Close document pdf.Close(); }
public virtual void CreatePdf(String dest) { IList<String> text = new List<String>(); text.Add(" Episode V "); text.Add(" THE EMPIRE STRIKES BACK "); text.Add("It is a dark time for the"); text.Add("Rebellion. Although the Death"); text.Add("Star has been destroyed,"); text.Add("Imperial troops have driven the"); text.Add("Rebel forces from their hidden"); text.Add("base and pursued them across"); text.Add("the galaxy."); text.Add("Evading the dreaded Imperial"); text.Add("Starfleet, a group of freedom"); text.Add("fighters led by Luke Skywalker"); text.Add("has established a new secret"); text.Add("base on the remote ice world"); text.Add("of Hoth..."); int maxStringWidth = 0; foreach (String fragment in text) { if (fragment.Length > maxStringWidth) { maxStringWidth = fragment.Length; } } //Initialize PDF document PdfDocument pdf = new PdfDocument(new PdfWriter(dest)); //Add new page PageSize ps = PageSize.A4; PdfPage page = pdf.AddNewPage(ps); PdfCanvas canvas = new PdfCanvas(page); //Set black background canvas.Rectangle(0, 0, ps.GetWidth(), ps.GetHeight()).SetColor(ColorConstants.BLACK, true).Fill(); //Replace the origin of the coordinate system to the top left corner canvas.ConcatMatrix(1, 0, 0, 1, 0, ps.GetHeight()); Color yellowColor = new DeviceCmyk(0f, 0.0537f, 0.769f, 0.051f); float lineHeight = 5; float yOffset = -40; canvas.BeginText().SetFontAndSize(PdfFontFactory.CreateFont(StandardFonts.COURIER_BOLD), 1).SetColor(yellowColor , true); for (int j = 0; j < text.Count; j++) { String line = text[j]; float xOffset = ps.GetWidth() / 2 - 45 - 8 * j; float fontSizeCoeff = 6 + j; float lineSpacing = (lineHeight + j) * j / 1.5f; int stringWidth = line.Length; for (int i = 0; i < stringWidth; i++) { float angle = (maxStringWidth / 2 - i) / 2f; float charXOffset = (4 + (float)j / 2) * i; canvas.SetTextMatrix(fontSizeCoeff, 0, angle, fontSizeCoeff / 1.5f, xOffset + charXOffset, yOffset - lineSpacing ).ShowText(line[i].ToString()); } } canvas.EndText(); //Close document pdf.Close(); }
public PdfSpecialCs GetSeparationColorspace(PdfWriter writer, DeviceCmyk cmyk) { PdfDictionary pdfDictionary = new PdfDictionary(); pdfDictionary.Put(PdfName.FunctionType, new PdfNumber(2)); pdfDictionary.Put(PdfName.Domain, new PdfArray(new float[] { 0, 1 })); pdfDictionary.Put(PdfName.C0, new PdfArray(new float[] { 0, 0, 0, 0 })); pdfDictionary.Put(PdfName.C1, new PdfArray(cmyk.GetColorValue())); pdfDictionary.Put(PdfName.N, new PdfNumber(1)); PdfFunction pdfFunction = new PdfFunction.Type2(pdfDictionary); return(new PdfSpecialCs.Separation("mySpotColor", cmyk.GetColorSpace(), pdfFunction)); }
public void DrawRectangleArea(Rectangle rectangle, string inputFilePath) { var pdfReader = new PdfReader(inputFilePath); pdfReader.SetUnethicalReading(true); PdfDocument pdfDoc = new PdfDocument(pdfReader, new PdfWriter("C:\\temp\\output.pdf")); PdfCanvas canvas = new PdfCanvas(pdfDoc.GetPage(1)); var colour = new DeviceCmyk(1, 1, 1, 1); canvas.SetFillColor(colour); canvas.Rectangle(rectangle); canvas.FillStroke(); pdfDoc.Close(); }
public MemoryStream CreatePdf(string text) { if (text == null) { throw new ArgumentNullException(nameof(text)); } _logger.LogInformation("Creating barcode for '{Text}'", text); var properties = new WriterProperties(); properties.SetPdfVersion(PdfVersion.PDF_1_4); var stream = new MemoryStream(); using var writer = new PdfWriter(stream, properties); var pdfDoc = new PdfDocument(writer); PdfFont fontOcrb = PdfFontFactory.CreateFont("wwwroot/OCRB.otf", PdfEncodings.WINANSI, PdfFontFactory.EmbeddingStrategy.PREFER_EMBEDDED); Color cmykBlack = new DeviceCmyk(0, 0, 0, 100); var gState = new PdfExtGState().SetFillOverPrintFlag(true).SetStrokeOverPrintFlag(true).SetOverprintMode(1); var code128 = new Barcode128(pdfDoc); code128.SetBaseline(7.67f); code128.SetSize(9f); code128.SetFont(fontOcrb); code128.SetX(0.72f); code128.SetBarHeight(14.17f); code128.SetCode(text); code128.SetCodeType(Barcode128.CODE128); var xObject = code128.CreateFormXObject(cmykBlack, cmykBlack, pdfDoc); pdfDoc.AddNewPage(new iText.Kernel.Geom.PageSize(xObject.GetWidth(), xObject.GetHeight())); PdfCanvas canvas = new PdfCanvas(pdfDoc.GetFirstPage()); canvas.SaveState(); canvas.SetExtGState(gState); canvas.AddXObjectAt(xObject, 0f, 0f); canvas.RestoreState(); pdfDoc.Close(); return(stream); }
protected void ManipulatePdf(String dest) { PdfDocument pdfDoc = new PdfDocument(new PdfWriter(dest)); PdfCanvas canvas = new PdfCanvas(pdfDoc.AddNewPage()); // Create a 100% Magenta color Color magentaColor = new DeviceCmyk(0f, 1f, 0f, 0f); canvas .SetStrokeColor(magentaColor) .MoveTo(36, 36) .LineTo(36, 806) .LineTo(559, 36) .LineTo(559, 806) .ClosePathStroke(); pdfDoc.Close(); }
protected internal virtual Color GetDarkerColor() { if (color is DeviceRgb) { return(DeviceRgb.MakeDarker((DeviceRgb)color)); } else { if (color is DeviceCmyk) { return(DeviceCmyk.MakeDarker((DeviceCmyk)color)); } else { if (color is DeviceGray) { return(DeviceGray.MakeDarker((DeviceGray)color)); } } } return(color); }
/// <summary> /// Makes the /// <see cref="Border.transparentColor"/> /// color of the border darker and returns the result /// </summary> /// <returns>The darker color</returns> protected internal virtual Color GetDarkerColor() { Color color = this.transparentColor.GetColor(); if (color is DeviceRgb) { return(DeviceRgb.MakeDarker((DeviceRgb)color)); } else { if (color is DeviceCmyk) { return(DeviceCmyk.MakeDarker((DeviceCmyk)color)); } else { if (color is DeviceGray) { return(DeviceGray.MakeDarker((DeviceGray)color)); } } } return(color); }
public static void Cria() { string caminho = @"C:\WorkPedro\pdf\canvas.pdf"; using FileStream fileStream = new FileStream(caminho, FileMode.Create); using PdfWriter writer = new PdfWriter(fileStream); using PdfDocument pdf = new PdfDocument(writer); PageSize ps = PageSize.A4.Rotate(); PdfPage page = pdf.AddNewPage(ps); PdfCanvas canvas = new PdfCanvas(page); canvas.ConcatMatrix(1, 0, 0, 1, ps.GetWidth() / 2, ps.GetHeight() / 2); Color grayColor = new DeviceCmyk(0f, 0f, 0f, 0.875f); canvas.SetLineWidth(3f) .SetStrokeColor(grayColor); canvas.MoveTo(-(ps.GetWidth() / 2 - 15), 0) .LineTo(ps.GetWidth() / 2 - 15, 0) .Stroke(); canvas.SaveState() .SetLineJoinStyle(PdfCanvasConstants.LineJoinStyle.ROUND) .MoveTo(ps.GetWidth() / 2 - 25, -10) .LineTo(ps.GetWidth() / 2 - 15, 0) .LineTo(ps.GetWidth() / 2 - 25, 10) .Stroke() .RestoreState(); canvas.MoveTo(0, -(ps.GetHeight() / 2 - 15)) .LineTo(0, ps.GetHeight() / 2 - 15) .Stroke(); canvas.SaveState() .SetLineJoinStyle(PdfCanvasConstants.LineJoinStyle.ROUND) .MoveTo(-10, ps.GetHeight() / 2 - 25) .LineTo(0, ps.GetHeight() / 2 - 15) .LineTo(10, ps.GetHeight() / 2 - 25) .Stroke() .RestoreState(); for (int i = -((int)ps.GetWidth() / 2 - 61); i < ((int)ps.GetWidth() / 2 - 60); i += 40) { canvas.MoveTo(i, 5) .LineTo(i, -5); } for (int j = -((int)ps.GetHeight() / 2 - 57); j < ((int)ps.GetHeight() / 2 - 56); j += 40) { canvas.MoveTo(5, j) .LineTo(-5, j); } canvas.Stroke(); Color blueColor = new DeviceCmyk(1f, 0.156f, 0f, 0.118f); canvas.SetLineWidth(0.5f) .SetStrokeColor(blueColor); for (int i = -((int)ps.GetHeight() / 2 - 57); i < ((int)ps.GetHeight() / 2 - 56); i += 40) { if (i == 0) { continue; } canvas.MoveTo(-(ps.GetWidth() / 2 - 15), i) .LineTo(-5, i) .MoveTo(5, i) .LineTo(ps.GetWidth() / 2 - 15, i); } for (int j = -((int)ps.GetWidth() / 2 - 61); j < ((int)ps.GetWidth() / 2 - 60); j += 40) { if (j == 0) { continue; } canvas.MoveTo(j, -(ps.GetHeight() / 2 - 15)) .LineTo(j, -5) .MoveTo(j, 5) .LineTo(j, ps.GetHeight() / 2 - 15); } canvas.Stroke(); Color greenColor = new DeviceCmyk(1f, 0f, 1f, 0.176f); canvas.SetLineWidth(2f) .SetStrokeColor(greenColor) .SetLineDash(10, 10, 8) .MoveTo(-(ps.GetWidth() / 2 - 15), -(ps.GetHeight() / 2 - 15)) .LineTo(ps.GetWidth() / 2 - 15, ps.GetHeight() / 2 - 15) .Stroke(); canvas.Stroke(); PageSize newPageSize = PageSize.A4; PdfPage newPage = pdf.AddNewPage(newPageSize); float offset = 36; float columnWidth = (ps.GetWidth() - offset * 2 + 10) / 3; float columnHeigth = ps.GetWidth() - offset * 2; pdf.Close(); }
/// <summary> /// Creates a RidgeBorder instance with the specified width and the /// <see cref="iText.Kernel.Colors.DeviceCmyk">cmyk color</see> /// . /// </summary> /// <param name="width">width of the border</param> /// <param name="color"> /// the /// <see cref="iText.Kernel.Colors.DeviceCmyk">cmyk color</see> /// of the border /// </param> public RidgeBorder(DeviceCmyk color, float width) : base(color, width) { }
/// <summary>Creates a GrooveBorder instance with the specified width, color and opacity.</summary> /// <param name="color">color of the border</param> /// <param name="width">width of the border</param> /// <param name="opacity">opacity of the border</param> public GrooveBorder(DeviceCmyk color, float width, float opacity) : base(color, width, opacity) { }
/// <summary>Creates a Border3D instance with the specified width and color.</summary> /// <param name="color">color of the border</param> /// <param name="width">with of the border</param> protected internal Border3D(DeviceCmyk color, float width) : base(color, width) { }
/// <summary> /// Creates a GrooveBorder instance with the specified width and the /// <see cref="iText.Kernel.Colors.DeviceCmyk">cmyk color</see> /// . /// </summary> /// <param name="width">width of the border</param> /// <param name="color"> /// the /// <see cref="iText.Kernel.Colors.DeviceCmyk">cmyk color</see> /// of the border /// </param> public GrooveBorder(DeviceCmyk color, float width) : base(color, width) { }
public virtual void HandleEvent(Event pdfEvent) { { PdfDocumentEvent docEvent = (PdfDocumentEvent)pdfEvent; PdfDocument pdfDoc = docEvent.GetDocument(); Document document = new Document(pdfDoc); PdfPage page = docEvent.GetPage(); int pageNumber = pdfDoc.GetPageNumber(page); Rectangle pageSize = page.GetPageSize(); PdfCanvas pdfCanvas = new PdfCanvas(page.NewContentStreamBefore(), page.GetResources(), pdfDoc); //Add header and footer PdfFont font = PdfFontFactory.CreateRegisteredFont("calibri-bold"); if (pageNumber == 1) { if (_docOptions.HasFlag(DocConverter.DocOptions.AddHeaderPageOne)) { pdfCanvas.SaveState(); PdfExtGState state = new PdfExtGState(); state.SetFillOpacity(1.0f); pdfCanvas.SetExtGState(state); var imageHeight = _idHeaderFirst.GetHeight() * 72 / 96; //convert pixels to points var imageToAdd = new Image(_idHeaderFirst, 0, pageSize.GetTop() - imageHeight, pageSize.GetWidth()); imageToAdd.GetAccessibilityProperties() .SetAlternateDescription("Background header image"); imageToAdd.GetAccessibilityProperties().SetRole(StandardRoles.ARTIFACT); PdfLayer pdflayer = new PdfLayer("main layer", pdfDoc); pdflayer.SetOn(true); Canvas canvas = new Canvas(pdfCanvas, pdfDoc, document.GetPageEffectiveArea(pdfDoc.GetDefaultPageSize())); pdflayer.SetPageElement("L"); pdfCanvas.BeginLayer(pdflayer); canvas.EnableAutoTagging(page); canvas.Add(imageToAdd); pdfCanvas.EndLayer(); } if (_docOptions.HasFlag(DocConverter.DocOptions.DisplayTitle)) { //Add Title Color purpleColor = new DeviceRgb(85, 60, 116); TagTreePointer tagPointer = new TagTreePointer(pdfDoc); tagPointer.SetPageForTagging(page); tagPointer.AddTag(StandardRoles.TITLE); pdfCanvas.BeginText().SetColor(purpleColor, true).SetFontAndSize(font, 28) .MoveText(42, pageSize.GetTop() - 150).OpenTag(tagPointer.GetTagReference()).ShowText(_title).CloseTag().Stroke(); } } else if (_docOptions.HasFlag(DocConverter.DocOptions.AddHeaderAllPages)) { pdfCanvas.SaveState(); PdfExtGState state = new PdfExtGState(); state.SetFillOpacity(1.0f); pdfCanvas.SetExtGState(state); var imageHeight = _idHeaderAll.GetHeight() * 72 / 96; //convert pixels to points var imageToAdd = new Image(_idHeaderAll, 0, pageSize.GetTop() - imageHeight, pageSize.GetWidth()); imageToAdd.GetAccessibilityProperties().SetRole(StandardRoles.ARTIFACT); imageToAdd.GetAccessibilityProperties() .SetAlternateDescription("Background header image"); PdfLayer pdflayer = new PdfLayer("main layer", pdfDoc); pdflayer.SetOn(true); Canvas canvas = new Canvas(pdfCanvas, pdfDoc, document.GetPageEffectiveArea(pdfDoc.GetDefaultPageSize())); pdfCanvas.BeginLayer(pdflayer); canvas.EnableAutoTagging(page); canvas.Add(imageToAdd); pdfCanvas.EndLayer(); pdfCanvas.RestoreState(); } if (_docOptions.HasFlag(DocConverter.DocOptions.AddLineBottomEachPage)) { //Add line to the bottom Color blueColor = new DeviceCmyk(100, 25, 0, 39); pdfCanvas.SetStrokeColor(blueColor) .MoveTo(36, 36) .LineTo(559, 36) .ClosePathStroke(); } pdfCanvas.Release(); } }
/// <summary> /// Creates an InsetBorder instance with the specified width and the /// <see cref="iText.Kernel.Colors.DeviceCmyk">cmyk color</see>. /// </summary> /// <param name="width">width of the border</param> /// <param name="color"> /// the /// <see cref="iText.Kernel.Colors.DeviceCmyk">cmyk color</see> /// of the border /// </param> public InsetBorder(DeviceCmyk color, float width) : base(color, width) { }
/// <summary>Creates an InsetBorder instance with the specified width, color and opacity.</summary> /// <param name="color">color of the border</param> /// <param name="width">width of the border</param> /// <param name="opacity">opacity of the border</param> public InsetBorder(DeviceCmyk color, float width, float opacity) : base(color, width, opacity) { }
/// <summary>Creates a Border3D instance with the specified width, color and opacity.</summary> /// <param name="color">color of the border</param> /// <param name="width">width of the border</param> /// <param name="opacity">opacity of the border</param> protected internal Border3D(DeviceCmyk color, float width, float opacity) : base(color, width, opacity) { }
public virtual iText.Kernel.Pdf.Annot.DA.AnnotationDefaultAppearance SetColor(DeviceCmyk cmykColor) { SetColorOperand(cmykColor.GetColorValue(), "k"); return(this); }
public virtual void Borders3DTest() { fileName = "borders3DTest.pdf"; Document doc = CreateDocument(); List list = new List(); ListItem grooveBorderItem = new ListItem("groove"); grooveBorderItem.SetBorder(new GrooveBorder(2)).SetMarginBottom(5).SetWidth(100); list.Add(grooveBorderItem); ListItem ridgeBorderItem = new ListItem("ridge"); ridgeBorderItem.SetBorder(new RidgeBorder(2)).SetMarginBottom(5).SetWidth(100); list.Add(ridgeBorderItem); ListItem insetBorderItem = new ListItem("inset"); insetBorderItem.SetBorder(new InsetBorder(1)).SetMarginBottom(5).SetWidth(100); list.Add(insetBorderItem); ListItem outsetBorderItem = new ListItem("outset"); outsetBorderItem.SetBorder(new OutsetBorder(1)).SetMarginBottom(5).SetWidth(100); list.Add(outsetBorderItem); doc.Add(list); Paragraph emptyParagraph = new Paragraph("\n"); doc.Add(emptyParagraph); DeviceRgb blueRgb = new DeviceRgb(0, 0, 200); DeviceRgb greenRgb = new DeviceRgb(0, 255, 0); DeviceCmyk magentaCmyk = new DeviceCmyk(0, 100, 0, 0); DeviceCmyk yellowCmyk = new DeviceCmyk(0, 0, 100, 0); list = new List(); grooveBorderItem = new ListItem("groove"); grooveBorderItem.SetBorder(new GrooveBorder(blueRgb, 2)).SetMarginBottom(5).SetWidth(100); list.Add(grooveBorderItem); ridgeBorderItem = new ListItem("ridge"); ridgeBorderItem.SetBorder(new RidgeBorder(greenRgb, 2)).SetMarginBottom(5).SetWidth(100); list.Add(ridgeBorderItem); insetBorderItem = new ListItem("inset"); insetBorderItem.SetBorder(new InsetBorder(magentaCmyk, 1)).SetMarginBottom(5).SetWidth(100); list.Add(insetBorderItem); outsetBorderItem = new ListItem("outset"); outsetBorderItem.SetBorder(new OutsetBorder(yellowCmyk, 1)).SetMarginBottom(5).SetWidth(100); list.Add(outsetBorderItem); doc.Add(list); emptyParagraph = new Paragraph("\n"); doc.Add(emptyParagraph); list = new List(); grooveBorderItem = new ListItem("groove"); grooveBorderItem.SetBorder(new GrooveBorder(yellowCmyk, 8)).SetMarginBottom(5); list.Add(grooveBorderItem); ridgeBorderItem = new ListItem("ridge"); ridgeBorderItem.SetBorder(new RidgeBorder(magentaCmyk, 8)).SetMarginBottom(5); list.Add(ridgeBorderItem); insetBorderItem = new ListItem("inset"); insetBorderItem.SetBorder(new InsetBorder(greenRgb, 8)).SetMarginBottom(5); list.Add(insetBorderItem); outsetBorderItem = new ListItem("outset"); outsetBorderItem.SetBorder(new OutsetBorder(blueRgb, 8)).SetMarginBottom(5); list.Add(outsetBorderItem); doc.Add(list); CloseDocumentAndCompareOutputs(doc); }