Example #1
0
        public async Task Can_convert_a_local_DOCX_file_to_TIFF()
        {
            var helper = new DocumentProcessingHelper("https://api.accusoft.com", System.Environment.GetEnvironmentVariable("API_KEY"));

            var results = await helper.Convert("test.docx", OutputFormat.Tiff);

            Assert.AreEqual(1, results.Count());
            await results.First().SaveToFile("test-output/output.tiff");

            Assert.IsTrue(File.Exists("test-output/output.tiff"));
        }
Example #2
0
        public async Task Can_convert_a_local_DOCX_file_to_PNG()
        {
            var helper = new DocumentProcessingHelper("https://api.accusoft.com", System.Environment.GetEnvironmentVariable("API_KEY"));

            var results = (await helper.Convert("test.docx", OutputFormat.Png)).ToList();

            Assert.AreEqual(2, results.Count);
            await results[0].SaveToFile("test-output/output-page-1.png");

            Assert.IsTrue(File.Exists("test-output/output-page-1.png"));
            await results[1].SaveToFile("test-output/output-page-2.png");

            Assert.IsTrue(File.Exists("test-output/output-page-2.png"));
        }
Example #3
0
        public async Task Can_convert_a_DOCX_stream_to_TIFF()
        {
            var helper = new DocumentProcessingHelper("https://api.accusoft.com", System.Environment.GetEnvironmentVariable("API_KEY"));

            IEnumerable <WorkFile> results;

            using (var stream = File.OpenRead("test.docx"))
            {
                results = await helper.Convert(stream, OutputFormat.Tiff);
            }

            Assert.AreEqual(1, results.Count());
            await results.First().SaveToFile("test-output/output.tiff");

            Assert.IsTrue(File.Exists("test-output/output.tiff"));
        }
Example #4
0
        public async Task Can_convert_a_DOCX_stream_to_JPEG()
        {
            var helper = new DocumentProcessingHelper("https://api.accusoft.com", System.Environment.GetEnvironmentVariable("API_KEY"));

            IList <WorkFile> results;

            using (var stream = File.OpenRead("test.docx"))
            {
                results = (await helper.Convert(stream, OutputFormat.Jpeg)).ToList();
            }

            Assert.AreEqual(2, results.Count);
            await results[0].SaveToFile("test-output/output-page-1.jpeg");

            Assert.IsTrue(File.Exists("test-output/output-page-1.jpeg"));
            await results[1].SaveToFile("test-output/output-page-2.jpeg");

            Assert.IsTrue(File.Exists("test-output/output-page-2.jpeg"));
        }