internal static void PrintTestRecipeStepsReport(SimpleDocumentRenderer doc) { int[] widths = new int[] { 50, 200, 350, 150 }; Func <string[]> GetStep2 = MakeStepGetter(); int i = -1; int max_rows = 100; CallbackRowRenderer row = new CallbackRowRenderer((row_renderer) => { TextCell cell(int idx) { return(row_renderer.Cells[idx] as TextCell); } if (i++ >= max_rows) { return(false); } if (i == 0) { cell(0).SetText("#", MyFonts.Consolas10); cell(1).SetText("Timestamp", MyFonts.Consolas10); cell(2).SetText("Step Text", MyFonts.Consolas10); cell(3).SetText("Step Type", MyFonts.Consolas10); return(true); } var step = GetStep2(); cell(0).SetText(i.ToString(), MyFonts.Consolas6); for (int j = 0; j < 3; ++j) { cell(j + 1).SetText(step[j], MyFonts.Consolas6); } return(true); }); doc.AddRow(new TextCell("Recipe Steps Report", MyFonts.Consolas20, Alignment.Center, 0)); doc.AddRow(new TextCell(" ", MyFonts.Consolas10)); // spacer doc.AddRow(row); for (int n = 0; n < 4; ++n) { row.AddCell(new TextCell("", MyFonts.Consolas6, Alignment.Left, widths[n])); } doc.Print(); }
private static void Test1() { const string file = "testcode.pdf"; SimpleDocumentRenderer doc = CreatePDFPRinter(file); string lorem_text = File.ReadAllText(Path.Combine(KnownFolders.Downloads, "lorem2.txt")); string[] lorem_words = lorem_text.Split(' '); int index = 0; string lorem() => lorem_words[index++ % lorem_words.Length]; string lorem2() => lorem() + " " + lorem(); for (int i = 0; i < 3; ++i) { AddRowWithText(doc, lorem2(), lorem2(), lorem2()); } doc.Print(); }
private static void Test2() { const string file = "testcode2.pdf"; SimpleDocumentRenderer doc = CreatePDFPRinter(file); int[] widths = new int[] { 50, 200, 350, 150 }; Func <string[]> GetStep2 = MakeStepGetter(); for (int i = 0; i < 200; ++i) { Row row = new Row(); string[] step = GetStep2(); row.AddCell(new TextCell(i.ToString(), MyFonts.Consolas6, Alignment.Left, widths[0])); for (int j = 0; j < 3; ++j) { row.AddCell(new TextCell(step[j], MyFonts.Consolas6, Alignment.Left, widths[j + 1])); } doc.AddRow(row); } doc.Print(); }
public void Print() { Printer.Print(); }