public virtual void FixedTextRotationTest01() { String outFileName = destinationFolder + "fixedTextRotationTest01.pdf"; String cmpFileName = sourceFolder + cmpPrefix + "fixedTextRotationTest01.pdf"; PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFileName)); Document document = new Document(pdfDocument); SolidBorder border = new SolidBorder(0.5f); int x1 = 350; int y1 = 600; int width1 = 100; document.Add(new Paragraph("text to be rotatedg").SetMargin(0).SetRotationAngle((Math.PI / 6)).SetFixedPosition (x1, y1, width1).SetBorder(border)); document.Add(new Paragraph("text to be rotatedg").SetMargin(0).SetFixedPosition(x1, y1, width1).SetBorder( border)); String longText = "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooong text"; int x2 = 50; int y2 = 300; int width2 = 450; document.Add(new Paragraph(longText).SetMargin(0).SetRotationAngle((Math.PI / 6)).SetFixedPosition(x2, y2, width2)); document.Add(new Paragraph(longText).SetMargin(0).SetFixedPosition(x2, y2, width2)); document.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder , "diff")); }
private static void ParseTextAndFillDocument(Document doc, String filePath) { using (StreamReader br = new StreamReader(filePath)) { PdfFont normal = PdfFontFactory.CreateFont(StandardFonts.TIMES_ROMAN); PdfFont bold = PdfFontFactory.CreateFont(StandardFonts.TIMES_BOLD); Border border = new SolidBorder(ColorConstants.BLUE, 1); bool title = true; String line; while ((line = br.ReadLine()) != null) { Paragraph paragraph; if (title) { // If the text line is a title, then set a bold font and the created border paragraph = new Paragraph(line) .SetFont(bold) .SetBorder(border); } else { // If the text line is not a title, then set a normal font paragraph = new Paragraph(line).SetFont(normal); } doc.Add(paragraph); title = line.Equals(""); } } }
private static Cell SetBorder(Cell cell, CellPosition cellPosition) { cell.SetBorder(Border.NO_BORDER); var border = new SolidBorder(1); return(cellPosition switch { CellPosition.Top => cell.SetBorderTop(border).SetBorderLeft(border).SetBorderRight(border), CellPosition.Central => cell.SetBorderLeft(border).SetBorderRight(border), CellPosition.Bottom => cell.SetBorderBottom(border).SetBorderLeft(border).SetBorderRight(border), _ => throw new KeyNotFoundException(), });
public virtual void InlineTableTest01() { // TODO DEVSIX-1967 String name = "inlineTableTest01.pdf"; String outFileName = destinationFolder + name; String cmpFileName = sourceFolder + "cmp_" + name; PdfDocument pdfDoc = new PdfDocument(new PdfWriter(outFileName)); Document doc = new Document(pdfDoc); Paragraph p = new Paragraph().SetMultipliedLeading(0); p.Add(new Paragraph("This is inline table: ").SetBorder(new SolidBorder(1)).SetMultipliedLeading(0)); Table inlineTable = new Table(1); int commonPadding = 10; Cell cell = new Cell(); Paragraph paragraph = new Paragraph("Cell 1"); inlineTable.AddCell(cell.Add(paragraph.SetMultipliedLeading(0)).SetPadding(commonPadding).SetWidth(33)); Div div = new Div(); p.Add(div.Add(inlineTable).SetPadding(commonPadding)).Add(new Paragraph(". Was it fun?").SetBorder(new SolidBorder (1)).SetMultipliedLeading(0)); SolidBorder border = new SolidBorder(1); doc.Add(p); Paragraph p1 = new Paragraph().Add(p).SetBorder(border); doc.Add(p1); Paragraph p2 = new Paragraph().Add(p1).SetBorder(border); doc.Add(p2); Paragraph p3 = new Paragraph().Add(p2).SetBorder(border); doc.Add(p3); Paragraph p4 = new Paragraph().Add(p3).SetBorder(border); doc.Add(p4); doc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder , "diff")); }
public virtual void CreatePdf(String dest) { // Initialize PDF document PdfDocument pdf = new PdfDocument(new PdfWriter(dest)); // Initialize document Document document = new Document(pdf); Table table = new Table(UnitValue.CreatePercentArray(2)).UseAllAvailableWidth(); PdfFont font = PdfFontFactory.CreateFont(StandardFonts.TIMES_ROMAN); table.AddCell(new Cell().Add(new Paragraph("Test 1")).SetHeight(50).SetDestination("Top")); Style style = new Style(); style.SetBackgroundColor(ColorConstants.YELLOW); table.AddCell(new Cell().SetBorder(new DottedBorder(5)).Add(new Paragraph("Test 2")).AddStyle(style).SetRelativePosition( 10, 10, 50, 10)); table.AddCell(new Cell().Add(new Paragraph("Test 3")).SetVerticalAlignment(VerticalAlignment.BOTTOM)); table.AddCell(new Cell().Add(ParagraphProperties.GetNewParagraphInstance()).SetHyphenation(new HyphenationConfig ("en", "uk", 3, 3))); table.AddCell(new Cell().Add(new Paragraph("Rotated")).SetRotationAngle(Math.PI / 18).SetFont(font).SetFontSize(8).SetFontColor (ColorConstants.RED)); table.AddCell(new Cell().Add(new Paragraph("Centered")).SetTextAlignment(TextAlignment.CENTER).SetAction(PdfAction.CreateGoTo ("Top"))); table.AddCell(new Cell().Add(new Paragraph("Test 5")).SetBackgroundColor(ColorConstants.BLUE)); table.AddCell(new Cell().Add(ParagraphProperties.GetNewParagraphInstance()).SetBackgroundColor(ColorConstants.RED). SetPaddingLeft(20).SetPaddingRight(50)); table.AddCell(new Cell().Add(new Paragraph("Test 7")).SetBackgroundColor(ColorConstants.RED)); table.AddCell(new Cell().Add(new Paragraph("Test 8")).SetBackgroundColor(ColorConstants.BLUE).SetMarginBottom(10)); table.AddCell(new Cell().Add(new Paragraph("Test 9")).SetBackgroundColor(ColorConstants.BLUE)); table.AddCell(new Cell().Add(new Paragraph("Test 10")).SetBackgroundColor(ColorConstants.RED)); table.AddCell(new Cell().Add(ParagraphProperties.GetNewParagraphInstance()).SetBackgroundColor(ColorConstants.RED). SetMargin(50).SetPadding(30)); table.AddCell(new Cell().Add(new Paragraph("Test 12")).SetBackgroundColor(ColorConstants.BLUE)); document.Add(table); SolidBorder border = new SolidBorder(ColorConstants.RED, 2); Cell cell = new Cell().Add(new Paragraph("Test")).SetFixedPosition(100, 400, 350).SetBorder(border).SetBackgroundColor(ColorConstants .BLUE).SetHeight(100).SetHorizontalAlignment(HorizontalAlignment.CENTER); document.Add(cell); document.Close(); }
/// <summary> /// Creates a /// <see cref="iText.Layout.Borders.Border"/> /// instance based on specific properties. /// </summary> /// <param name="outlineWidth">the outline width</param> /// <param name="outlineStyle">the outline style</param> /// <param name="outlineColor">the outline color</param> /// <param name="em">the em value</param> /// <param name="rem">the root em value</param> /// <returns>the border</returns> public static Border GetCertainBorder(String outlineWidth, String outlineStyle, String outlineColor, float em, float rem) { if (outlineStyle == null || CssConstants.NONE.Equals(outlineStyle)) { return(null); } if (outlineWidth == null) { outlineWidth = CssDefaults.GetDefaultValue(CssConstants.OUTLINE_WIDTH); } float outlineWidthValue; if (CssConstants.BORDER_WIDTH_VALUES.Contains(outlineWidth)) { if (CssConstants.THIN.Equals(outlineWidth)) { outlineWidth = "1px"; } else { if (CssConstants.MEDIUM.Equals(outlineWidth)) { outlineWidth = "2px"; } else { if (CssConstants.THICK.Equals(outlineWidth)) { outlineWidth = "3px"; } } } } UnitValue unitValue = CssDimensionParsingUtils.ParseLengthValueToPt(outlineWidth, em, rem); if (unitValue == null) { return(null); } if (unitValue.IsPercentValue()) { LOGGER.Error("outline-width in percents is not supported"); return(null); } outlineWidthValue = unitValue.GetValue(); Border outline = null; if (outlineWidthValue > 0) { DeviceRgb color = (DeviceRgb)ColorConstants.BLACK; float opacity = 1f; if (outlineColor != null) { if (!CssConstants.TRANSPARENT.Equals(outlineColor)) { float[] rgbaColor = CssDimensionParsingUtils.ParseRgbaColor(outlineColor); color = new DeviceRgb(rgbaColor[0], rgbaColor[1], rgbaColor[2]); opacity = rgbaColor[3]; } else { opacity = 0f; } } else { if (CssConstants.GROOVE.Equals(outlineStyle) || CssConstants.RIDGE.Equals(outlineStyle) || CssConstants.INSET .Equals(outlineStyle) || CssConstants.OUTSET.Equals(outlineStyle)) { color = new DeviceRgb(212, 208, 200); } } switch (outlineStyle) { case CssConstants.SOLID: case CssConstants.AUTO: { outline = new SolidBorder(color, outlineWidthValue, opacity); break; } case CssConstants.DASHED: { outline = new DashedBorder(color, outlineWidthValue, opacity); break; } case CssConstants.DOTTED: { outline = new DottedBorder(color, outlineWidthValue, opacity); break; } case CssConstants.DOUBLE: { outline = new DoubleBorder(color, outlineWidthValue, opacity); break; } case CssConstants.GROOVE: { outline = new GrooveBorder(color, outlineWidthValue, opacity); break; } case CssConstants.RIDGE: { outline = new RidgeBorder(color, outlineWidthValue, opacity); break; } case CssConstants.INSET: { outline = new InsetBorder(color, outlineWidthValue, opacity); break; } case CssConstants.OUTSET: { outline = new OutsetBorder(color, outlineWidthValue, opacity); break; } default: { outline = null; break; } } } return(outline); }
/// <summary> /// Creates a /// <see cref="iText.Layout.Borders.Border"/> /// instance based on specific properties. /// </summary> /// <param name="borderWidth">the border width</param> /// <param name="borderStyle">the border style</param> /// <param name="borderColor">the border color</param> /// <param name="em">the em value</param> /// <param name="rem">the root em value</param> /// <returns>the border</returns> public static Border GetCertainBorder(String borderWidth, String borderStyle, String borderColor, float em , float rem) { if (borderStyle == null || CssConstants.NONE.Equals(borderStyle)) { return(null); } if (borderWidth == null) { borderWidth = CssDefaults.GetDefaultValue(CssConstants.BORDER_WIDTH); } float borderWidthValue; if (CssConstants.BORDER_WIDTH_VALUES.Contains(borderWidth)) { if (CssConstants.THIN.Equals(borderWidth)) { borderWidth = "1px"; } else { if (CssConstants.MEDIUM.Equals(borderWidth)) { borderWidth = "2px"; } else { if (CssConstants.THICK.Equals(borderWidth)) { borderWidth = "3px"; } } } } UnitValue unitValue = CssUtils.ParseLengthValueToPt(borderWidth, em, rem); if (unitValue == null) { return(null); } if (unitValue.IsPercentValue()) { return(null); } borderWidthValue = unitValue.GetValue(); Border border = null; if (borderWidthValue > 0) { DeviceRgb color = (DeviceRgb)ColorConstants.BLACK; float opacity = 1f; if (borderColor != null) { if (!CssConstants.TRANSPARENT.Equals(borderColor)) { float[] rgbaColor = CssUtils.ParseRgbaColor(borderColor); color = new DeviceRgb(rgbaColor[0], rgbaColor[1], rgbaColor[2]); opacity = rgbaColor[3]; } else { opacity = 0f; } } else { if (CssConstants.GROOVE.Equals(borderStyle) || CssConstants.RIDGE.Equals(borderStyle) || CssConstants.INSET .Equals(borderStyle) || CssConstants.OUTSET.Equals(borderStyle)) { color = new DeviceRgb(212, 208, 200); } } switch (borderStyle) { case CssConstants.SOLID: { border = new SolidBorder(color, borderWidthValue, opacity); break; } case CssConstants.DASHED: { border = new DashedBorder(color, borderWidthValue, opacity); break; } case CssConstants.DOTTED: { border = new RoundDotsBorder(color, borderWidthValue, opacity); break; } case CssConstants.DOUBLE: { border = new DoubleBorder(color, borderWidthValue, opacity); break; } case CssConstants.GROOVE: { border = new GrooveBorder(color, borderWidthValue, opacity); break; } case CssConstants.RIDGE: { border = new RidgeBorder(color, borderWidthValue, opacity); break; } case CssConstants.INSET: { border = new InsetBorder(color, borderWidthValue, opacity); break; } case CssConstants.OUTSET: { border = new OutsetBorder(color, borderWidthValue, opacity); break; } default: { border = null; break; } } } return(border); }
public static byte[] Generate(IList <ProductStockReport> products) { byte[] content = null; try { using (MemoryStream memoryStream = new MemoryStream()) { var writer = new PdfWriter(memoryStream); var pdfDocument = new PdfDocument(writer); var document = new Document(pdfDocument, PageSize.A4); document.SetMargins(50, 20, 20, 20); document.SetFontSize(10); var solidBorder1 = new SolidBorder(1); var tableHeader = new Table(3); tableHeader.SetWidth(UnitValue.CreatePercentValue(100)); Image image = new Image(ImageDataFactory.Create("Images/icons.png")); var borderRadius = new BorderRadius(3); image.SetBorderRadius(borderRadius); image.SetBorder(new SolidBorder(1)); var iconCell = new Cell().Add(image); iconCell.SetPadding(0); iconCell.SetTextAlignment(TextAlignment.LEFT); iconCell.SetBorder(Border.NO_BORDER); tableHeader.AddCell(iconCell); var title = new Paragraph("Reporte de Ventas"); title.SetFontColor(ColorConstants.RED); title.SetFontSize(20); title.SetTextAlignment(TextAlignment.CENTER); title.SetBackgroundColor(ColorConstants.ORANGE, 0.5f); title.SetBorderRadius(borderRadius); var titleCell = new Cell().Add(title); titleCell.SetPadding(0); titleCell.SetVerticalAlignment(VerticalAlignment.BOTTOM); titleCell.SetBorder(Border.NO_BORDER); tableHeader.AddCell(titleCell); var date = new Paragraph("Fecha: " + DateTime.Now.ToString("dd/MM/yyyy HH:mm tt")); date.SetBorder(solidBorder1); var dateCell = new Cell().Add(date); dateCell.SetPadding(0); dateCell.SetTextAlignment(TextAlignment.RIGHT); dateCell.SetBorder(Border.NO_BORDER); tableHeader.AddCell(dateCell); tableHeader.SetMarginBottom(20); document.Add(tableHeader); var table = new Table(new float[] { 2, 5, 4, 3, 1, 1, 2, 1 }); table.SetWidth(UnitValue.CreatePercentValue(100)); table.SetBorder(solidBorder1); PdfFont font = PdfFontFactory.CreateFont(StandardFonts.HELVETICA_BOLD); table.AddHeaderCell(new Cell().Add(new Paragraph("Código")).SetFont(font).SetBorderBottom(solidBorder1).SetBorderRight(solidBorder1).SetBackgroundColor(ColorConstants.ORANGE)); table.AddHeaderCell(new Cell().Add(new Paragraph("Descripción")).SetFont(font).SetBorderBottom(solidBorder1).SetBorderLeft(solidBorder1).SetBackgroundColor(ColorConstants.ORANGE)); table.AddHeaderCell(new Cell().Add(new Paragraph("Detalles")).SetFont(font).SetBorderBottom(solidBorder1).SetBorderLeft(solidBorder1).SetBackgroundColor(ColorConstants.ORANGE)); table.AddHeaderCell(new Cell().Add(new Paragraph("Marca")).SetFont(font).SetBorderBottom(solidBorder1).SetBorderLeft(solidBorder1).SetBackgroundColor(ColorConstants.ORANGE)); table.AddHeaderCell(new Cell().Add(new Paragraph("Talle")).SetFont(font).SetBorderBottom(solidBorder1).SetBorderLeft(solidBorder1).SetBackgroundColor(ColorConstants.ORANGE)); table.AddHeaderCell(new Cell().Add(new Paragraph("Color")).SetFont(font).SetBorderBottom(solidBorder1).SetBorderLeft(solidBorder1).SetBackgroundColor(ColorConstants.ORANGE)); table.AddHeaderCell(new Cell().Add(new Paragraph("Categoria")).SetFont(font).SetBorderBottom(solidBorder1).SetBorderLeft(solidBorder1).SetBackgroundColor(ColorConstants.ORANGE)); table.AddHeaderCell(new Cell().Add(new Paragraph("Stock")).SetFont(font).SetBorderBottom(solidBorder1).SetBorderLeft(solidBorder1).SetBackgroundColor(ColorConstants.ORANGE)); foreach (ProductStockReport productStock in products) { table.AddCell(new Cell().Add(new Paragraph(productStock.Code))); table.AddCell(new Cell().Add(new Paragraph(productStock.Description))); table.AddCell(new Cell().Add(new Paragraph(productStock.Detail + ""))); table.AddCell(new Cell().Add(new Paragraph(productStock.Brand + ""))); table.AddCell(new Cell().Add(new Paragraph(productStock.Size))); table.AddCell(new Cell().Add(new Paragraph(productStock.Color))); table.AddCell(new Cell().Add(new Paragraph(productStock.Category))); table.AddCell(new Cell().Add(new Paragraph(productStock.Stock + ""))); } document.Add(table); document.Close(); content = memoryStream.GetBuffer(); memoryStream.Flush(); memoryStream.Close(); memoryStream.Dispose(); } return(content); } catch (Exception ex) { throw; } }
public virtual void CreatePdf(String dest, List <string> zaznam) { try { // DEFINOVANIE DOKUMENTU A STYLOV Document doc = new Document(new PdfDocument(new PdfWriter(dest)), PageSize.A4); PdfFont font = PdfFontFactory.CreateFont(StandardFonts.TIMES_ROMAN, PdfEncodings.CP1250, true); SolidBorder solid = new SolidBorder(0.5f); // HLAVICKA Table table = new Table(UnitValue.CreatePercentArray(5)).UseAllAvailableWidth(); Cell bunka = new Cell(1, 5).Add(new Paragraph("Hlásenie o testovaných osobách").SetTextAlignment(TextAlignment.CENTER).SetFont(font).SetUnderline(1, -1)); bunka.SetBackgroundColor(ColorConstants.YELLOW); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("ADRESA ODBERNÉHO MIESTA").SetFont(font)); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderLeft(solid); table.AddCell(bunka); bunka = new Cell(1, 3).Add(new Paragraph("").SetBorder(Border.NO_BORDER)); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderRight(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("obchodné meno").SetFont(font)); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderLeft(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("")); bunka.SetBackgroundColor(new DeviceRgb(140, 220, 80), 0.4f); table.AddCell(bunka); bunka = new Cell(1, 1).Add(new Paragraph("")); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderRight(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("ulica").SetFont(font)); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderLeft(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("")); bunka.SetBackgroundColor(new DeviceRgb(140, 220, 80), 0.4f); table.AddCell(bunka); bunka = new Cell().Add(new Paragraph("")); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderRight(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("PSČ, mesto").SetFont(font)); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderLeft(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("")); bunka.SetBackgroundColor(new DeviceRgb(140, 220, 80), 0.4f); table.AddCell(bunka); bunka = new Cell().Add(new Paragraph("")); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderRight(solid); table.AddCell(bunka); bunka = new Cell(1, 5).Add(new Paragraph("\n")); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderLeft(solid); bunka.SetBorderRight(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("Meno, priezvisko, kontaktnej osoby").SetFont(font)); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderLeft(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("")); bunka.SetBackgroundColor(new DeviceRgb(140, 220, 80), 0.4f); table.AddCell(bunka); bunka = new Cell().Add(new Paragraph("")); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderRight(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("Telefonický kontakt").SetFont(font)); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderLeft(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("")); bunka.SetBackgroundColor(new DeviceRgb(140, 220, 80), 0.4f); table.AddCell(bunka); bunka = new Cell().Add(new Paragraph("")); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderRight(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("E-mail").SetFont(font)); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderLeft(solid); table.AddCell(bunka); bunka = new Cell(1, 2).Add(new Paragraph("")); bunka.SetBackgroundColor(new DeviceRgb(140, 220, 80), 0.4f); table.AddCell(bunka); bunka = new Cell().Add(new Paragraph("")); bunka.SetBorder(Border.NO_BORDER); bunka.SetBorderRight(solid); table.AddCell(bunka); bunka = new Cell(1, 5).Add(new Paragraph("\n")); bunka.SetBorderTop(Border.NO_BORDER); table.AddCell(bunka); doc.Add(table); // ZAZNAMY table = new Table(new float[8]).UseAllAvailableWidth(); //table = new Table(UnitValue.CreatePercentArray(new float[] { 1,4, 4, 3, 4, 8, 4, 1 })).UseAllAvailableWidth(); Cell pc = new Cell().Add(new Paragraph("P.č.").SetTextAlignment(TextAlignment.CENTER).SetFont(font)); table.AddHeaderCell(pc); Cell meno = new Cell().Add(new Paragraph("Meno").SetTextAlignment(TextAlignment.CENTER).SetFont(font)); table.AddHeaderCell(meno); Cell priezvisko = new Cell().Add(new Paragraph("Priezvisko").SetTextAlignment(TextAlignment.CENTER).SetFont(font)); table.AddHeaderCell(priezvisko); Cell datumN = new Cell().Add(new Paragraph("Dátum narodenia").SetTextAlignment(TextAlignment.CENTER).SetFont(font)); table.AddHeaderCell(datumN); Cell rodneC = new Cell().Add(new Paragraph("Rodné číslo").SetTextAlignment(TextAlignment.CENTER).SetFont(font)); table.AddHeaderCell(rodneC); Cell adresa = new Cell().Add(new Paragraph("Adresa").SetTextAlignment(TextAlignment.CENTER).SetFont(font)); table.AddHeaderCell(adresa); Cell telK = new Cell().Add(new Paragraph("Tel.kontakt").SetTextAlignment(TextAlignment.CENTER).SetFont(font)); table.AddHeaderCell(telK); Cell poznamka = new Cell().Add(new Paragraph("Poznámka").SetTextAlignment(TextAlignment.CENTER).SetFont(font)); table.AddHeaderCell(poznamka); // ZAPIS DAT DO TABULKY PDF foreach (var i in zaznam) { table.AddCell(new Cell().Add(new Paragraph(i).SetFont(font))); } doc.Add(table); doc.Close(); } catch (Exception ex) { MessageBox.Show($"Chyba pri generovaní PDF súboru!", "CHYBA", MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.ToString()); return; } }