Skip to main content
Participating Frequently
November 22, 2021
Question

FDK Question - Programmatic Alt Image Text Description Insertion

  • November 22, 2021
  • 2 replies
  • 543 views

We need to be able to include Alt Text for images to enable customers to comply with accessibility requirements. We acquire the text from a database and/or spreadsheet using our software and need to place it in the FrameMaker/PDF file using the FDK. In reviewing the FDK documentation, it is not apparent what the function might be. Could you please let us know how we may use the FDK to insert Alt Text content for images?

    This topic has been closed for replies.

    2 replies

    Participant
    April 1, 2022

    Rick,

    I'm with Ben. Let me give you a little more detail. I can create a string list containing a single string and set the FP_ObjectAttributes for the anchored frame. No error is indicated and when I perform a F_ApiGetStrings I get the same string that I input using F_ApiSetStrings. However, when I select the anchored frame in FrameMaker, and click on the Object Attributes button, the text doesn't seem to be there. The dialog has mulitple text boxes with different labels, so I'm wondering if FrameMaker is expecting something a little more involved than just an arbitrary list of strings.

    Thanks

    frameexpert
    Community Expert
    Community Expert
    April 1, 2022

    The majority of my programming is done with ExtendScript. I think I figured this out once by reverse engineering it. I set some values manually on an anchored frame and then queried the properties. Here is some code that I know works on a selected anchored frame. Hopefully, you can adapt this to the FDK syntax.

    #target framemaker
    
    var doc = app.ActiveDoc;
    var aframe = doc.FirstSelectedGraphicInDoc;
    
    var objectAttributes = aframe.ObjectAttributes;
    while (objectAttributes.length) {
        objectAttributes.pop ();
    }
    
    objectAttributes[0] = "<Alt>Fantastic and outstanding!</Alt>";
    aframe.ObjectAttributes = objectAttributes;
    
    alert (aframe.ObjectAttributes);
    Ben SloneAuthor
    Participating Frequently
    April 2, 2022

    Rick,

    Once again, thank you for educating us. We sincerely appreciate it.

    frameexpert
    Community Expert
    Community Expert
    November 22, 2021

    Hi Ben, It should be this property on the AFrame object:

    FP_ObjectAttributes

     

    This is how it is defined in the fapidefs.h FDK header file:

    #define FP_ObjectAttributes 23 /* R/W Stringlist */

    Ben SloneAuthor
    Participating Frequently
    November 22, 2021

    Thank you kind sir. We'll give it a shot...