I am using Adobe Echo Sign API createwidget for signing documents,I want to add editable fields, Like we get when we select "Preview, position signatures or add form fields" here, I have attached the screen shot as well
I have tried using MergeField Info of createwidget but its not creating fields on widget API documentation
Here's my code
WidgetCreationInfo widgetinfo = new WidgetCreationInfo(widgetname, fileInfos);
MergeField[] mergedfields = new MergeField[1];
mergedfields[0] = new MergeField();
mergedfields[0].fieldName = "name";
mergedfields[0].defaultValue = "Salman";
MergeFieldInfo mergedfieldinfo = new MergeFieldInfo();
mergedfieldinfo.mergeFields = mergedfields;
widgetinfo.mergeFieldInfo = mergedfieldinfo;
MergeField[] mergedfields = new MergeField[4];
mergedfields[0] = new MergeField();
mergedfields[1] = new MergeField();
mergedfields[2] = new MergeField();
mergedfields[3] = new MergeField();
mergedfields[0].fieldName = "name";
mergedfields[0].defaultValue = "Your value";
mergedfields[1].fieldName = "your fildname";
mergedfields[1].defaultValue = "Your value";
mergedfields[2].fieldName = "your fildname";
mergedfields[2].defaultValue = "Your value";
mergedfields[3].fieldName = "your fildname";
mergedfields[3].defaultValue = "Your value";
I tried with above code and its working smoothly..
Related
I am trying to create a new project in MS Project Server 2016 using PSI C#. It creates a new project along with the task but when I tried to set the values of some custom fields and try to load/execute the query, it returns "CSOMUnknownUser" error.
Can anyone help me out to sort out this problem. my sample code is here
worker = new Classes.ProjectServerWorker();
worker.projContext = new Microsoft.ProjectServer.Client.ProjectContext(SPContext.Current.Web.Url);
NetworkCredential cred = new NetworkCredential();
cred.Domain = "abc";
cred.UserName = "abc";
cred.Password = "abc";
worker.projContext.Credentials = cred;
ProjectCreationInformation newProj = new ProjectCreationInformation();
//ProjectContext projContext = new ProjectContext(SPContext.Current.Web.Url + "/sites/PWA");
try
{
newProj.Id = Guid.NewGuid();
string strGuidID = newProj.Id.ToString();
newProj.Name = "new project title";
newProj.Description = "new project requirement details";
PublishedProject newPublishedProj = worker.projContext.Projects.Add(newProj);
QueueJob qJob = worker.projContext.Projects.Update();
//jobState = worker.projContext.WaitForQueue(qJob, timeoutSeconds);
IsProjectCreated = true;
worker.projContext.Load(worker.projContext.Projects);
worker.projContext.ExecuteQuery();
var proj = worker.projContext.Projects.First(p => p.Name == newProj.Name);
worker.projContext.ExecuteQuery();
var draftProj = proj.CheckOut();
// Creating Task under project
TaskCreationInformation newtask = new TaskCreationInformation();
newtask.Name = "First Task";
newtask.Start = DateTime.Today;
newtask.Finish = DateTime.Today.AddDays(35);
newtask.Id = Guid.NewGuid();
newtask.IsManual = false;
DraftTask drafttask = draftProj.Tasks.Add(newtask);
draftProj.Update();
draftProj.Publish(true); // Publish and check-in the project
worker.projContext.ExecuteQuery();
// Setting Custom Fields data
var guidID = new Guid(strGuidID);
var projcs = worker.projContext.Projects.GetByGuid(guidID);
var draftProjCS = projcs.CheckOut().IncludeCustomFields;
worker.projContext.Load(draftProjCS);
worker.projContext.ExecuteQuery();
string WorkRequestTitle = "new project";
var field1 = worker.projContext.CustomFields.Where(a => a.InternalName== ProjectFields.WorkRequestTitle).FirstOrDefault();
draftProjCS.SetCustomFieldValue(field1.InternalName, WorkRequestTitle);
TemplateRole templateRole = new TemplateRole();
templateRole.Email = "chetan.wani88#gmail.com";
templateRole.RoleName = "Developer";
templateRole.DefaultRecipient = "true";
templateRole.Name = "Month Year 2021";
//templateRole.Tabs.TitleTabs.Add(new Title { TabLabel = "title", Value = "1323232" });
templateRole.ClientUserId = string.Empty;
templateRole.Tabs = new Tabs();
templateRole.Tabs.TextTabs = new List<Text>();
templateRole.Tabs.SignHereTabs = new List<SignHere>();
SignHere signHere = new SignHere();
signHere.AnchorXOffset = "20";
signHere.AnchorYOffset = "10";
signHere.AnchorUnits = "pixels";
templateRole.Tabs.SignHereTabs.Add(signHere);
Text textTab = new Text();
textTab.TabLabel = "Test88";
textTab.Value = "12525252";
templateRole.Tabs.TextTabs.Add(textTab);
List templateRoles = new List();
templateRoles.Add(templateRole);
envDef.TemplateRoles = templateRoles;
envDef.Status = "sent";
var envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);
Please read our article on this subject that includes code snippets in C# and other langs.
The code must match the recipients, since the tabs are associated with them. Often the tabs don't show up because you added a new recipient that has a different role.
templateRole.RoleName = "Developer";
|This must match your template.
I am trying to make a TextBox locked by using OpenXML SDK. I've tried this method but the TextBox NoTextEdit is not working.
public DocumentFormat.OpenXml.Presentation.Shape GenerateShape(string StrText)
{
DocumentFormat.OpenXml.Presentation.Shape shape1 = new DocumentFormat.OpenXml.Presentation.Shape();
DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties nonVisualShapeProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties();
DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties nonVisualDrawingProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)3U, Name = "ID",Hidden=true ,Description="Do not Remove" ,MCAttributes=null };
DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties nonVisualShapeDrawingProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties();
Drawing.ShapeLocks shapeLocks1 = new Drawing.ShapeLocks() { NoTextEdit = true, NoGrouping = true,NoMove=true,NoSelection=true,NoEditPoints=true ,NoAdjustHandles=true ,NoRotation=true,NoChangeArrowheads=true,NoChangeAspect=true,NoChangeShapeType=true,NoResize=true};
nonVisualShapeDrawingProperties1.Append(shapeLocks1);
ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties1 = new ApplicationNonVisualDrawingProperties();
PlaceholderShape placeholderShape1 = new PlaceholderShape() { Type = PlaceholderValues.SubTitle, Index = (UInt32Value)1U };
applicationNonVisualDrawingProperties1.Append(placeholderShape1);
nonVisualShapeProperties1.Append(nonVisualDrawingProperties1);
nonVisualShapeProperties1.Append(nonVisualShapeDrawingProperties1);
nonVisualShapeProperties1.Append(applicationNonVisualDrawingProperties1);
DocumentFormat.OpenXml.Presentation.ShapeProperties shapeProperties1 = new DocumentFormat.OpenXml.Presentation.ShapeProperties();
DocumentFormat.OpenXml.Presentation.TextBody textBody1 = new DocumentFormat.OpenXml.Presentation.TextBody();
Drawing.BodyProperties bodyProperties1 = new Drawing.BodyProperties();
Drawing.ListStyle listStyle1 = new Drawing.ListStyle();
Drawing.TextShape shp = new Drawing.TextShape();
Drawing.Paragraph paragraph1 = new Drawing.Paragraph();
Drawing.EndParagraphRunProperties endParagraphRunProperties1 = new Drawing.EndParagraphRunProperties() { Language = "en-US" ,Dirty=false };
paragraph1.Append(GenerateRun(StrText));
paragraph1.Append(endParagraphRunProperties1);
textBody1.Append(bodyProperties1);
textBody1.Append(listStyle1);
textBody1.Append(paragraph1);
shape1.Append(nonVisualShapeProperties1);
shape1.Append(shapeProperties1);
shape1.Append(textBody1);
return shape1;
}
public Drawing.Run GenerateRun(string StrText)
{
Drawing.Run run1 = new Drawing.Run();
Drawing.RunProperties runProperties1 = new Drawing.RunProperties() { Language = "en-US", Dirty = false };
runProperties1.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
Drawing.Text text1 = new Drawing.Text();
text1.Text = StrText;
Drawing.SolidFill solidFill2 = new Drawing.SolidFill();
Drawing.SchemeColor schemeColor = new Drawing.SchemeColor();
string y = System.Drawing.Color.Transparent.ToArgb().ToString("X");
Drawing.RgbColorModelHex rgbColorModelHex2 = new Drawing.RgbColorModelHex() { Val = "FFFFFF" };//Set Font-Color to Blue (Hex "0070C0").
solidFill2.Append(rgbColorModelHex2);
runProperties1.Append(solidFill2);
Color color = new Color() { Val = "365F91", ThemeColor = ThemeColorValues.Accent1, ThemeShade = "BF" };
run1.Append(runProperties1);
run1.Append(text1);
return run1;
}
Everything works fine except editing. Still the user can edit the TextBox values by double clicking it. How can I avoid this ?
Is there any permanent solution to prevent editing ? Please help me to find a better solution.
Thanks in advance
By researching and communications with the MVP team I've pointed out that there is no way to Protect the TextBox from editing.
As Cindy Meister mentioned in the comments,
Are you able to do it in the PowerPoint application user interface? If not, then Open XML cannot do it... If yes, you can.
If you do not want to text to be changed , Just change it as image then lock that by using NoSelection=true/1 and NoMove=true/1 properties. If you enable these properties the user can't either delete nor change it's position.
For your ref: https://answers.microsoft.com/en-us/msoffice/forum/msoffice_powerpoint-mso_windows8-mso_2016/shape-lock-is-not-working/c1705b55-d2aa-4adb-b538-574ed2fc8eca?tm=1579265435636&page=1&rtAction=1579495439869
In FormField "HH" i am trying to make text as link, but it is readed only as string text, it is not clickable.
I use Aspose.Pdf v.11.6.0.
var doc = new Aspose.Pdf.Document(pdfFileStream);
var pdfForm = new Aspose.Pdf.Facades.Form(doc);
pdfForm.FillField("Name", model.Name.ToUpper());
pdfForm.FillField("ISOS", model.NumberISOS.ToUpper());
pdfForm.FillField("Info", dateInfo);
pdfForm.FillField("HH", "http://www.somewebsite.com");
I use this code:
Page page = (Page)doc.Pages[1];
var text = new TextFragment("index");
text.Position = new Position(200, 300);
Aspose.Pdf.WebHyperlink link = new
WebHyperlink("www.google.com");
text.Hyperlink = link;
page.Paragraphs.Add(text);
but new Position(200, 300); values not responding.
Here is my solution, because position does not work, i move the link with margins. This worked for me.
Page page = (Page)doc.Pages[1];
var text = new TextFragment("LINK");
text.Position = new Position(300, 300);
Aspose.Pdf.WebHyperlink link = new WebHyperlink("www.google.com");
text.Hyperlink = link;
text.Margin.Left = -48;
text.Margin.Top = 687;
text.Margin.Bottom = -150;
text.TextState.Underline = true;
text.TextState.FontSize = 11;
text.TextState.ForegroundColor = Aspose.Pdf.Color.DeepSkyBlue;
text.TextState.BackgroundColor = Aspose.Pdf.Color.White;
page.Paragraphs.Add(text);
The requirement which I have regarding docusign is I need to implement Signer Attachment and that same scenario is mentioned at [https://github.com/docusign/docusign-soap-sdk/wiki/Code-Walkthrough-_-Signer-Attachments]
But I am not sure how do I achieve with code in C#. As not sure how do I attach it to Envelope?
I want to send someone a contract letter to sign and also request them attach few docs and when all of that is completed , those docs should be sent to my email.
Anyone knows if I can achieve it with docusign?
The previous entry is not bad... I got it working eventually. But this code below is solid, in production, and works great! It also uses anchor strings.
EnvelopeDefinition env = new EnvelopeDefinition();
env.EmailSubject = "Please sign this document set";
Document doc4 = new Document
{
DocumentBase64 = doc4PdfBytes,
Name = "Voided Check Attachment", // can be different from actual file name
FileExtension = "pdf",
DocumentId = "4"
};
env.Documents = new List<Document> { doc4 };
SignerAttachment signAttachDoc = new SignerAttachment
{
TabLabel = "Attach your voided check",
DocumentId = "1",
TabId = "1",
PageNumber = "1",
AnchorString = "/at1/",
AnchorUnits = "pixels",
AnchorXOffset = "0",
AnchorYOffset = "0",
AnchorIgnoreIfNotPresent = "false",
};
Tabs signer1Tabs = new Tabs
{
SignerAttachmentTabs = new List<SignerAttachment> { signAttachDoc }
};
signer1.Tabs = signer1Tabs;
Recipients recipients1 = new Recipients
{
Signers = new List<Signer> { signer1 }
};
env.Recipients = recipients1;
Here is how we can do it while using C# SDK
create a signer object
Signer signer = new Signer();
signer.Name = recipientName;
signer.Email = recipientEmail;
signer.RecipientId = "1";
then create attachment tabs
signer.Tabs.SignerAttachmentTabs = new List<SignerAttachment>();
after which we need an attachment to add to it
SignerAttachment signDoc = new SignerAttachment();
signDoc.TabLabel = "Attach your Other Doc";
signDoc.DocumentId = "1";
signDoc.TabId = "1";
signDoc.PageNumber = "1";
And finally we add it to the tabs
signer.Tabs.SignerAttachmentTabs.Add(signDoc);