Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Sep 26, 2018 1:40 pm

Dear support,

I'm using the latest Version of the community edtion of spire.pdf for .net.
I want to add calculation to the PDF. the original PDF has no JavaScript set.

maybe you can tell me what's wrong in my Code.

Code: Select all
Spire.Pdf.PdfDocument pdf = new Spire.Pdf.PdfDocument()
Spire.Pdf.Widget.PdfFormWidget form = null;
try
{
                    pdf.LoadFromFile(filename);

                    form = pdf.Form as Spire.Pdf.Widget.PdfFormWidget;
                }
                catch (Exception) { }

string Formula = "this.getField(\"Field1\").value = this.getField(\"Field2\").value + 3;";
Spire.Pdf.Actions.PdfJavaScriptAction action = new Spire.Pdf.Actions.PdfJavaScriptAction(Formula);
foreach (Spire.Pdf.Fields.PdfField item in form.FieldsWidget.List)
                        {
                            if (item.Name.Equals(fieldname))
                            {
(item as Spire.Pdf.Widget.PdfTextBoxFieldWidget).Actions.LostFocus = action;
}
...
pdf.SaveToFile(filename);

Glinka
 
Posts: 4
Joined: Tue Jul 01, 2014 2:54 pm

Thu Sep 27, 2018 6:22 am

Hello Glinka,

Thanks for your inquiry.
After an initial test with your code, I can add the JavaScript action to PDF successfully. To help us locate your issue accurately and quickly, please provide your original Pdf file. Thanks in advance. You could send it to us via email([email protected]).

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1535
Joined: Wed Apr 25, 2018 3:20 am

Thu Sep 27, 2018 8:18 am

Thanks Lisa for checking.
I sent the files to you via mail.

Maybe you can see in the files why the Javascript is not working.

Thanks in advance

Gregor

Glinka
 
Posts: 4
Joined: Tue Jul 01, 2014 2:54 pm

Thu Sep 27, 2018 9:37 am

Hello Gregor,

Thanks for your files.
I did notice that the JavaScript action couldn’t be added successfully in the 13278.pdf, I will submit it to our Dev team for investigating and fixing, if there is any update, I will let you know. Sorry for the inconvenience caused.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1535
Joined: Wed Apr 25, 2018 3:20 am

Thu Sep 27, 2018 9:49 am

OK, the file 13278.pdf was generated by Code (with spire.pdf for .net (community edtion)).
the other PDF was generated by an third application. Could you add there the JavaScript-function?

If you need the Code for 13278 I can provide it to you.

thanks for testing.

Glinka
 
Posts: 4
Joined: Tue Jul 01, 2014 2:54 pm

Thu Sep 27, 2018 10:48 am

Hello Gregor,

I can add the JavaScript action to other Pdf successfully, didn't you add it successfully to this Pdf? The version I used is Spire.PDF Pack(Hot Fix) Version:4.9.4. If you were using an old version, I suggest upgrading to the latest version to try again, if there is still any issue of this Pdf. Please provide your full code to help us look into it accurately.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1535
Joined: Wed Apr 25, 2018 3:20 am

Thu Sep 27, 2018 11:13 am

With the hot fix I can add the JavaScript successfully, but I said I use the community Version. with this I can't add the JavaScript to the PDF. to non of the two.
When is the community Version ready with the patch for my Problem? Can you say it?

Thanks in advance.

Glinka
 
Posts: 4
Joined: Tue Jul 01, 2014 2:54 pm

Fri Sep 28, 2018 2:42 am

Dear Gregor,

Thanks for your feedback.
Sorry for my carelessness in previous reply. I regret to tell you that we have no plan to maintain the community version at present. All patches and new feature are included in our commercial version. We are willing to provide a temporary license( one month free ) of Spire.PDF for you to help remove the warning message and evaluate our product better. If you need it, please contact our sales team( [email protected]) to get.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1535
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.PDF

cron