We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Add submit button

Hello

I consider using Aspose.PDF (using last version) for adding a submit button to a pdf doc for publishing annotations to a web site.

I find this code in the doc

Aspose.Pdf.Facades.FormEditor add = new Aspose.Pdf.Facades.FormEditor("docin.pdf", "docout.pdf");
add.AddSubmitBtn("btnSubmit", 1, "Envoyer", urlPublication, 400, 20, 500, 50);
add.SetFieldAppearance("btnSubmit", AnnotationFlags.Print);
add.SetSubmitFlag("btnSubmit", SubmitFormFlag.XfdfWithComments);
add.Save();

I have a doc with a button who publish to the good url but :

  • The button is blank whith no captions
  • The export format is in html and not Xfdf with comments
  • After saving, the user can't add annotations and comments with acrobat reader 10.1.1. (the user can in the input doc)
  • The button is viewable and printable, it should be not printable

I try to alter the button after with ButtonField class but with no sucess :

Document doc = new Document("docin.pdf");

Aspose.Pdf.Facades.FormEditor add = new Aspose.Pdf.Facades.FormEditor(doc);
add.AddSubmitBtn("btnSubmit", 1, "Envoyer", urlPublication, 400, 20, 500, 50);

ButtonField btn = doc.Form["btnSubmit"] as ButtonField;
btn.NormalCaption = "Envoyer";
btn.AlternateCaption = "Envoyer";

SubmitFormAction action = (SubmitFormAction) btn.OnActivated;
action.Flags = (int) SubmitFormFlag.XfdfWithComments;

doc.Save("docout.pdf");

Do you have a solution or best code ?

Best regards, Gilles

Hi Gilles,

Thanks for using our products.

I have tested the scenario and I am able to notice the same problem. For the sake of correction, I have logged this problem as PDFNEWNET-32682 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction.

We apologize for your inconvenience.

Thanks & Regards,

Hello

I have another problem with the submit button.

I have a document with an already created submit button with two actions :

  • Javascript action with a very little script (setting a textfield with the subject field of the document)
  • Submit action with a dummy url and xfdf export format option

I used the aspose lib to change the submit url with the code :

Aspose.Pdf.Facades.FormEditor fe = new Aspose.Pdf.Facades.FormEditor("docin.pdf", "docout.pdf");
bool retour = fe.SetSubmitUrl("btnSubmit", urlPublication);
fe.Save();

The publication url is modified but :

  • Javascript action is deleted
  • Submit action is altered : export format options is reseted to html

It seems, that is another bug, would you like create another report in your bugs report tool ?

Bests regards,
Gilles

Hi Gilles,

Thank you for the source code, can you please share the PDF document and Javascript you are using. This will help us to figure out the exact issue and reply back to you soon.

We apologize for your inconvenience.

Thanks & Regards,

Hello

I joined to this post two files docin.pdf and docout.pdf

The javascript on the submit button is

var idDocument = this.info.subject;

var txtId = this.getField("txtIdDocument");
if(txtId != null)
{
txtId.value= idDocument;
}

I hope this helps you solve the problem.

Bests regards

Gilles

Hi Gilles,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file.<o:p></o:p>

We have found your mentioned issue after an initial
test. Your issue has been registered in our issue tracking system with issue
id: PDFNEWNET-32878
. You will be notified via this forum thread
regarding any updates against your issue.<o:p></o:p>

Sorry for the inconvenience,<o:p></o:p>

The issues you have found earlier (filed as PDFNEWNET-32878) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
  • The button is blank whith no captions

Hi Gilles,

Thanks for your patience. I am pleased to share that this issue reported earlier as PDFNEWNET-32682, is fixed in our latest release version of Aspose.Pdf for .NET 6.7.0. Please take a look over the resultant output-6.7.0.pdf document which I have generated using code snippet that you h

  • The export format is in html and not Xfdf with comments

Can you please share some details/steps on how we can verify this scenario ? Please note that Aspsoe.Pdf for .NET supports the feature to export data from PDF form into XFDF and FDF format. For more information, please check out Export Data to FDF from a PDF File (Facades) and Export Data to XFDF from a PDF File (Facades)

  • After saving, the user can’t add annotations and comments with acrobat reader 10.1.1. (the user can in the input doc)

Can you please confirm this behaviour on attached resultant PDF document and see if the issue is resolved.

  • The button is viewable and printable, it should be not printable

Do you mean that when viewing the PDF form, the button should be visible and user can press it. However if the PDF form is printed, the button should not be printed along with page contents. Please share your comments.