Skip to main content
jozefb58429255
Inspiring
Sep 28, 2016 9:48 AM UTC
Answered

AFLayoutText causes failure in creating appearance

In Acrobat 11 I'm using AFLayout object to create annotation appearance. I want it to have background and some text on it. Everything seems to run fine but, when I  use also method AFLayoutText as in the sample below it creates null CosObj. Without the text method works fine and the appearance is created correctly. Am I missing something?

Thanks

       

    ASFixedRect rect;

    PDAnnotGetRect(annot, &rect);

    AFLayout layout = AFLayoutNew(&rect, pdRotate0, cosDoc);

    // border and background

    AFPDWidgetBorderRec border;

    border.nStyle = AFPDWBSolid;

    border.nWidth = 0;

    PDColorValueRec brdrColor = { PDDeviceRGB, { fixedOne, fixedZero, fixedZero, fixedZero } };

    PDColorValueRec bkndColor = { PDDeviceRGB, { fixedOne, fixedZero, fixedZero, fixedZero } };

    AFLayoutBorder(layout, &border, &brdrColor, &bkndColor, false);

    // text

    TextAppearance_t ta;

    SetDefault_TextAppearanceP(&ta);

    AFLayoutText(layout, false, false, &border, &ta, "OK");

    // create stream cosObj

    CosObj cosN = AFLayoutCreateStream(layout);

     AFLayoutDelete(layout);

This topic is closed to new replies. Start a new post to keep the conversation going.
jozefb58429255
jozefb58429255Correct answer
Inspiring
Oct 4, 2016 9:33 PM UTC

Ok got it. Then I gave to create appearance manually...

Thanks


AFDrawText solved my problem

9 replies

lrosenth
Adobe Employee
Adobe Employee
Sep 28, 2016 2:08 PM UTC

I don’t see the call to AFLayoutCreateStream

Translate
jozefb58429255
Inspiring
Sep 28, 2016 2:28 PM UTC

Let me post the code again. AFLayoutCreateStream is at the bottom.

Translate
lrosenth
Adobe Employee
Adobe Employee
Sep 28, 2016 3:08 PM UTC

You have to create the stream BEFORE you call LayoutNew()

Translate