Example #1
0
        void Test_Sample3()
        {
            context["Sample 3: Use Input and Output Streams"] = () =>
            {
                beforeEach = () =>
                {
                    PdfConversionSettings config = new PdfConversionSettings
                    {
                        Title = "Streaming my HTML to PDF"
                    };

                    using (var fileStream = new FileStream(@"C:\temp\sample3.pdf", FileMode.Create))
                    {
                        var task = new System.Net.Http.HttpClient().GetStreamAsync("http://www.google.com");
                        task.Wait();

                        using (var inputStream = task.Result)
                        {
                            PdfConvert.Convert(config, fileStream, inputStream);
                        }
                    }
                };

                it["Should have created a PDF document in the Temp folder"] = () => File.Exists(@"C:\temp\sample3.pdf").ShouldBeTrue();
            };
        }
Example #2
0
        void Given_a_sample_conversion_settings_with_streamed_content_and_output()
        {
            context["When performing the PDF Conversion of the provided HTML from and to a stream"] = () =>
            {
                beforeEach = () =>
                {
                    PdfConversionSettings config = new PdfConversionSettings
                    {
                        Title = "Streaming my HTML to PDF"
                    };

                    using (var fileStream = new FileStream(@"C:\temp\www.google.com.pdf", FileMode.Create))
                    {
                        var task = new System.Net.Http.HttpClient().GetStreamAsync("http://www.google.com");
                        task.Wait();

                        using (var inputStream = task.Result)
                        {
                            PdfConvert.Convert(config, fileStream, inputStream);
                        }
                    }
                };

                it["Should have created a PDF document in the Temp folder"] = () => File.Exists(@"C:\temp\www.google.com.pdf").ShouldBeTrue();
            };
        }