Skip navigation
Currently Being Moderated

How to get more info from "This direct object already has a container." exception?

Sep 2, 2008 11:49 PM


I'm experimenting with PDF tree via PDE and Cos layers and after copying all elements from initial content to destination content via PDE layer and trying to set Resources/Contents at the end of my method via Cos - I get this exception: This direct object already has a container.

Is it possible to understand what is that direct object, which is not happy with my manipulations? Does this exception means that direct object belongs to some container already or some container contains this direct object?

Any help would be appreciated!
  • Currently Being Moderated
    Sep 2, 2008 11:54 PM   in reply to andrejusc
    The "container" here is a Cos object. A direct object cannot be stored
    into more than one other object (it does not matter whether the parent
    is direct or indirect). To see why this is the case, consider that
    direct objects are written inline when a PDF is saved. It cannot be
    written in two places.

    A = new direct object
    CosDictPut ( oneplace ... A ) - will succeed
    CosDictPut ( anotherplace ... A ) - will fail

    To find out which object is concerned, use normal debugging
    techniques; an exception is raised on your API call. (Tip: set a
    breakpoint on a longjmp in PIMain to catch all exceptions as early as

    You cannot find out what the other parent is by any API.

    Aandi Inston
    Mark as:
  • Currently Being Moderated
    Sep 3, 2008 5:42 AM   in reply to (Aandi_Inston)
    This is odd and suggests that an object needed to generate the page
    was not set up correctly, or perhaps was taken from somewhere else
    without copying.

    How is the PDEContent obtained or made?

    Aandi Inston
    Mark as:
  • Currently Being Moderated
    Sep 3, 2008 6:20 AM   in reply to andrejusc
    I'm not familiar with these methods enough to guess at the cause so
    I'll have to pass.

    Aandi Inston
    Mark as:
  • Currently Being Moderated
    Sep 3, 2008 6:47 AM   in reply to andrejusc
    Its hard to tell from this part of the code, but I see that you release the newPdeElement and THEN your comment suggests that you are going to check for the type of it and copy it with recursion. That might be the mistake.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)