Esempio n. 1
0
        public static void Run()
        {
            // ExStart:1
            PdfApi     pdfApi     = new PdfApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            String name            = "SampleAttachment";
            String fileName        = name + ".pdf";
            int    attachmentIndex = 1;
            String storage         = "";
            String folder          = "";

            try
            {
                // Upload source file to aspose cloud storage
                storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));

                // Invoke Aspose.PDF Cloud SDK API to get specific attachment from a pdf
                AttachmentResponse apiResponse = pdfApi.GetDocumentAttachmentByIndex(fileName, attachmentIndex, storage, folder);

                if (apiResponse != null && apiResponse.Status.Equals("OK"))
                {
                    Attachment attach = apiResponse.Attachment;
                    Console.WriteLine("Name :: " + attach.Name);
                    Console.WriteLine("MimeType :: " + attach.MimeType);
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
        public void GetDocumentAttachmentByIndexExample()
        {
            //ExStart: GetDocumentAttachmentByIndexExample
            var response = api.GetDocumentAttachmentByIndex(Name, 1, folder: FolderName);

            Console.WriteLine(response);
            //ExEnd: GetDocumentAttachmentByIndexExample
        }
        public void GetDocumentAttachmentByIndexTest()
        {
            var response = PdfApi.GetDocumentAttachmentByIndex(Name, 1, folder: TempFolder);

            Assert.That(response.Code, Is.EqualTo(200));
        }
Esempio n. 4
0
        public void GetDocumentAttachmentByIndexTest()
        {
            var response = api.GetDocumentAttachmentByIndex(Name, 1, folder: FolderName);

            Console.WriteLine(response);
        }