static LogBookRunner() { ProjectDir = Directory.GetCurrentDirectory(); OperationJsonFile = Path.Combine(ProjectDir, "Content", "operations_log.json"); OperationJsonContent = File.ReadAllText(OperationJsonFile); OperationData = JsonConvert.DeserializeObject <List <Operation> >(OperationJsonContent); int _id = 1; DateTime?maxDate = DateTime.ParseExact("1/1/1970", "d/M/yyyy", null); DateTime?minDate = DateTime.ParseExact("1/1/3000", "d/M/yyyy", null); foreach (Operation item in OperationData) { item.Code = _id.ToString(); _id++; if ((item.Received != null) && (item.Received < minDate)) { minDate = item.Received; } if ((item.Sent != null) && (item.Sent < minDate)) { minDate = item.Sent; } if ((item.Received != null) && (item.Received > maxDate)) { maxDate = item.Received; } if ((item.Sent != null) && (item.Sent > maxDate)) { maxDate = item.Sent; } } Options = new PDFSettings { SectionMargins = new Box(20, 20, 20, 20), PaperSize = PaperSize.A4, Orientation = PageOrientation.Landscape, HeaderOdd = "Operations Log Book Printout", HeaderEven = "Operations Log Book Printout", BookName = "Operations Log Book", DateOfPrint = DateTime.ParseExact("1/1/2021", "d/M/yyyy", null), DateRangeStart = minDate, DateRangeEnd = maxDate, NumberOfRecords = _id - 1, DateFormat = "MM/dd/yyyy", DiscardedStrikethroughStroke = Stroke.Solid, DiscardedStrikethroughMode = StrikethroughMode.TextOnly, DiscardedStrikethroughColor = Color.Red, StartingPage = 1, DisplayDateRange = true }; }
public LogBookCoordinator(IStream stream, bool continuous = false) { _stream = stream; _builder = stream.Builder; _options = stream.Options; DateFormat = _options.DateFormat ?? DateFormat; stream.Coordinator = this; _continuous = continuous; exoRegular = FontBuilder.New().FromFile(stream.exoRegularFile, 10); exoItalic = FontBuilder.New().FromFile(stream.exoItalicFile, 10); exoBold = FontBuilder.New().FromFile(stream.exoBoldFile, 10); _sections = CreateSections(); if (continuous) { BuildSections(); } }
public LogBookCoordinator(Stream stream, PDFSettings options, int startingPage = 0, bool continuous = false) : this(new DocumentStream(stream, options) { StartingPage = startingPage }, continuous) { }