• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

AFExecuteThisScript Unicode example

Community Beginner ,
Oct 29, 2018 Oct 29, 2018

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript

Views

518

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
community guidelines
Community Expert ,
Oct 29, 2018 Oct 29, 2018

Copy link to clipboard

Copied

Post the question in the forum for Acrobat SDK.

Votes

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
community guidelines
Community Expert ,
Oct 29, 2018 Oct 29, 2018

Copy link to clipboard

Copied

LATEST

[Question moved to the relevant forum]

Votes

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
community guidelines