XFA Submit Button With Upload Action

Hello, I am trying to Aspose.PDF for .NET latest version to create interactive PDF, and i want to change the appearance of Submit button with no luck, could you please guide me how to achieve it
below code snippet i am using to create the submit button

Another Question, i want when the submit button get pressed to upload the pdf document to specific server using REST API (POST HTTP) with below signature, is that correct

[OperationContract]
[WebInvoke(UriTemplate = “UploadDocument”)]
void UploadDocument(Stream doc);

public static bool XFACreateButton(this string sourceFilePath, string name, string url, int pageNo, int startX, int startY, int endX, int endY, string targetFilePath = “”)
{
try
{
if (System.IO.File.Exists(sourceFilePath))
{
if (string.IsNullOrEmpty(targetFilePath))
{
targetFilePath = sourceFilePath;
}

                Aspose.Pdf.Document document = new Aspose.Pdf.Document(sourceFilePath);

                var pHeight = Convert.ToInt32(document.Pages[pageNo].Rect.Height);
                var rect = new Aspose.Pdf.Rectangle(startX, pHeight - startY, endX, pHeight - endY);
                FormEditor formEditor = new FormEditor(document);

                formEditor.AddSubmitBtn(name, pageNo, "Submit", url, (float)rect.LLX, (float)rect.LLY, (float)rect.URX, (float)rect.URY);

                formEditor.SetFieldAppearance(name, AnnotationFlags.Print);
                formEditor.SetSubmitFlag(name, Aspose.Pdf.Facades.SubmitFormFlag.Pdf);

                document.Save(targetFilePath);

                document = new Aspose.Pdf.Document(targetFilePath);

                foreach (var field in document.Form)
                {
                    if (field.FullName == name)
                    {
                        ButtonField button = ((ButtonField)field);
                        button.Color = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Gray);

                        Border border = new Border(button);
                        border.Width = 2;
                        border.Dash = new Dash(1, 1);
                        
                        button.Border = border;
                        button.DefaultAppearance.TextColor = System.Drawing.Color.Red;

                        document.Save(targetFilePath);
                    }
                }

                return true;
            }
        }
        catch (Exception ex)
        {
            Logger.AddException(ex.Message", "Extension.XFACreateButton");
        }

        return false;
    }

@CsMaster1984

Could you please attach your expected output PDF file here for our reference? We will then provide you more information on it.

Aspose.PDF for .NET does not provide REST APIs. Could you please share some more detail about your query?

XFA-Modified.pdf (377.5 KB)

Attached the created PDF, i want to change the appearance of submit button by changing the border and background color if possible

Regarding the upload document part, i didn’t assume that Aspose.PDF for .NET is providing REST APIs, i meant if i created submit button like below, what will be the behavior when i click the submit button

// Submit Button Code Snippet 
formEditor.AddSubmitBtn("submitButton", 1, "Submit", "http://localhost:7000/API/UploadDocument" , (100, 100, 200, 150);

formEditor.SetFieldAppearance(name, AnnotationFlags.Print);
formEditor.SetSubmitFlag(name, Aspose.Pdf.Facades.SubmitFormFlag.Pdf);

// End of Submit Button

// API signature i created to upload document with base address "http://localhost:7000/API"

[OperationContract]
[WebInvoke(UriTemplate = “UploadDocument”)]
void UploadDocument(Stream doc);

// End of Upload Document

@CsMaster1984

We have logged a ticket in our issue tracking system to change the appearance and action of submit button in PDF as PDFNET-50931. We will inform you via this forum thread once this feature is available.

We apologize for your inconvenience.