Make request from PDF

Hello,
Im trying to implement next functionality and want to ask if its even possible to do.

I have existing PDF with some text fields and one button.
1 - User download this PDF to his PC.
2 - User changes field values.
3 - User click on button.
4 - PDF send request to some URL with all edited fields.

So question next - is it possible to send request from PDF to some URL using Aspose PDF?

Currently Im trying to do it via JS, but facing security issues, maybe there is another way to do it.

Document document = new Document(filePath);
ButtonField button = new ButtonField(document.getPages().get_Item(1), new Rectangle(50, 600, 250, 650));
button.setName(“Button1Name”);
button.setValue(“click me”);
document.getForm().add(button);
button.setOnActivated(new JavascriptAction(“valid js code to send request”));

Thank you for answer,
Serhii

@hitman802

Thank you for contacting support.

I would like to share with you that you can add a submit button in your PDF file by using addSubmitBtn method, as in the code below:

FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_AddSubmitBtn.pdf");
formEditor.addSubmitBtn("submit", 1, "Submit", "www.check.com", 10, 200, 70, 270); 

I hope this will be helpful. Please let us know if you need any further assistance.

1 Like