public void TestPostCreateField() { PdfApi target = new PdfApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "test.pdf"; int? page = 1; string storage = null; string folder = null; Com.Aspose.PDF.Model.Field body = new Com.Aspose.PDF.Model.Field(); Com.Aspose.PDF.Model.Link link = new Com.Aspose.PDF.Model.Link(); link.Href = "http://api.aspose.com/v1.1/pdf/ABFillablewfields.pdf/fields/NewField"; link.Rel = "self"; link.Title = "NewField"; link.Type = "link"; Com.Aspose.PDF.Model.Rectangle rect = new Com.Aspose.PDF.Model.Rectangle(); rect.X = 0; rect.Y = 0; body.Name = "dvDate_1"; body.Values = new System.Collections.Generic.List<string> { "NewFieldValue" }; body.Rect = rect; body.SelectedItems = new System.Collections.Generic.List<int?> { 1 }; body.Type = 0; body.Links = new System.Collections.Generic.List<Com.Aspose.PDF.Model.Link> { link }; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\pdf\\resources\\" + name)); Com.Aspose.PDF.Model.SaaSposeResponse actual; actual = target.PostCreateField(name, page, storage, folder, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new Com.Aspose.PDF.Model.SaaSposeResponse(), actual.GetType()); }
public void TestPostSignPage() { PdfApi target = new PdfApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "sample-input.pdf"; int? pageNumber = 1; string storage = null; string folder = null; Com.Aspose.PDF.Model.Signature body = new Com.Aspose.PDF.Model.Signature(); body.Authority = "Authority"; body.Contact = "*****@*****.**"; body.Date = "1-1-2016"; body.FormFieldName = "Signature1"; body.Location = "Faisalabad"; body.Password = "******"; Com.Aspose.PDF.Model.Rectangle rect = new Com.Aspose.PDF.Model.Rectangle(); rect.X = 100; rect.Y = 100; rect.Height = 100; rect.Width = 200; body.Rectangle = rect; body.SignaturePath = "pkc7-sample.pfx"; body.SignatureType = "PKCS7"; body.Visible = true; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\pdf\\resources\\" + name)); storageApi.PutCreate(body.SignaturePath, null, null, System.IO.File.ReadAllBytes("\\temp\\pdf\\resources\\" + body.SignaturePath)); Com.Aspose.PDF.Model.SaaSposeResponse actual; actual = target.PostSignPage(name, pageNumber, storage, folder, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new Com.Aspose.PDF.Model.SaaSposeResponse(), actual.GetType()); }
public void TestPutUpdateFields() { PdfApi target = new PdfApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "sample-field.pdf"; string storage = null; string folder = null; Com.Aspose.PDF.Model.Fields body = new Com.Aspose.PDF.Model.Fields(); Com.Aspose.PDF.Model.Link link = new Com.Aspose.PDF.Model.Link(); link.Href = "http://api.aspose.com/v1.1/pdf/ABFillablewfields.pdf/fields/NewField"; link.Rel = "self"; link.Title = "textbox1"; link.Type = "link"; Com.Aspose.PDF.Model.Rectangle rect = new Com.Aspose.PDF.Model.Rectangle(); rect.X = 0; rect.Y = 0; rect.Width = 0; rect.Height = 0; Com.Aspose.PDF.Model.Field field = new Com.Aspose.PDF.Model.Field(); field.Name = "textbox1"; field.Values = new System.Collections.Generic.List<string> { "NewFieldValue" }; field.Rect = rect; field.SelectedItems = new System.Collections.Generic.List<int?> { 1 }; field.Type = 0; field.Links = new System.Collections.Generic.List<Com.Aspose.PDF.Model.Link> { link }; body.List = new System.Collections.Generic.List<Com.Aspose.PDF.Model.Field> { field }; Com.Aspose.PDF.Model.FieldsResponse actual; actual = target.PutUpdateFields(name, storage, folder, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new Com.Aspose.PDF.Model.FieldsResponse(), actual.GetType()); }
public void TestPostSignDocument() { PdfApi target = new PdfApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "signature.pdf"; string storage = null; string folder = null; Com.Aspose.PDF.Model.Field field = new Com.Aspose.PDF.Model.Field(); Com.Aspose.PDF.Model.Link link = new Com.Aspose.PDF.Model.Link(); link.Href = "http://api.aspose.com/v1.1/pdf/ABFillablewfields.pdf/fields/NewField"; link.Rel = "self"; link.Title = "NewField"; link.Type = "0"; Com.Aspose.PDF.Model.Rectangle rect = new Com.Aspose.PDF.Model.Rectangle(); rect.X = 100; rect.Y = 100; rect.Height = 100; rect.Width = 200; field.Name = "signature"; field.Values = new System.Collections.Generic.List<string> { "NewFieldValue" }; field.Rect = rect; field.SelectedItems = new System.Collections.Generic.List<int?> { 1 }; field.Type = 0; field.Links = new System.Collections.Generic.List<Com.Aspose.PDF.Model.Link> { link }; target.PutUpdateField(name, storage, folder, field.Name, field); Com.Aspose.PDF.Model.Signature body = new Com.Aspose.PDF.Model.Signature(); body.Authority = "Imran Anwar"; body.Contact = "*****@*****.**"; body.Date = "1-1-2016"; body.FormFieldName = field.Name; body.Location = "Faisalabad"; body.Password = "******"; body.Rectangle = rect; body.SignaturePath = "pkc7-sample.pfx"; body.SignatureType = "PKCS7"; body.Visible = true; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\pdf\\resources\\" + name)); Com.Aspose.PDF.Model.FieldResponse fieldResponse = target.PutUpdateField(name, storage, folder, field.Name, field); if (fieldResponse != null) { Console.WriteLine("Field added, Done!"); } storageApi.PutCreate(body.SignaturePath, null, null, System.IO.File.ReadAllBytes("\\temp\\pdf\\resources\\" + body.SignaturePath)); target.PutUpdateField(name, storage, folder, "signature", field); Com.Aspose.PDF.Model.SaaSposeResponse actual; actual = target.PostSignDocument(name, storage, folder, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new Com.Aspose.PDF.Model.SaaSposeResponse(), actual.GetType()); }