Пример #1
0
        public async Task Should_Create_Pdf_From_Input_Text_Async()
        {
            var trace = new DebugTraceWriter();

            using (WeasyPrintClient client = new WeasyPrintClient(trace))
            {
                var data = await client.GeneratePdfAsync("<h1>Hello World </h1>");

                Assert.NotNull(data);
            }
        }
Пример #2
0
        public async Task Should_Create_Pdf_From_Input_File_Async()
        {
            var trace = new DebugTraceWriter();

            var input  = $"{_inputFolder}\\complex.html";
            var output = $"{_outputFolder}\\output.pdf";

            using (WeasyPrintClient client = new WeasyPrintClient(trace))
            {
                await client.GeneratePdfAsync(input, output);
            }
        }
Пример #3
0
        static async Task Main(string[] args)
        {
            var trace = new ConsoleTraceWriter();

            using (WeasyPrintClient client = new WeasyPrintClient(trace))
            {
                var html = "<!DOCTYPE html><html><body><h1>Hello World</h1></body></html>";

                var data = await client.GeneratePdfAsync(html);

                //File.WriteAllBytes("test.pdf", data);
            }

            Console.ReadLine();
        }