Example #1
0
        public void TestPostDocumentReplaceTextList()
        {
            PdfApi target = new PdfApi(APIKEY, APPSID, BASEPATH);
            StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH);

            string name = "test.pdf";
            string storage = null;
            string folder = null;

            Com.Aspose.PDF.Model.TextReplaceListRequest body = new Com.Aspose.PDF.Model.TextReplaceListRequest();
            Com.Aspose.PDF.Model.TextReplace tr = new Com.Aspose.PDF.Model.TextReplace();
            tr.NewValue = "This will be the new text";
            body.TextReplaces = new System.Collections.Generic.List<Com.Aspose.PDF.Model.TextReplace> { tr };

            storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\pdf\\resources\\" + name));

            Com.Aspose.PDF.Model.DocumentTextReplaceResponse actual;
            actual = target.PostDocumentReplaceTextList(name, storage, folder, body);

            Assert.AreEqual("200", actual.Code);
            Assert.IsInstanceOfType(new Com.Aspose.PDF.Model.DocumentTextReplaceResponse(), actual.GetType());
        }
Example #2
0
        public void TestPostPageReplaceText()
        {
            PdfApi target = new PdfApi(APIKEY, APPSID, BASEPATH);
            StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH);

            string name = "test.pdf";
            int? pageNumber = 1;
            string storage = null;
            string folder = null;

            Com.Aspose.PDF.Model.TextReplace body = new Com.Aspose.PDF.Model.TextReplace();
            body.NewValue = "This is the latest text added by IA";

            storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\pdf\\resources\\" + name));

            Com.Aspose.PDF.Model.PageTextReplaceResponse actual;
            actual = target.PostPageReplaceText(name, pageNumber, storage, folder, body);

            Assert.AreEqual("200", actual.Code);
            Assert.IsInstanceOfType(new Com.Aspose.PDF.Model.PageTextReplaceResponse(), actual.GetType());
        }