first question:
Why is the PdfDictionary class not described in the API documents?
second question:
How can the following code be made to work?
The intention is to add an entry to an XObject resource dictionary.
const PdfName &idname = xobj->GetIdentifier();
PdfDictionary &dict = canvas->GetResources()->GetDictionary();
if (PdfDictionary *xdict =
(PdfDictionary *) dict.GetKey(PdfName("XObject")))
{
cerr << "xdict found" << endl;
if (!xdict->HasKey(idname))
xdict->AddKey(idname, xobj->GetObjectReference());
}
else
{
PdfDictionary xdict;
cerr << "xdict not found" << endl;
xdict.AddKey(idname, xobj->GetObjectReference());
dict.AddKey(PdfName("XObject"), xdict);
}
If the XObject dictionary does not already exist, and the "else" clause
is executed, it succeeds.
If the XObject dictionary already exists, and the "then" clause is
executed, it segfaults.
I suspect that the problem is the typecast from the (PdfObject *)
returned by GetKey() to (PdfDictionary *), because I can't find any
inheritance relationship between those classes.
I don't understand why the automatic conversion the other way in
AddKey() is even allowed.
How are you supposed to get the XObject dictionary from the page
dictionary, and update it?
-- Ian Bruce
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users