Exemplo n.º 1
0
        private static void RunTypeset(CommandLineOptions commandLineOptions)
        {
            var typesetter         = new Typesetter();
            var documentFormatting = new DocumentFormatting(
                commandLineOptions.FontFamily,
                commandLineOptions.PageSize,
                commandLineOptions.PageMargin,
                commandLineOptions.LineHeight,
                commandLineOptions.FontSize,
                commandLineOptions.PrintPageNumbers,
                commandLineOptions.PrintMarginals);

            var documentMetadata = new DocumentMetadata(
                commandLineOptions.Title,
                documentFormatting);

            var markdownPages = commandLineOptions.InputFilePaths.Select(File.ReadAllText).ToArray();

            Console.WriteLine("Typesetting document, please wait...");
            var stream = typesetter.CreatePdfDocument(documentMetadata, markdownPages);

            using var fileStream = new FileStream(commandLineOptions.OutputFilepath, FileMode.Create);
            stream.CopyTo(fileStream);

            Console.WriteLine($"Finished! {commandLineOptions.OutputFilepath} has been created");
        }
Exemplo n.º 2
0
 public DocumentMetadata(string title, DocumentFormatting documentFormatting)
 {
     Title = title;
     DocumentFormatting = documentFormatting;
 }