/// <summary> /// Main method for running the sample. /// </summary> public static SampleOutputInfo[] Run(Stream verdanaFontStream, Stream verdanaBoldFontStream, Stream logoImageStream) { PDFAnsiTrueTypeFont verdana = new PDFAnsiTrueTypeFont(verdanaFontStream, 10, true); PDFAnsiTrueTypeFont verdanaBold = new PDFAnsiTrueTypeFont(verdanaBoldFontStream, 10, true); PDFPngImage logoImage = new PDFPngImage(logoImageStream); PDFFlowDocument document = new PDFFlowDocument(); PDFFlowContent header = BuildHeader(verdana, logoImage); document.AddContent(header); PDFFlowContent sellerSection = BuildSellerSection(verdana, verdanaBold); document.AddContent(sellerSection); PDFFlowContent invoiceInfoSection = BuildInvoiceInfoSection(verdana, verdanaBold); document.AddContent(invoiceInfoSection); PDFFlowContent buyerSection = BuildBuyerSection(verdana, verdanaBold); document.AddContent(buyerSection); PDFFlowContent invoiceItemsSection = BuildInvoiceItemsSection(verdana, verdanaBold); document.AddContent(invoiceItemsSection); PDFFlowContent endSection = BuildEndSection(verdana); document.AddContent(endSection); SampleOutputInfo[] output = new SampleOutputInfo[] { new SampleOutputInfo(document, "invoice.pdf") }; return(output); }
private static PDFFlowContent BuildCountriesList(PDFAnsiTrueTypeFont verdana, PDFAnsiTrueTypeFont verdanaBold, Stream data) { PDFAnsiTrueTypeFont textFont = new PDFAnsiTrueTypeFont(verdana); textFont.Size = 10; PDFAnsiTrueTypeFont headerFont = new PDFAnsiTrueTypeFont(verdanaBold); headerFont.Size = 12; PDFFlowTableContent countriesTable = new PDFFlowTableContent(2); countriesTable.Border = new PDFPen(PDFRgbColor.Black, 0.5); countriesTable.MinRowHeight = 15; (countriesTable.DefaultCell as PDFFlowTableStringCell).Font = textFont; countriesTable.Columns[0].VerticalAlign = PDFGraphicAlign.Center; countriesTable.Columns[1].VerticalAlign = PDFGraphicAlign.Center; countriesTable.Columns[1].HorizontalAlign = PDFGraphicAlign.Far; string continent = ""; long total = 0; PDFFlowTableRow row = null; StreamReader sr = new StreamReader(data); string line = sr.ReadLine(); while (line != null) { string[] items = line.Split('|'); long pop = long.Parse(items[2], System.Globalization.CultureInfo.InvariantCulture); total = total + pop; if (continent != items[0]) { // Add group footer if (continent != "") { row = countriesTable.Rows.AddRowWithCells("Total population for " + continent + ": " + total.ToString("#,##0")); row.Cells[0].ColSpan = 2; row.Cells[0].HorizontalAlign = PDFGraphicAlign.Far; (row.Cells[0] as PDFFlowTableStringCell).Font = headerFont; } continent = items[0]; total = 0; // Add group header row = countriesTable.Rows.AddRowWithCells(continent); row.Cells[0].ColSpan = 2; row.Background = new PDFBrush(PDFRgbColor.LightGray); (row.Cells[0] as PDFFlowTableStringCell).Font = headerFont; } row = countriesTable.Rows.AddRowWithCells(items[1], pop.ToString("#,##0")); line = sr.ReadLine(); } row = countriesTable.Rows.AddRowWithCells("Total population for " + continent + ": " + total.ToString("#,##0")); row.Cells[0].ColSpan = 2; row.Cells[0].HorizontalAlign = PDFGraphicAlign.Far; (row.Cells[0] as PDFFlowTableStringCell).Font = headerFont; return(countriesTable); }
private static PDFFlowContent BuildInvoiceInfoSection(PDFAnsiTrueTypeFont verdana, PDFAnsiTrueTypeFont verdanaBold) { PDFAnsiTrueTypeFont labelFont = new PDFAnsiTrueTypeFont(verdanaBold); labelFont.Size = 12; PDFAnsiTrueTypeFont contentFont = new PDFAnsiTrueTypeFont(verdana); contentFont.Size = 12; PDFFlowTableContent invoiceInfoTable = new PDFFlowTableContent(2); invoiceInfoTable.Columns[0].Width = 120; invoiceInfoTable.Columns[0].WidthIsRelativeToTable = false; (invoiceInfoTable.DefaultCell as PDFFlowTableStringCell).Font = contentFont; PDFFlowTableRow row = invoiceInfoTable.Rows.AddRowWithCells(" ", " "); row = invoiceInfoTable.Rows.AddRowWithCells("Date", "15 March 2016"); (row.Cells[0] as PDFFlowTableStringCell).Font = labelFont; row = invoiceInfoTable.Rows.AddRowWithCells("Invoice number:", "1234567890"); (row.Cells[0] as PDFFlowTableStringCell).Font = labelFont; row = invoiceInfoTable.Rows.AddRowWithCells("Currency:", "USD (US Dollars)"); (row.Cells[0] as PDFFlowTableStringCell).Font = labelFont; return(invoiceInfoTable); }
private static PDFFlowContent BuildBuyerSection(PDFAnsiTrueTypeFont verdana, PDFAnsiTrueTypeFont verdanaBold) { PDFAnsiTrueTypeFont headerFont = new PDFAnsiTrueTypeFont(verdana); headerFont.Size = 20; PDFAnsiTrueTypeFont labelFont = new PDFAnsiTrueTypeFont(verdanaBold); labelFont.Size = 12; PDFAnsiTrueTypeFont contentFont = new PDFAnsiTrueTypeFont(verdana); contentFont.Size = 12; PDFFormattedContent buyerInfo = new PDFFormattedContent(); buyerInfo.Paragraphs.Add(new PDFFormattedTextBlock(" ", headerFont)); buyerInfo.Paragraphs.Add(new PDFFormattedTextBlock("Invoice to:", headerFont)); buyerInfo.Paragraphs.Add(new PDFFormattedTextBlock(" ", headerFont)); buyerInfo.Paragraphs.Add(new PDFFormattedTextBlock("Contoso LLC", contentFont)); buyerInfo.Paragraphs.Add(new PDFFormattedTextBlock("1000 Summer Road", contentFont)); buyerInfo.Paragraphs.Add(new PDFFormattedTextBlock("London", contentFont)); buyerInfo.Paragraphs.Add(new PDFFormattedTextBlock("1A2 3B4", contentFont)); buyerInfo.Paragraphs.Add(new PDFFormattedTextBlock("United Kingdom", contentFont)); buyerInfo.Paragraphs.Add(" "); PDFFormattedTextBlock labelVAT = new PDFFormattedTextBlock("Your VAT/Tax number: ", labelFont); PDFFormattedTextBlock vat = new PDFFormattedTextBlock("GB1234567890", contentFont); buyerInfo.Paragraphs.Add(labelVAT, vat); buyerInfo.Paragraphs.Add(new PDFFormattedTextBlock(" ", headerFont)); PDFFlowTextContent buyerInfoText = new PDFFlowTextContent(buyerInfo); return(buyerInfoText); }
private static PDFFlowContent BuildSuperscript(PDFAnsiTrueTypeFont font) { PDFAnsiTrueTypeFont fontSuperscript = new PDFAnsiTrueTypeFont(font, 18); PDFAnsiTrueTypeFont fontRegular = new PDFAnsiTrueTypeFont(font, 12); PDFFormattedContent content = new PDFFormattedContent(); PDFFlowTextContent flowText = new PDFFlowTextContent(content); PDFFormattedTextBlock titleBlock = new PDFFormattedTextBlock("Superscript text", fontRegular); content.Paragraphs.Add(new PDFFormattedParagraph(titleBlock)); content.Paragraphs.Add(new PDFFormattedParagraph(" ")); PDFFormattedTextBlock xBlock = new PDFFormattedTextBlock("X", font); xBlock.Superscript.Add(new PDFFormattedTextBlock("2", fontSuperscript)); PDFFormattedTextBlock yBlock = new PDFFormattedTextBlock(" + Y", font); yBlock.Superscript.Add(new PDFFormattedTextBlock("2", fontSuperscript)); PDFFormattedTextBlock zBlock = new PDFFormattedTextBlock(" = Z", font); zBlock.Superscript.Add(new PDFFormattedTextBlock("2", fontSuperscript)); PDFFormattedParagraph paragraph = new PDFFormattedParagraph(xBlock, yBlock, zBlock); paragraph.HorizontalAlign = PDFStringHorizontalAlign.Center; content.Paragraphs.Add(paragraph); return(flowText); }
private static PDFFlowContent BuildSubscript(PDFAnsiTrueTypeFont font) { PDFAnsiTrueTypeFont fontSubscript = new PDFAnsiTrueTypeFont(font, 18); PDFAnsiTrueTypeFont fontRegular = new PDFAnsiTrueTypeFont(font, 12); PDFFormattedContent content = new PDFFormattedContent(); PDFFlowTextContent flowText = new PDFFlowTextContent(content); flowText.OuterMargins = new PDFFlowContentMargins(0, 0, 36, 0); PDFFormattedTextBlock titleBlock = new PDFFormattedTextBlock("Subscript text", fontRegular); content.Paragraphs.Add(new PDFFormattedParagraph(titleBlock)); content.Paragraphs.Add(new PDFFormattedParagraph(" ")); PDFFormattedTextBlock block1 = new PDFFormattedTextBlock("Y = X", font); block1.Subscript.Add(new PDFFormattedTextBlock("1", fontSubscript)); PDFFormattedTextBlock block2 = new PDFFormattedTextBlock(" + X", font); block2.Subscript.Add(new PDFFormattedTextBlock("2", fontSubscript)); PDFFormattedTextBlock block3 = new PDFFormattedTextBlock(" + X", font); block3.Subscript.Add(new PDFFormattedTextBlock("3", fontSubscript)); PDFFormattedTextBlock blockn = new PDFFormattedTextBlock(" + ... + X", font); blockn.Subscript.Add(new PDFFormattedTextBlock("n", fontSubscript)); PDFFormattedParagraph paragraph = new PDFFormattedParagraph(block1, block2, block3, blockn); paragraph.HorizontalAlign = PDFStringHorizontalAlign.Center; content.Paragraphs.Add(paragraph); return(flowText); }
private static PDFFlowContent BuildEndSection(PDFAnsiTrueTypeFont verdana) { PDFAnsiTrueTypeFont headerFont = new PDFAnsiTrueTypeFont(verdana); headerFont.Size = 20; PDFAnsiTrueTypeFont contentFont = new PDFAnsiTrueTypeFont(verdana); contentFont.Size = 12; PDFFormattedContent endInfo = new PDFFormattedContent(); endInfo.Paragraphs.Add(new PDFFormattedTextBlock(" ", headerFont)); endInfo.Paragraphs.Add(new PDFFormattedTextBlock("PAID IN FULL by credit card.", headerFont)); endInfo.Paragraphs.Add(new PDFFormattedTextBlock(" ", headerFont)); PDFFormattedTextBlock text1 = new PDFFormattedTextBlock("If you have any queries regarding this Invoice, please contact ", contentFont); PDFFormattedTextBlock email = new PDFFormattedTextBlock("*****@*****.**", contentFont); PDFFormattedTextBlock text2 = new PDFFormattedTextBlock(" quoting the Invoice Number above.", contentFont); email.TextColor = new PDFBrush(PDFRgbColor.Blue); email.Action = new PDFUriAction("mailto:[email protected]"); endInfo.Paragraphs.Add(text1, email, text2); PDFFlowTextContent endInfoText = new PDFFlowTextContent(endInfo); return(endInfoText); }
private static PDFFlowContent BuildInvoiceItemsSection(PDFAnsiTrueTypeFont verdana, PDFAnsiTrueTypeFont verdanaBold) { PDFAnsiTrueTypeFont labelFont = new PDFAnsiTrueTypeFont(verdanaBold); labelFont.Size = 12; PDFAnsiTrueTypeFont contentFont = new PDFAnsiTrueTypeFont(verdana); contentFont.Size = 12; PDFFlowTableContent invoiceInfoTable = new PDFFlowTableContent(5); invoiceInfoTable.MinRowHeight = 20; invoiceInfoTable.Columns[0].VerticalAlign = PDFGraphicAlign.Center; invoiceInfoTable.Columns[0].Width = 250; invoiceInfoTable.Columns[0].WidthIsRelativeToTable = false; invoiceInfoTable.Columns[1].HorizontalAlign = PDFGraphicAlign.Far; invoiceInfoTable.Columns[1].VerticalAlign = PDFGraphicAlign.Center; invoiceInfoTable.Columns[1].Width = 50; invoiceInfoTable.Columns[1].WidthIsRelativeToTable = false; invoiceInfoTable.Columns[2].VerticalAlign = PDFGraphicAlign.Center; invoiceInfoTable.Columns[2].HorizontalAlign = PDFGraphicAlign.Far; invoiceInfoTable.Columns[2].Width = 80; invoiceInfoTable.Columns[2].WidthIsRelativeToTable = false; invoiceInfoTable.Columns[3].HorizontalAlign = PDFGraphicAlign.Far; invoiceInfoTable.Columns[3].VerticalAlign = PDFGraphicAlign.Center; invoiceInfoTable.Columns[3].Width = 80; invoiceInfoTable.Columns[3].WidthIsRelativeToTable = false; invoiceInfoTable.Columns[4].HorizontalAlign = PDFGraphicAlign.Far; invoiceInfoTable.Columns[4].VerticalAlign = PDFGraphicAlign.Center; invoiceInfoTable.Columns[4].Width = 80; invoiceInfoTable.Columns[4].WidthIsRelativeToTable = false; (invoiceInfoTable.DefaultCell as PDFFlowTableStringCell).Font = contentFont; PDFFlowTableRow row = invoiceInfoTable.Rows.AddRowWithCells("Description", "Qty", "Price", "Total", "VAT/Tax"); for (int i = 0; i < row.Cells.Count; i++) { (row.Cells[i] as PDFFlowTableStringCell).Font = labelFont; (row.Cells[i] as PDFFlowTableStringCell).Color = new PDFBrush(PDFRgbColor.White); } row.Background = new PDFBrush(PDFRgbColor.Black); row = invoiceInfoTable.Rows.AddRowWithCells("Sample green item", "1", "100.00", "100.00", "20.00"); row.Background = new PDFBrush(PDFRgbColor.LightGray); row = invoiceInfoTable.Rows.AddRowWithCells("Big pink box", "3", "250.00", "750.00", "150.00"); row = invoiceInfoTable.Rows.AddRowWithCells("Yellow glass bowl", "2", "200.00", "400.00", "80.00"); row.Background = new PDFBrush(PDFRgbColor.LightGray); row = invoiceInfoTable.Rows.AddRowWithCells("Total", "", "", "1250.00", "250.00"); row = invoiceInfoTable.Rows.AddRowWithCells("Total (including VAT/Tax)", "", "", "1500.00", ""); (row.Cells[0] as PDFFlowTableStringCell).Font = labelFont; (row.Cells[3] as PDFFlowTableStringCell).Font = labelFont; return(invoiceInfoTable); }
private static PDFFlowContent BuildSellerSection(PDFAnsiTrueTypeFont verdana, PDFAnsiTrueTypeFont verdanaBold) { PDFAnsiTrueTypeFont labelFont = new PDFAnsiTrueTypeFont(verdanaBold); labelFont.Size = 12; PDFAnsiTrueTypeFont contentFont = new PDFAnsiTrueTypeFont(verdana); contentFont.Size = 12; PDFFormattedContent sellerInfo = new PDFFormattedContent(); sellerInfo.Paragraphs.Add(new PDFFormattedTextBlock("DemoCompany LLC", contentFont)); sellerInfo.Paragraphs.Add(new PDFFormattedTextBlock("3000 Alandala Road", contentFont)); sellerInfo.Paragraphs.Add(new PDFFormattedTextBlock("Beverly Hills", contentFont)); sellerInfo.Paragraphs.Add(new PDFFormattedTextBlock("CA 90210", contentFont)); sellerInfo.Paragraphs.Add(new PDFFormattedTextBlock("United States", contentFont)); sellerInfo.Paragraphs.Add(" "); PDFFormattedTextBlock labelPhone = new PDFFormattedTextBlock("Phone: ", labelFont); PDFFormattedTextBlock phone = new PDFFormattedTextBlock("+1-555-123-4567", contentFont); sellerInfo.Paragraphs.Add(labelPhone, phone); PDFFormattedTextBlock labelFax = new PDFFormattedTextBlock("Fax: ", labelFont); PDFFormattedTextBlock fax = new PDFFormattedTextBlock("+1-555-456-7890", contentFont); sellerInfo.Paragraphs.Add(labelFax, fax); PDFFormattedTextBlock labelEmail = new PDFFormattedTextBlock("Email: ", labelFont); PDFFormattedTextBlock email = new PDFFormattedTextBlock("*****@*****.**", contentFont); email.TextColor = new PDFBrush(PDFRgbColor.Blue); email.Action = new PDFUriAction("mailto:[email protected]"); sellerInfo.Paragraphs.Add(labelEmail, email); PDFFormattedTextBlock labelWeb = new PDFFormattedTextBlock("Web: ", labelFont); PDFFormattedTextBlock web = new PDFFormattedTextBlock("www.o2sol.com", contentFont); web.TextColor = new PDFBrush(PDFRgbColor.Blue); web.Action = new PDFUriAction("http://www.o2sol.com"); sellerInfo.Paragraphs.Add(labelWeb, web); for (int i = 0; i < sellerInfo.Paragraphs.Count; i++) { sellerInfo.Paragraphs[i].HorizontalAlign = PDFStringHorizontalAlign.Right; } PDFFlowTextContent sellerInfoText = new PDFFlowTextContent(sellerInfo); return(sellerInfoText); }
private static PDFFlowContent BuildHeader(PDFAnsiTrueTypeFont verdanaBold) { PDFAnsiTrueTypeFont headerFont = new PDFAnsiTrueTypeFont(verdanaBold); headerFont.Size = 16; PDFFlowTableContent headerTable = new PDFFlowTableContent(1); PDFFlowTableRow row = headerTable.Rows.AddRowWithCells("Continents, countries and populations"); (row.Cells[0] as PDFFlowTableStringCell).Font = headerFont; row.Cells[0].HorizontalAlign = PDFGraphicAlign.Center; row.MinHeight = 40; return(headerTable); }
private static PDFFlowContent BuildHeader(PDFAnsiTrueTypeFont verdana, PDFImage logoImage) { PDFFlowTableContent headerTable = new PDFFlowTableContent(2); PDFFlowTableRow row = headerTable.Rows.AddRowWithCells("Invoice", logoImage); PDFAnsiTrueTypeFont headerFont = new PDFAnsiTrueTypeFont(verdana); headerFont.Size = 36; (row.Cells[0] as PDFFlowTableStringCell).Font = headerFont; row.Cells[0].VerticalAlign = PDFGraphicAlign.Center; row.Cells[1].HorizontalAlign = PDFGraphicAlign.Far; (row.Cells[1] as PDFFlowTableImageCell).ImageWidth = 135; return(headerTable); }
/// <summary> /// Main method for running the sample. /// </summary> public static SampleOutputInfo[] Run(Stream verdanaFontStream) { PDFAnsiTrueTypeFont verdana = new PDFAnsiTrueTypeFont(verdanaFontStream, 36, true); PDFFlowDocument document = new PDFFlowDocument(); PDFFlowContent superscriptSection = BuildSuperscript(verdana); document.AddContent(superscriptSection); PDFFlowContent subscriptSection = BuildSubscript(verdana); document.AddContent(subscriptSection); SampleOutputInfo[] output = new SampleOutputInfo[] { new SampleOutputInfo(document, "superscriptsubscript.pdf") }; return(output); }
/// <summary> /// Main method for running the sample. /// </summary> public static SampleOutputInfo[] Run(Stream verdanaFontStream, Stream verdanaBoldFontStream, Stream data) { PDFAnsiTrueTypeFont verdana = new PDFAnsiTrueTypeFont(verdanaFontStream, 1, true); PDFAnsiTrueTypeFont verdanaBold = new PDFAnsiTrueTypeFont(verdanaBoldFontStream, 1, true); PDFFlowDocument document = new PDFFlowDocument(); PDFFlowContent header = BuildHeader(verdanaBold); document.AddContent(header); PDFFlowContent attendantsSection = BuildCountriesList(verdana, verdanaBold, data); document.AddContent(attendantsSection); SampleOutputInfo[] output = new SampleOutputInfo[] { new SampleOutputInfo(document, "tablegroups.pdf") }; return(output); }
private void CreateIntroPage(PDFFlowDocument document, PDFAnsiTrueTypeFont verdana, PDFAnsiTrueTypeFont verdanaBold) { PDFFormattedParagraph titleParagraph = new PDFFormattedParagraph("DOCUMENT INTRO PAGE"); titleParagraph.SpacingBefore = 300; (titleParagraph.Blocks[0] as PDFFormattedTextBlock).Font = new PDFAnsiTrueTypeFont(verdanaBold); (titleParagraph.Blocks[0] as PDFFormattedTextBlock).Font.Size = 36; titleParagraph.HorizontalAlign = PDFStringHorizontalAlign.Center; PDFFormattedParagraph subtitleParagraph = new PDFFormattedParagraph("no headers and footers"); (subtitleParagraph.Blocks[0] as PDFFormattedTextBlock).Font = new PDFAnsiTrueTypeFont(verdana); (subtitleParagraph.Blocks[0] as PDFFormattedTextBlock).Font.Size = 10; subtitleParagraph.HorizontalAlign = PDFStringHorizontalAlign.Center; PDFFormattedContent fc = new PDFFormattedContent(); fc.Paragraphs.Add(titleParagraph); fc.Paragraphs.Add(subtitleParagraph); document.AddContent(new PDFFlowTextContent(fc)); }
/// <summary> /// Main method for running the sample. /// </summary> public static SampleOutputInfo Run(Stream verdanaInput, Stream verdanaBoldInput, Stream imageStream) { PDFAnsiTrueTypeFont verdana = new PDFAnsiTrueTypeFont(verdanaInput, 10, true); PDFAnsiTrueTypeFont verdanaBold = new PDFAnsiTrueTypeFont(verdanaBoldInput, 10, true); PDFFixedDocument document = new PDFFixedDocument(); document.Language = "en-US"; document.DocumentInformation = new PDFDocumentInformation(); document.DocumentInformation.Author = "O2 Solutions"; document.DocumentInformation.Title = "PDF4NET PDF/UA Demo"; document.DocumentInformation.Creator = "PDF4NET PDF/UA Demo Application"; document.DocumentInformation.Producer = "PDF4NET"; document.DocumentInformation.Keywords = "pdf/ua"; document.DocumentInformation.Subject = "PDF/UA-1 Sample produced by PDF4NET"; document.XmpMetadata = new PDFXmpMetadata(); document.ViewerPreferences = new PDFViewerPreferences(); document.ViewerPreferences.DisplayDocumentTitle = true; document.MarkInformation = new PDFMarkInformation(); document.MarkInformation.IsTaggedPDF = true; document.StructureTree = new PDFStructureTree(); PDFStructureElement seDocument = new PDFStructureElement(PDFStandardStructureTypes.Document); seDocument.Title = "PDF4NET PDF/UA-1 Demo"; document.StructureTree.StructureElements = seDocument; SimpleText(document, seDocument, verdana, imageStream); FormattedContent(document, seDocument, verdana); AnnotationsAndFormFields(document, seDocument, verdana); return(new SampleOutputInfo(document, "pdfua1.pdf")); }
private static void DrawTrueTypeFonts(PDFPage page, Stream ttfStream) { PDFStandardFont titleFont = new PDFStandardFont(PDFStandardFontFace.HelveticaBold, 22); PDFBrush blackBrush = new PDFBrush(new PDFRgbColor()); page.Canvas.DrawString("TrueType fonts", titleFont, blackBrush, 20, 50); page.Canvas.DrawString("(when embedded they should be supported", titleFont, blackBrush, 20, 75); page.Canvas.DrawString(" by any PDF viewer)", titleFont, blackBrush, 20, 100); PDFAnsiTrueTypeFont ansiVerdana = new PDFAnsiTrueTypeFont(ttfStream, 16, true); page.Canvas.DrawString("Verdana - Ansi TrueType font", ansiVerdana, blackBrush, 20, 150); page.Canvas.DrawString("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", ansiVerdana, blackBrush, 20, 175); ttfStream.Position = 0; PDFUnicodeTrueTypeFont unicodeVerdana = new PDFUnicodeTrueTypeFont(ttfStream, 16, true); page.Canvas.DrawString("Verdana - Unicode TrueType font", unicodeVerdana, blackBrush, 20, 225); page.Canvas.DrawString("Russian - Пример русский текст демо шрифт.", unicodeVerdana, blackBrush, 20, 250); page.Canvas.DrawString("Greek - Δείγμα ελληνικό κείμενο demo γραμματοσειράς.", unicodeVerdana, blackBrush, 20, 275); }
public PDFFlowDocument CreateDocument(Stream verdanaFontStream, Stream verdanaBoldFontStream) { PDFAnsiTrueTypeFont verdana = new PDFAnsiTrueTypeFont(verdanaFontStream, 10, true); PDFAnsiTrueTypeFont verdanaBold = new PDFAnsiTrueTypeFont(verdanaBoldFontStream, 10, true); PDFFlowDocumentDefaults documentDefaults = new PDFFlowDocumentDefaults(); documentDefaults.PageDefaults.Margins.Top = 72; documentDefaults.PageDefaults.Margins.Bottom = 72; PDFFlowDocument document = new PDFFlowDocument(documentDefaults); document.PageCompleted += Document_PageCompleted; CreateHeadersAndFooters(document, verdana); CreateIntroPage(document, verdana, verdanaBold); for (int i = 0; i < 5; i++) { CreateContentPage(document, verdana, i); } return(document); }
private static PDFFlowContent BuildAttendantsList(PDFAnsiTrueTypeFont verdana, PDFAnsiTrueTypeFont verdanaBold, Stream data) { PDFAnsiTrueTypeFont textFont = new PDFAnsiTrueTypeFont(verdana); textFont.Size = 10; PDFAnsiTrueTypeFont headerFont = new PDFAnsiTrueTypeFont(verdanaBold); headerFont.Size = 12; PDFFlowTableContent attendantsTable = new PDFFlowTableContent(5); attendantsTable.Border = new PDFPen(PDFRgbColor.Black, 0.5); attendantsTable.MinRowHeight = 15; (attendantsTable.DefaultCell as PDFFlowTableStringCell).Font = textFont; attendantsTable.Columns[0].VerticalAlign = PDFGraphicAlign.Center; attendantsTable.Columns[0].Width = 120; attendantsTable.Columns[0].WidthIsRelativeToTable = false; attendantsTable.Columns[1].VerticalAlign = PDFGraphicAlign.Center; attendantsTable.Columns[1].Width = 210; attendantsTable.Columns[1].WidthIsRelativeToTable = false; attendantsTable.Columns[2].VerticalAlign = PDFGraphicAlign.Center; attendantsTable.Columns[2].Width = 100; attendantsTable.Columns[2].WidthIsRelativeToTable = false; attendantsTable.Columns[3].VerticalAlign = PDFGraphicAlign.Center; attendantsTable.Columns[3].Width = 190; attendantsTable.Columns[3].WidthIsRelativeToTable = false; attendantsTable.Columns[4].VerticalAlign = PDFGraphicAlign.Center; attendantsTable.Columns[4].Width = 130; attendantsTable.Columns[4].WidthIsRelativeToTable = false; PDFFlowTableRow row = attendantsTable.Rows.AddRowWithCells("Name", "Email", "Phone", "Company", "Country"); for (int i = 0; i < row.Cells.Count; i++) { (row.Cells[i] as PDFFlowTableStringCell).Font = headerFont; (row.Cells[i] as PDFFlowTableStringCell).Color = new PDFBrush(PDFRgbColor.White); row.Cells[i].HorizontalAlign = PDFGraphicAlign.Center; } row.Background = new PDFBrush(PDFRgbColor.Black); int counter = 0; PDFBrush alternateBackground = new PDFBrush(PDFRgbColor.LightGray); StreamReader sr = new StreamReader(data); string line = sr.ReadLine(); while (line != null) { string[] items = line.Split('|'); row = attendantsTable.Rows.AddRowWithCells(items); line = sr.ReadLine(); if (counter % 2 == 0) { row.Background = alternateBackground; } counter++; } return(attendantsTable); }
/// <summary> /// Main method for running the sample. /// </summary> public static SampleOutputInfo[] Run(Stream verdanaFontStream) { PDFAnsiTrueTypeFont textFont = new PDFAnsiTrueTypeFont(verdanaFontStream, 10, true); PDFAnsiTrueTypeFont headerFont = new PDFAnsiTrueTypeFont(textFont); headerFont.Size = 16; PDFFlowDocument document = new PDFFlowDocument(); PDFFlowTableContent headerTable = new PDFFlowTableContent(1); PDFFlowTableRow row = headerTable.Rows.AddRowWithCells("Store sales by year"); (row.Cells[0] as PDFFlowTableStringCell).Font = headerFont; row.Cells[0].HorizontalAlign = PDFGraphicAlign.Center; row.MinHeight = 40; document.AddContent(headerTable); PDFFlowTableContent itemsTable = new PDFFlowTableContent(4); (itemsTable.DefaultCell as PDFFlowTableStringCell).Font = textFont; itemsTable.Border = new PDFPen(PDFRgbColor.Black, 0.5); itemsTable.MinRowHeight = 15; itemsTable.Columns[2].VerticalAlign = PDFGraphicAlign.Center; itemsTable.Columns[3].VerticalAlign = PDFGraphicAlign.Center; itemsTable.Columns[3].HorizontalAlign = PDFGraphicAlign.Far; row = itemsTable.Rows.AddRowWithCells("Tablets", "iPad Air 2", "2013", "213,554"); row.Cells[0].RowSpan = 12; row.Cells[1].RowSpan = 3; itemsTable.Rows.AddRowWithCells("2014", "123,443"); itemsTable.Rows.AddRowWithCells("2015", "64,443"); row = itemsTable.Rows.AddRowWithCells("iPad Pro", "2013", "342,443"); row.Cells[0].RowSpan = 3; itemsTable.Rows.AddRowWithCells("2014", "56,332"); itemsTable.Rows.AddRowWithCells("2015", "765,231"); row = itemsTable.Rows.AddRowWithCells("Nexus 7", "2013", "432,541"); row.Cells[0].RowSpan = 3; itemsTable.Rows.AddRowWithCells("2014", "213,871"); itemsTable.Rows.AddRowWithCells("2015", "112,332"); row = itemsTable.Rows.AddRowWithCells("Nexus 9", "2013", "342,434"); row.Cells[0].RowSpan = 3; itemsTable.Rows.AddRowWithCells("2014", "231,778"); itemsTable.Rows.AddRowWithCells("2015", "119,324"); row = itemsTable.Rows.AddRowWithCells("Smartphones", "Samsung Galaxy S5", "2013", "1,543,321"); row.Cells[0].RowSpan = 12; row.Cells[1].RowSpan = 3; itemsTable.Rows.AddRowWithCells("2014", "1,435,875"); itemsTable.Rows.AddRowWithCells("2015", "1,876,324"); row = itemsTable.Rows.AddRowWithCells("Samsung Galaxy S6", "2013", "1,432,134"); row.Cells[0].RowSpan = 3; itemsTable.Rows.AddRowWithCells("2014", "1,232,432"); itemsTable.Rows.AddRowWithCells("2015", "1,765,112"); row = itemsTable.Rows.AddRowWithCells("iPhone 6", "2013", "1,433,665"); row.Cells[0].RowSpan = 3; itemsTable.Rows.AddRowWithCells("2014", "2,443,245"); itemsTable.Rows.AddRowWithCells("2015", "1,656,334"); row = itemsTable.Rows.AddRowWithCells("iPhone 6 Plus", "2013", "994,123"); row.Cells[0].RowSpan = 3; itemsTable.Rows.AddRowWithCells("2014", "443,546"); itemsTable.Rows.AddRowWithCells("2015", "765,342"); document.AddContent(itemsTable); SampleOutputInfo[] output = new SampleOutputInfo[] { new SampleOutputInfo(document, "tablecellspans.pdf") }; return(output); }
private static void SimpleText(PDFFixedDocument document, PDFStructureElement seParent, PDFAnsiTrueTypeFont font, Stream imageStream) { PDFAnsiTrueTypeFont headingFont = new PDFAnsiTrueTypeFont(font, 16); PDFAnsiTrueTypeFont textFont = new PDFAnsiTrueTypeFont(font, 10); PDFBrush blackBrush = new PDFBrush(PDFRgbColor.Black); PDFPen blackPen = new PDFPen(PDFRgbColor.Black, 1); PDFPage page = document.Pages.Add(); PDFStructureElement seSection = new PDFStructureElement(PDFStandardStructureTypes.Section); seSection.Title = "Simple text"; seParent.AppendChild(seSection); PDFStructureElement seHeading = new PDFStructureElement(PDFStandardStructureTypes.Heading); seSection.AppendChild(seHeading); page.Graphics.BeginStructureElement(seHeading); page.Graphics.DrawString("Page heading", headingFont, blackBrush, 30, 50); page.Graphics.EndStructureElement(); PDFStructureElement seParagraph1 = new PDFStructureElement(PDFStandardStructureTypes.Paragraph); seSection.AppendChild(seParagraph1); page.Graphics.BeginStructureElement(seParagraph1); page.Graphics.DrawString("Sample paragraph. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris in sodales ligula at lobortis.", textFont, blackBrush, 30, 70); page.Graphics.EndStructureElement(); PDFStructureElement seFigure = new PDFStructureElement(PDFStandardStructureTypes.Figure); seFigure.ActualText = "PDF4NET"; seFigure.AlternateDescription = "PDF4NET Logo"; seSection.AppendChild(seFigure); page.Graphics.BeginStructureElement(seFigure); PDFPngImage logoImage = new PDFPngImage(imageStream); page.Graphics.DrawImage(logoImage, 30, 90, 256, 128); page.Graphics.EndStructureElement(); // A structure element with 2 content items and an artifact between them. PDFStructureElement seParagraph2 = new PDFStructureElement(PDFStandardStructureTypes.Paragraph); seSection.AppendChild(seParagraph2); page.Graphics.BeginStructureElement(seParagraph2); page.Graphics.DrawString("First line of text.", textFont, blackBrush, 30, 230); page.Graphics.EndStructureElement(); page.Graphics.BeginArtifactMarkedContent(); page.Graphics.DrawLine(blackPen, 30, 242, 100, 242); page.Graphics.EndMarkedContent(); page.Graphics.BeginStructureElement(seParagraph2); page.Graphics.DrawString("Second line of text.", textFont, blackBrush, 30, 245); page.Graphics.EndStructureElement(); PDFStructureElement seParagraph3 = new PDFStructureElement(PDFStandardStructureTypes.Paragraph); seSection.AppendChild(seParagraph3); string text = "Paragraph with underlined text. The structure element is passed as parameter to DrawString method in order to properly tag graphic artifacts such as underlines. " + "Morbi pulvinar eros sit amet diam lacinia, ut feugiat ligula bibendum. Suspendisse ultrices cursus condimentum. " + "Pellentesque semper iaculis luctus. Sed ac maximus urna. Aliquam erat volutpat. Vivamus vel sollicitudin dui. Aenean efficitur " + "fringilla dui, at varius lacus luctus ac. Quisque tellus dui, lacinia non lectus nec, semper faucibus erat."; PDFStringAppearanceOptions sao = new PDFStringAppearanceOptions(); sao.Brush = blackBrush; sao.Font = textFont; sao.Font.Underline = true; PDFStringLayoutOptions slo = new PDFStringLayoutOptions(); slo.X = 30; slo.Y = 260; slo.Width = 550; page.Graphics.DrawString(text, sao, slo, seParagraph3); // A custom structure element that will be mapped to standard Pargraph structure. PDFStructureElement seSpecialParagraph = new PDFStructureElement("SpecialParagraph"); // The structure element specifies an ID that needs to be added to document's IDMap. seSpecialParagraph.ID = "specialpara"; seSection.AppendChild(seSpecialParagraph); page.Graphics.BeginStructureElement(seSpecialParagraph); textFont.Underline = false; textFont.Size = 18; page.Graphics.DrawString("A special paragraph with custom structure element type.", textFont, blackBrush, 30, 350); page.Graphics.EndStructureElement(); // Map the custom structure type to a known structure type. document.StructureTree.RoleMap = new PDFRoleMap(); document.StructureTree.RoleMap["SpecialParagraph"] = PDFStandardStructureTypes.Paragraph; // Include the ID of the structure element in the document's identifiers map. document.StructureTree.IdentifierMap = new PDFIdMap(); document.StructureTree.IdentifierMap["specialpara"] = seSpecialParagraph; }
private static void AnnotationsAndFormFields(PDFFixedDocument document, PDFStructureElement seParent, PDFAnsiTrueTypeFont font) { PDFAnsiTrueTypeFont headingFont = new PDFAnsiTrueTypeFont(font, 16); PDFAnsiTrueTypeFont textFont = new PDFAnsiTrueTypeFont(font, 10); PDFBrush blackBrush = new PDFBrush(PDFRgbColor.Black); PDFPen blackPen = new PDFPen(PDFRgbColor.Black, 1); PDFPage page = document.Pages.Add(); page.TabOrder = PDFPageTabOrder.Structure; PDFStructureElement seSection = new PDFStructureElement(PDFStandardStructureTypes.Section); seSection.Title = "Annotations and form fields"; seParent.AppendChild(seSection); PDFStructureElement seHeading = new PDFStructureElement(PDFStandardStructureTypes.Heading); seSection.AppendChild(seHeading); page.Graphics.BeginStructureElement(seHeading); page.Graphics.DrawString("Annotations and form fields", headingFont, blackBrush, 30, 50); page.Graphics.EndStructureElement(); PDFStructureElement seParagraph1 = new PDFStructureElement(PDFStandardStructureTypes.Paragraph); seSection.AppendChild(seParagraph1); page.Graphics.BeginStructureElement(seParagraph1); page.Graphics.DrawString("Our website:", textFont, blackBrush, 30, 70); page.Graphics.EndStructureElement(); PDFStructureElement seLink = new PDFStructureElement(PDFStandardStructureTypes.Link); seParagraph1.AppendChild(seLink); page.Graphics.BeginStructureElement(seLink); page.Graphics.DrawString("http://www.o2sol.com/", textFont, blackBrush, 100, 70); page.Graphics.EndStructureElement(); PDFLinkAnnotation link = new PDFLinkAnnotation(); page.Annotations.Add(link); link.DisplayRectangle = new PDFVisualRectangle(95, 70, 130, 10); link.HighlightStyle = PDFLinkAnnotationHighlightStyle.Invert; link.Contents = "http://www.o2sol.com/"; PDFObjectReference linkRef = new PDFObjectReference(); linkRef.Page = page; linkRef.Stream = link.CosDictionary as PDFCosDictionaryContainer; seLink.AppendChild(linkRef); document.StructureTree.MapObjectReference(link, seLink); PDFStructureElement seParagraph2 = new PDFStructureElement(PDFStandardStructureTypes.Paragraph); seSection.AppendChild(seParagraph2); page.Graphics.BeginStructureElement(seParagraph2); page.Graphics.DrawString("Enter your name:", textFont, blackBrush, 30, 100); page.Graphics.EndStructureElement(); PDFStructureElement seForm = new PDFStructureElement(PDFStandardStructureTypes.Form); seParagraph2.AppendChild(seForm); PDFTextBoxField fldName = new PDFTextBoxField("name"); page.Fields.Add(fldName); fldName.AlternateName = "Enter your name"; fldName.Widgets[0].DisplayRectangle = new PDFVisualRectangle(120, 95, 130, 20); fldName.Widgets[0].BorderColor = PDFRgbColor.Blue; fldName.Widgets[0].BorderWidth = 1; fldName.Widgets[0].BackgroundColor = PDFRgbColor.LightBlue; fldName.Widgets[0].Font = textFont; PDFObjectReference fieldRef = new PDFObjectReference(); fieldRef.Page = page; fieldRef.Stream = fldName.Widgets[0].CosDictionary as PDFCosDictionaryContainer; seForm.AppendChild(fieldRef); document.StructureTree.MapObjectReference(fldName.Widgets[0], seForm); }
private static void FormattedContent(PDFFixedDocument document, PDFStructureElement seParent, PDFAnsiTrueTypeFont font) { string text1 = "Morbi pulvinar eros sit amet diam lacinia, ut feugiat ligula bibendum. Suspendisse ultrices cursus condimentum. " + "Pellentesque semper iaculis luctus. Sed ac maximus urna. Aliquam erat volutpat. "; string text2 = "Vivamus vel sollicitudin dui. Aenean efficitur " + "fringilla dui, at varius lacus luctus ac. Quisque tellus dui, lacinia non lectus nec, semper faucibus erat."; PDFAnsiTrueTypeFont headingFont = new PDFAnsiTrueTypeFont(font, 16); PDFAnsiTrueTypeFont textFont = new PDFAnsiTrueTypeFont(font, 10); PDFBrush blackBrush = new PDFBrush(PDFRgbColor.Black); PDFPen blackPen = new PDFPen(PDFRgbColor.Black, 1); PDFPage page = document.Pages.Add(); page.TabOrder = PDFPageTabOrder.Structure; PDFStructureElement seSection = new PDFStructureElement(PDFStandardStructureTypes.Section); seSection.Title = "Formatted content"; seParent.AppendChild(seSection); PDFStructureElement seHeading = new PDFStructureElement(PDFStandardStructureTypes.Heading); seSection.AppendChild(seHeading); page.Graphics.BeginStructureElement(seHeading); page.Graphics.DrawString("Another heading", headingFont, blackBrush, 30, 50); page.Graphics.EndStructureElement(); PDFFormattedContent fc = new PDFFormattedContent(); PDFFormattedParagraph paragraph1 = new PDFFormattedParagraph(text1, textFont); paragraph1.LineSpacing = 1.2; paragraph1.LineSpacingMode = PDFFormattedParagraphLineSpacing.Multiple; paragraph1.StructureElement = new PDFStructureElement(PDFStandardStructureTypes.Paragraph); seSection.AppendChild(paragraph1.StructureElement); fc.Paragraphs.Add(paragraph1); PDFFormattedTextBlock block1 = new PDFFormattedTextBlock("Sample paragraph with a link.\r\n", textFont); block1.StructureElement = new PDFStructureElement(PDFStandardStructureTypes.Span); PDFFormattedTextBlock block2 = new PDFFormattedTextBlock("http://www.o2sol.com/\r\n", textFont); block2.TextColor = new PDFBrush(PDFRgbColor.Blue); block2.Action = new PDFUriAction("http://www.o2sol.com/"); block2.StructureElement = new PDFStructureElement(PDFStandardStructureTypes.Link); PDFFormattedTextBlock block3 = new PDFFormattedTextBlock("http://www.pdf4net.com/", textFont); block3.TextColor = new PDFBrush(PDFRgbColor.Blue); block3.Action = new PDFUriAction("http://www.pdf4net.com/"); block3.StructureElement = new PDFStructureElement(PDFStandardStructureTypes.Link); PDFFormattedParagraph paragraph2 = new PDFFormattedParagraph(block1, block2, block3); paragraph2.LineSpacing = 1.2; paragraph2.LineSpacingMode = PDFFormattedParagraphLineSpacing.Multiple; paragraph2.StructureElement = new PDFStructureElement(PDFStandardStructureTypes.Paragraph); // Do not mark the paragraph in the content stream, instead its blocks will be marked. paragraph2.StructureElement.GenerateMarkedContentSequence = false; paragraph2.StructureElement.AppendChild(block1.StructureElement); paragraph2.StructureElement.AppendChild(block2.StructureElement); paragraph2.StructureElement.AppendChild(block3.StructureElement); seSection.AppendChild(paragraph2.StructureElement); fc.Paragraphs.Add(paragraph2); PDFFormattedParagraph paragraph3 = new PDFFormattedParagraph(text2, textFont); paragraph3.LineSpacing = 1.2; paragraph3.LineSpacingMode = PDFFormattedParagraphLineSpacing.Multiple; paragraph3.StructureElement = new PDFStructureElement(PDFStandardStructureTypes.Paragraph); seSection.AppendChild(paragraph3.StructureElement); fc.Paragraphs.Add(paragraph3); page.Graphics.DrawFormattedContent(fc, 30, 70, 550, 0); }
private void CreateHeadersAndFooters(PDFFlowDocument document, PDFAnsiTrueTypeFont verdana) { PDFFlowDocumentHeader mainHeader = new PDFFlowDocumentHeader(); mainHeader.TopMargin = 24; PDFFlowTableContent mainHeaderTable = new PDFFlowTableContent(1); mainHeaderTable.Rows.AddRowWithCells("Page"); mainHeaderTable.Rows[0].MinHeight = 15; PDFFlowTableStringCell mainHeaderTableCell = mainHeaderTable.Rows[0].Cells[0] as PDFFlowTableStringCell; mainHeaderTableCell.Font = new PDFAnsiTrueTypeFont(verdana); mainHeaderTableCell.Font.Size = 8; mainHeaderTableCell.HorizontalAlign = PDFGraphicAlign.Far; mainHeaderTableCell.VerticalAlign = PDFGraphicAlign.Center; mainHeaderTableCell.Borders = new PDFFlowContentBorders(); mainHeaderTableCell.Borders.Bottom = new PDFPen(PDFRgbColor.Black, 1); mainHeader.Content.Add(mainHeaderTable); document.HeadersFooters.MainHeader = mainHeader; PDFFlowDocumentHeader evenPagesHeader = new PDFFlowDocumentHeader(); evenPagesHeader.TopMargin = 24; PDFFlowTableContent evenPagesHeaderTable = new PDFFlowTableContent(1); evenPagesHeaderTable.Rows.AddRowWithCells("Page"); evenPagesHeaderTable.Rows[0].MinHeight = 15; PDFFlowTableStringCell evenPagesHeaderTableCell = evenPagesHeaderTable.Rows[0].Cells[0] as PDFFlowTableStringCell; evenPagesHeaderTableCell.Font = new PDFAnsiTrueTypeFont(verdana); evenPagesHeaderTableCell.Font.Size = 8; evenPagesHeaderTableCell.HorizontalAlign = PDFGraphicAlign.Near; evenPagesHeaderTableCell.VerticalAlign = PDFGraphicAlign.Center; evenPagesHeaderTableCell.Borders = new PDFFlowContentBorders(); evenPagesHeaderTableCell.Borders.Bottom = new PDFPen(PDFRgbColor.Black, 1); evenPagesHeader.Content.Add(evenPagesHeaderTable); document.HeadersFooters.EvenPagesHeader = evenPagesHeader; document.HeadersFooters.FirstPageHeader = null; PDFFlowDocumentFooter mainFooter = new PDFFlowDocumentFooter(); mainFooter.BottomMargin = 24; PDFFlowTableContent mainFooterTable = new PDFFlowTableContent(1); mainFooterTable.Rows.AddRowWithCells("Page"); mainFooterTable.Rows[0].MinHeight = 15; PDFFlowTableStringCell mainFooterTableCell = mainFooterTable.Rows[0].Cells[0] as PDFFlowTableStringCell; mainFooterTableCell.Font = new PDFAnsiTrueTypeFont(verdana); mainFooterTableCell.Font.Size = 8; mainFooterTableCell.HorizontalAlign = PDFGraphicAlign.Far; mainFooterTableCell.VerticalAlign = PDFGraphicAlign.Center; mainFooterTableCell.Borders = new PDFFlowContentBorders(); mainFooterTableCell.Borders.Top = new PDFPen(PDFRgbColor.Black, 1); mainFooter.Content.Add(mainFooterTable); document.HeadersFooters.MainFooter = mainFooter; PDFFlowDocumentFooter evenPagesFooter = new PDFFlowDocumentFooter(); evenPagesFooter.BottomMargin = 24; PDFFlowTableContent evenPagesFooterTable = new PDFFlowTableContent(1); evenPagesFooterTable.Rows.AddRowWithCells("Page"); evenPagesFooterTable.Rows[0].MinHeight = 15; PDFFlowTableStringCell evenPagesFooterTableCell = evenPagesFooterTable.Rows[0].Cells[0] as PDFFlowTableStringCell; evenPagesFooterTableCell.Font = new PDFAnsiTrueTypeFont(verdana); evenPagesFooterTableCell.Font.Size = 8; evenPagesFooterTableCell.HorizontalAlign = PDFGraphicAlign.Near; evenPagesFooterTableCell.VerticalAlign = PDFGraphicAlign.Center; evenPagesFooterTableCell.Borders = new PDFFlowContentBorders(); evenPagesFooterTableCell.Borders.Top = new PDFPen(PDFRgbColor.Black, 1); evenPagesFooter.Content.Add(evenPagesFooterTable); document.HeadersFooters.EvenPagesFooter = evenPagesFooter; document.HeadersFooters.FirstPageFooter = null; }
private void CreateContentPage(PDFFlowDocument document, PDFAnsiTrueTypeFont verdana, int textIndex) { string[] text = new string[] { "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras commodo elementum odio, non venenatis risus efficitur a. " + "Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sit amet purus eget sem tristique faucibus. " + "Nam ut felis vel ex ullamcorper pretium at quis nisl. Nam ac lacus tincidunt, vulputate sapien vel, tempus sem. Aliquam vel ligula dui. " + "Vivamus porttitor nunc vitae mi interdum, vitae ullamcorper turpis bibendum. Vestibulum sagittis lorem ante, at tincidunt arcu suscipit eu. " + "Morbi augue eros, tristique a consectetur ac, egestas nec turpis. Praesent non purus quis sem consequat tempor sed ac augue. Integer at mauris ac ipsum bibendum aliquam vitae id mi. " + "Praesent efficitur tortor in ligula mattis scelerisque. Fusce in placerat augue. Mauris pretium, dui ac accumsan aliquet, justo sem posuere purus, " + "sit amet tristique mi tortor malesuada lorem. Sed congue sem a neque tristique tristique et a odio. Curabitur quis aliquam turpis, tincidunt ullamcorper velit. " + "Phasellus posuere, justo auctor convallis luctus, mi tortor interdum lorem, ac tempor nisi lorem in erat. Maecenas dapibus tristique lacus id egestas. " + "Vivamus id risus vitae velit porta lacinia. Aliquam erat volutpat. Nulla facilisi. Donec tempor arcu eu rhoncus fringilla.", "Vivamus ullamcorper ligula sit amet interdum imperdiet. Nulla facilisi. Suspendisse et euismod elit. Quisque vitae magna nunc. " + "Mauris condimentum at magna blandit semper. Pellentesque in lacus odio. Sed nec molestie lacus, eget scelerisque lorem. " + "Etiam rutrum tellus at auctor vehicula. Mauris consequat, tortor vitae finibus efficitur, tellus arcu feugiat leo, in condimentum elit felis ut risus. " + "Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce tincidunt libero sem, ut hendrerit turpis dapibus ut. " + "Donec lacinia luctus scelerisque. Sed vulputate egestas accumsan. Cras volutpat enim neque, malesuada varius lorem volutpat eget. Mauris lobortis risus ut leo malesuada, " + "in volutpat felis finibus. Proin a gravida velit. Ut lorem urna, sollicitudin sit amet nibh at, vestibulum pharetra mauris. Maecenas metus mi, dapibus in erat at, " + "congue tincidunt sapien. Vestibulum in pellentesque risus, id accumsan mauris. Donec non ex consequat, pretium ante at, suscipit lacus. Fusce ac consectetur erat. " + "Pellentesque maximus justo quis ante ornare condimentum. ", "Proin accumsan orci a nulla gravida tincidunt. Nulla et nisl eget diam rhoncus euismod. Maecenas tellus eros, semper vitae pharetra a, tincidunt ut dolor. " + "Nullam tempor at sapien vel efficitur. Duis vel aliquet felis, vitae tincidunt dolor. Sed tortor urna, dictum eu leo quis, feugiat eleifend ligula. Quisque vitae nisi venenatis, " + "pretium augue id, consequat velit. Sed dignissim justo velit, id faucibus leo scelerisque sed. In vestibulum blandit ipsum et rhoncus. Aliquam erat lorem, interdum vitae ligula at, " + "vulputate feugiat nunc. Fusce condimentum quis ligula ac dictum. Aliquam et viverra purus. Duis sollicitudin dolor eget diam pretium tempus. Nullam in magna eu tortor facilisis placerat non " + "vitae eros. Ut vitae magna dictum felis lacinia aliquam facilisis nec sem. ", "Suspendisse potenti. Vivamus maximus mi consequat lectus tincidunt consectetur. Proin vulputate velit lectus, eu lobortis quam lobortis congue. Sed gravida magna non " + "eleifend malesuada. Donec tincidunt lorem et semper dignissim. Fusce ut ex vestibulum urna lobortis aliquet in lobortis ex. Integer vehicula erat sed quam dictum varius id sed magna. " + "Cras maximus lacus est, ut elementum neque faucibus et. Praesent malesuada egestas scelerisque. Donec interdum ex maximus, auctor nisl non, ornare enim. " + "Nulla finibus quis felis non iaculis. Maecenas fringilla placerat enim non pellentesque. Proin justo orci, elementum ut porttitor in, scelerisque vel nisl. " + "Nam sit amet pellentesque justo, et molestie dolor. Cras ipsum justo, facilisis eget diam non, lacinia iaculis libero. Curabitur convallis, velit nec finibus mattis, " + "tellus erat elementum ligula, quis viverra quam sapien et enim. Morbi tempor fringilla mattis. ", "Aenean porttitor, augue pretium semper tincidunt, justo orci volutpat odio, malesuada convallis lacus lorem at nisi. Nulla at dolor tincidunt, tempor orci et, blandit metus. " + "Pellentesque malesuada augue et odio interdum, sit amet laoreet odio sagittis. Maecenas porttitor consectetur eros nec tempor. Morbi ut pharetra nunc. Phasellus non massa congue, varius tortor nec, " + "maximus massa. Cras erat mauris, pulvinar eu nibh ac, scelerisque maximus sem. Nam sed fringilla dolor, finibus tincidunt purus. Sed in dui ut enim interdum sagittis. Cras neque quam, " + "ultricies euismod dignissim sit amet, elementum eget eros. Donec in sem vel nunc vulputate pharetra.Fusce rhoncus turpis id turpis aliquet pharetra. Vivamus tristique eros lectus, eget venenatis nulla dictum et. " + "Vestibulum volutpat mi eu consequat blandit. Quisque ornare pellentesque tellus, in congue turpis viverra vel. Donec quis velit non nulla aliquet maximus. Maecenas ultricies nisi dui, non dapibus libero tincidunt ut. " + "Quisque vel interdum diam, ultricies aliquet nisi. Vivamus dui erat, tincidunt quis nibh et, aliquet ultricies erat. Nullam sit amet sodales nibh, a gravida diam. Fusce efficitur ultrices pellentesque. " + "Pellentesque a suscipit justo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nam lectus tellus, semper ut vehicula vitae, ullamcorper id sem. " + "Cras quis ipsum et ligula rutrum dignissim at sit amet leo. Etiam ut tortor in velit feugiat commodo a ut nunc. Proin nec efficitur augue. Phasellus non erat non dolor bibendum viverra in ut nunc. " + "Maecenas et sollicitudin nisi, in imperdiet mi. Sed luctus quam felis, a efficitur eros pellentesque ut. Integer suscipit dignissim quam sit amet feugiat. Morbi in odio quis ligula ultrices convallis. " + "Duis a dui tristique, pulvinar tellus vel, tristique ex. Sed metus velit, ornare sit amet felis at, finibus gravida ante. Nunc felis massa, viverra eget pellentesque ac, sollicitudin non odio. " + "Aliquam dictum nulla mauris, finibus venenatis dolor suscipit at. Donec sagittis consequat diam, non varius dolor ullamcorper et. Proin dictum magna eget massa posuere tincidunt. " + "Vivamus ut libero vel diam maximus posuere sagittis maximus mauris. Donec luctus, diam in porttitor interdum, nibh elit ultricies sem, eu porta nulla sapien id nisi. Mauris odio odio, " + "mattis quis enim et, laoreet consequat ligula. Praesent feugiat lacus sagittis, laoreet massa sit amet, luctus ipsum. Suspendisse id malesuada velit. Etiam sit amet risus diam. " + "Vestibulum non ligula vitae nunc bibendum ornare id ut ante. Morbi at orci mollis, commodo dui et, bibendum augue. Curabitur nibh arcu, vulputate eu sollicitudin et, egestas sed dui. " + "Mauris ante enim, cursus et scelerisque eu, vestibulum et neque. Sed gravida ultricies ante sit amet efficitur. Cras est augue, auctor vel commodo sit amet, consectetur at quam. " + "Phasellus vulputate convallis neque, vitae bibendum mi rutrum in. Pellentesque pharetra ultricies urna, vitae semper nulla congue non. Praesent venenatis ullamcorper risus, non luctus purus. " + "Integer rutrum magna id pulvinar viverra. Aliquam et scelerisque turpis. Quisque sed nisl eu orci congue tempus nec in tellus. Nam eget magna lacus. Nunc eu sapien in velit ultrices tincidunt. " + "Curabitur purus libero, viverra non mollis non, hendrerit sit amet tellus. Maecenas congue ut lectus et gravida. Nam commodo lacus at leo sollicitudin gravida. " + "Nullam felis ante, dapibus a laoreet a, sagittis id dolor. Sed eget risus id eros faucibus aliquet. Sed rhoncus nibh quam, at congue massa convallis ac. Nullam lobortis ex mauris, " + "nec viverra lacus fringilla sed.Pellentesque at sapien quis lectus ultrices fringilla a eu dolor. Pellentesque imperdiet ipsum a odio laoreet vehicula. Aenean vestibulum in dolor non suscipit. " + "Curabitur sed felis non mi malesuada mattis quis quis est. Maecenas finibus dolor et libero semper, et posuere sem interdum. Aenean posuere eleifend sapien, ac bibendum lorem egestas id. " + "Integer vehicula, quam in laoreet feugiat, neque elit scelerisque dui, eget facilisis dui turpis vel sapien. " }; PDFFormattedContent fc = new PDFFormattedContent(text[textIndex]); (fc.Paragraphs[0].Blocks[0] as PDFFormattedTextBlock).Font = new PDFAnsiTrueTypeFont(verdana); (fc.Paragraphs[0].Blocks[0] as PDFFormattedTextBlock).Font.Size = 10; document.StartNewPage(); document.AddContent(new PDFFlowTextContent(fc)); }