Detect JavaScript actions in form fields

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v10)  /  Detect JavaScript actions in form fields

DynamicPDF CoreSuite for .NET (v10) Forum

Is there a way to detect which form fields have JavaScript actions assigned from  a MergeDocument or PdfDocument?
Posted by a ceTe Software moderator
Hello,

The DynamicPDF Merger for .NET product does not support detecting which form fields have JavaScript action associated with them. We will add this feature to our wish list. We may include it in a future version of DynamicPDF Merger, but please note that we do not have any exact time line on this.

Thanks,
ceTe Software Support Team
Has there been any update here?
We are trying to embed one PDF page on top of another PDF page.
AcroForm fields apparently are not merged so we are having to do that manually, iterating through PdfTextFields and convert them to TextField objects, for example.
There appears no way to tell what JS events are applied.
This is critical because this is how many readers denote the type of text field.  For example, is it a date time field, numeric only, etc.

Is there any way of figuring this out without having to write my own parser?
Why does the reading and writing system in DynamicPDF's sdk use a completely different set of incompatible objects?  One reads into PdfTextField while the other writes with TextField.  Wouldn't it make more sense for both tasks to share the same underlying model structure?  If so, I could easily just use ReadEvents.
Posted by a ceTe Software moderator
Hello,

This is feature is not yet available in our DynamicPDF Core Suite product. If feasible we may include this in a future version of DynamicPDF product and post in on this forum.

The PdfTextField class is provided to get the information from a text field in an existing PDF. A TextField  object is used to add a new field on a PDF. There is no option to provide a single object which can handle existing fields and the one which are being added to the PDF.

Thanks,
ceTe Software Support Team
Posted by a ceTe Software moderator
Hi,

We have an update from our development team and a feature to detect JavaScript actions on an existing form field is included in the latest release of the  DynamicPDF Core Suite for .NET product. You can download the latest from NuGet (Package ID: ceTe.DynamicPDF.CoreSuite.NET) or from our website here.

Here is a code sample.

            PdfDocument pdf = new PdfDocument(@"C:\Temp\MyJavaScript.pdf");
            string JavaScriptText= pdf.Form.Fields[0].GetJavaScriptString();
            if (JavaScriptText != "")
            {
                Console.WriteLine("PDF Form field contains JavaScript");
            }
            else
            {
                Console.WriteLine("No Script");
            }

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 6:50 AM.