We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

PdfJavaScriptAction : "this.saveAs('/ c / temp / temp.pdf');"

Thread ID:

Created:

Updated:

Platform:

Replies:

127638 Nov 29,2016 10:15 PM UTC Dec 1,2016 04:57 PM UTC WPF 2
loading
Tags: PDF
Vikas Jagtap
Asked On November 29, 2016 10:15 PM UTC

Below is my code where I am trying to add a Save button inside a pdf, I am attaching a JavaScript Action to it which basically saves the document with a new name. 

However the button click is not saving the document. Please see below my code. If I add a simple alert, it works fine. 

string fileName = "";
                PdfDocument document = new PdfDocument();
                document.PageSettings = new PdfPageSettings(new SizeF(300400));
                PdfPage page = document.Pages.Add();
                PdfGraphics graphics = page.Graphics;
                PdfImage image = PdfImage.FromStream(new MemoryStream(attachment.FILE_DATA));//PdfImage.FromFile(@"C:\\DevelopmentMobile\\action.png");
                PdfFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 8fPdfFontStyle.Bold);
                PdfForm frm = new PdfForm();
                graphics.DrawImage(image, 00);
 
                PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
                submitButton.Bounds = new RectangleF(2516010020);
                submitButton.Text = "Apply";
                submitButton.BackColor = new PdfColor(181191203);
                //Create a new PdfJavaScriptAction
                PdfJavaScriptAction javaAction = new PdfJavaScriptAction("this.saveAs(\" / c / temp / temp.pdf\");");
                //Set the javaAction to submitButton
                submitButton.Actions.MouseDown = javaAction;
                //Add the submit button to the new document.
                document.Form.Fields.Add(submitButton);
                fileName = attachment.FILE_NAME.ToString().Replace(Path.GetExtension(attachment.FILE_NAME.ToString()), "");
                document.Save(@"C:\\DevelopmentMobile\\" + fileName + "_" + VZUserProfile.Instance.Username.ToString() + ".pdf");
                System.Diagnostics.Process.Start(@"C:\\DevelopmentMobile\\" + fileName + "_" + VZUserProfile.Instance.Username.ToString() + ".pdf");

Gayathri Ramalingam [Syncfusion]
Replied On November 30, 2016 04:43 PM UTC

Hi Vikas, 
Thank you for using Syncfusion products. 
We will analyze the feasibility to achieve your requirement of “Adding button field in PDF document using Javascript action”. We will update you with the further details on 1st December, 2016. 

With Regards, 
Gayathri R 


Gayathri Ramalingam [Syncfusion]
Replied On December 1, 2016 04:57 PM UTC

Hi Vikas, 
We are following Acrobat’s procedure to add action for form fields using Javascript action. After analyzing the issue “Adding button field in PDF document using Javascript action”, there is no support to add save action in button field using Java script action. We have reported the same to acrobat support team. We will update you once we got response from acrobat’s support team. 

With Regards, 
Gayathri R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;