2 Replies Latest reply: Apr 29, 2009 5:14 AM by TerraGo Joe RSS

    Incorrect PDEObject Type error

    TerraGo Joe

      Hi,

      I'm having a little trouble with determining if an XObject in the content stream is visible.  I'm trying to use PDEElementIsCurrentlyVisible, but it throws an Adobe exception at this call, and the error message is "Incorrect PDEObject Type".  Needless to say, this isn't exactly the most enlightening error message I've ever seen.  I'll post the code I'm using, and hopefully someone can tell me where I've gone wrong...  Thanks.

       

      volatile PDEContent pageContent = NULL;

      pageContent = PDPageAcquirePDEContent(page, 0);

      long foundIndex = getWatermarkElementIndex(content, pageContent);

      long numElements = PDEContentGetNumElems(pageContent);

      if (foundIndex == numElements) //if not found

      {

      return false;

      }

      DURING

      PDEForm element = (PDEForm)PDEContentGetElem(pageContent, foundIndex);

      PDOCContext context = PDDocGetOCContext(PDPageGetDoc(page));

      long visible = PDEElementIsCurrentlyVisible((PDEElement)element, pageContent, context);

      PDPageReleasePDEContent(page, 0);

      return visible > 0;

      HANDLER

      PDPageReleasePDEContent(page, 0);

      char errorMsg[256];

      ASGetErrorString(ASGetExceptionErrorCode(), errorMsg, 256);

      END_HANDLER

       

      return false;