Skip to main content
Participant
October 29, 2018
Question

AFExecuteThisScript Unicode example

  • October 29, 2018
  • 2 replies
  • 810 views

Hello,

We are using Acrobat plug-in to save PDF from our application. For one particular scenario we are trying to save a non-english filename (like Chinese, Japanese, Korean, etc) to PDF. We are using AFExecuteThisScript to call the saveAs method to actually save the PDF file.

As per documentation we found here:

ASBool AFExecuteThisScript (PDDoc pdd, const char * cScript, char ** pRetValue)

AcroForm Methods Executes a JavaScript script.

Parameters:

     pdd The PDDoc in which the script is to be executed.

     cScript A string containing the text of the script to be executed. If Unicode, the string must begin with

          0xFEFF and end with 2 null bytes. If this is not the case, it is assumed to be in the application's language

          encoding, as returned by AVAppGetLanguageEncoding.

     pRetValue To get a return value from the execution of the script, pass a non-NULL value for this

          parameter. If on return - pRetVal is non-NULL, the caller should dispose of the string by calling ASFree. If

          present, the value will be in host encoding. NOTE: The script sets this value by assigning it to event.value.

See the Acrobat JavaScript Object Specification for more information.

Return Value:

The JavaScript value of event.rc. This function pre-initializes it to true; a script may set it to false if desired.

Header:

af_sel.h

We tried passing the UTF-8 string from our application and have added to start with 0xFEFF and end with 2 null bytes, but still we are getting the ANSI name PDF filename.

It would be great if an example can be provided for the usage of AFExecuteThisScript() method for non-english characters to be passed to this function.

Thanks,

Amish

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
October 29, 2018

[Question moved to the relevant forum]

Bernd Alheit
Community Expert
Community Expert
October 29, 2018

Post the question in the forum for Acrobat SDK.