Skip to main content
jozefb58429255
Inspiring
September 28, 2016
Answered

AFLayoutText causes failure in creating appearance

  • September 28, 2016
  • 1 reply
  • 816 views

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 has been closed for replies.
Correct answer jozefb58429255

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

Thanks


AFDrawText solved my problem

1 reply

lrosenth
Adobe Employee
Adobe Employee
September 28, 2016

I don’t see the call to AFLayoutCreateStream

jozefb58429255
Inspiring
September 28, 2016

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

lrosenth
Adobe Employee
Adobe Employee
September 28, 2016

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