예제 #1
0
        public FileStreamResult Get()
        {
            AuthenticationHeaderValue.TryParse(Request.Headers["Authorization"], out AuthenticationHeaderValue authorizationHeader);
            if (authorizationHeader == null)
            {
                throw new ApiException(401, "Unauthorized");
            }

            PdfApi api = new PdfApi(new Configuration(null, null, BaseProductUri));

            api.ApiClient.AccessToken = authorizationHeader.Parameter;
            //PdfApi api = new PdfApi(authorizationHeader.Parameter);

            string name = "test.pdf";

            using (Stream stream = System.IO.File.OpenRead(Path.Combine(TestDataFolder, name)))
            {
                string resFileName = "result.doc";

                var    response = api.PutPdfInRequestToDoc(resFileName, file: stream);
                Stream sr       = api.DownloadFile(resFileName);
                api.DeleteFile(resFileName);
                return(new FileStreamResult(sr, "application/msword"));
            }
        }
        public void DeleteFileTest()
        {
            string name = "4pages.pdf";

            UploadFile(name, name);
            string path = Path.Combine(TempFolder, name);

            PdfApi.DeleteFile(path);
        }
예제 #3
0
        public void DeleteFileTest()
        {
            string name = "4pages.pdf";

            UploadFile(name, name);
            string path = Path.Combine(TempFolder, name);

            var response = PdfApi.DeleteFile(path);

            Assert.That(response.Code, Is.EqualTo(200));
        }
        public void DeleteFileTest()
        {
            string name = "4pages.pdf";

            UploadFile(name, name);
            string path = Path.Combine(FolderName, name);

            var response = api.DeleteFile(path);

            Console.WriteLine(response);
        }
        public void DeleteFileExample()
        {
            //ExStart: DeleteFileExample
            string name = "4pages.pdf";

            UploadFile(name, name);
            string path = Path.Combine(FolderName, name);

            api.DeleteFile(path);
            //ExEnd: DeleteFileExample
        }