How to set Acrobat App Properties using C#

New Here ,
Jul 24, 2017

Copy link to clipboard

Copied

Hello all,

I want to make sure the fields of a PDF are highlighted.  I looked online, and found the JavaScript to do this (I want to do it programmatically) is "app.runtimeHighlight = true".

My C# code opens a PDF form, and makes it open for the user to edit in a WInForms panel.  THroughout the code, I've been using InvokeMethod to call various methods (such as getField()).

object jsObj = pdDoc.GetJSObject();

               

Type T = jsObj.GetType();

object jsReturn = T.InvokeMember("app", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, jsObj, null);

Type T2 = jsReturn.GetType();

object[] param = { "true" };

object jsReturn2 = T.InvokeMember("runtimeHighlight", BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance, null, jsReturn, param);

How can I mimic the "app.runtimeHighlight = true" syntax through the C# Acrobat SDK?

I'm using the Adobe Acrobat 10.0 Type Library.  "pdDoc" is a CAcroPDDoc object.

TOPICS
Acrobat SDK and JavaScript

Views

712

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to set Acrobat App Properties using C#

New Here ,
Jul 24, 2017

Copy link to clipboard

Copied

Hello all,

I want to make sure the fields of a PDF are highlighted.  I looked online, and found the JavaScript to do this (I want to do it programmatically) is "app.runtimeHighlight = true".

My C# code opens a PDF form, and makes it open for the user to edit in a WInForms panel.  THroughout the code, I've been using InvokeMethod to call various methods (such as getField()).

object jsObj = pdDoc.GetJSObject();

               

Type T = jsObj.GetType();

object jsReturn = T.InvokeMember("app", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, jsObj, null);

Type T2 = jsReturn.GetType();

object[] param = { "true" };

object jsReturn2 = T.InvokeMember("runtimeHighlight", BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance, null, jsReturn, param);

How can I mimic the "app.runtimeHighlight = true" syntax through the C# Acrobat SDK?

I'm using the Adobe Acrobat 10.0 Type Library.  "pdDoc" is a CAcroPDDoc object.

TOPICS
Acrobat SDK and JavaScript

Views

713

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 24, 2017 0
Adobe Employee ,
Jul 24, 2017

Copy link to clipboard

Copied

Download the SDK. Read the documentation about the JSObject bridge.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 24, 2017 0
New Here ,
Jul 25, 2017

Copy link to clipboard

Copied

I've been looking through the documentation (which is how I learned about the InvokeMethod idea, etc.)  However, it doesn't seem to work with the "app" object.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 25, 2017 0