Hi Matias,

You are obviously right! I fixed the implementation of PdfNamesTree::HasValue.
Does this change fix the first problem you reported?

Cheers,
        Dominik

On Thursday, January 06, 2011 04:54:48 pm Matias wrote:
> I found a seeming bug in PdfNamesTree::HasValue whilst trying to debug this
> issue. As Leonard helpfully pointed out, I should drop the / from in front
> of the name. I put it there in confusion because HasValue returned false
> if I queried for the key name without the slash. Well, as it turns out,
> the definition of PdfNamesTree::HasValue is as follows:
> 
> bool PdfNamesTree::HasValue( const PdfName & tree, const PdfString & key )
> const {
>     return ( this->GetValue( tree, key) == NULL );
> }
> 
> Surely it should be != NULL ?
> 
> > I have a PdfAnnotation* stored in a variable named ann. The destination
> > of this PDF annotation is a named object in the document (a page
> > object). I've checked that ann->HasDestination() returns true for it.
> > However, if I try the following, I get an EXC_BAD_ACCESS: PdfDestination
> > destination = ann->GetDestination();
> > 
> > Furthermore, if I try and resolve the destination of the object in the
> > following way through the /Dests names tree of the document, I get a
> > NULL back:
> > 
> > PdfDictionary dict = ann->GetObject()->GetDictionary();
> > PdfObject *indirKey = ann->GetObject()->GetIndirectKey("Dest");
> > cerr << indirKey->GetString().GetStringUtf8(); //returns the name of the
> > named object correctly
> > 
> > PdfNamesTree *namesTree = doc->GetNamesTree();
> > PdfObject *dests = namesTree->GetDestsNode();
> > PdfString str = indirKey->GetString();
> > PdfObject *indirObj = dests->GetIndirectKey(str.GetStringUtf8());
> > 
> > if (namesTree->HasValue(PdfName("/Dests"),str)) {
> > 
> >     PdfObject *destObj = namesTree->GetValue(PdfName("/Dests"),
> >     indirKey->GetString());
> >     
> >     if (!destObj) {
> >     
> >             cerr << "Value is NULL!"; //this code is reached, and it 
> > shouldn't?
> >     
> >     }
> > 
> > }
> > 
> > Any ideas of what I am doing wrong? Does this have something to do with
> > lazy loading and accessing an indirect key perhaps?
> > ------------------------------------------------------------------------
> > ------ Learn how Oracle Real Application Clusters (RAC) One Node allows
> > customers to consolidate database storage, standardize their database
> > environment, and, should the need arise, upgrade to a full multi-node
> > Oracle RAC database without downtime or disruption
> > http://p.sf.net/sfu/oracle-sfdevnl
> > _______________________________________________
> > Podofo-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/podofo-users
> 
> ---------------------------------------------------------------------------
> --- Learn how Oracle Real Application Clusters (RAC) One Node allows
> customers to consolidate database storage, standardize their database
> environment, and, should the need arise, upgrade to a full multi-node
> Oracle RAC database without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Podofo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/podofo-users

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to