I used arial.ttf
3. once you go through this problem, if we want a truly generic code, we must somehow refer to the DA string and the original resources....but one thing at a time.
PDFHummus::EStatusCode FindAcroFormID(std::string fieldName, ObjectIDType &outObjectID);
EStatusCode PDFParser::FindAcroFormID(std::string fieldName, ObjectIDType &outObjectID)
{
PDFObjectCastPtr<PDFIndirectObjectReference> catalogReference(mTrailer->QueryDirectObject("Root"));
if(!catalogReference)
{
TRACE_LOG("PDFParser::ParsePagesObjectIDs, failed to read catalog reference in trailer");
return PDFHummus::eFailure;
}
PDFObjectCastPtr<PDFDictionary> catalog(ParseNewObject(catalogReference->mObjectID));
if(!catalog)
{
TRACE_LOG("PDFParser::ParsePagesObjectIDs, failed to read catalog");
return PDFHummus::eFailure;
}
// get AcroForm, verify indirect reference
PDFObjectCastPtr<PDFIndirectObjectReference> AcroFormReference(catalog->QueryDirectObject("AcroForm"));
if(!AcroFormReference)
{
TRACE_LOG("PDFParser::ParseAcroForm, failed to read AcroForm reference in catalog");
return PDFHummus::eFailure;
}
PDFObjectCastPtr<PDFDictionary> AcroForm(ParseNewObject(AcroFormReference->mObjectID));
if(!AcroForm)
{
TRACE_LOG("PDFParser::ParseAcroForm, failed to read AcroForm");
return PDFHummus::eFailure;
}
PDFObjectCastPtr<PDFArray> AcroFormFields(AcroForm->QueryDirectObject("Fields"));
if(!AcroFormFields)
{
TRACE_LOG("PDFParser::ParseAcroForm, failed to read AcroFormFields");
return PDFHummus::eFailure;
}
EStatusCode status = PDFHummus::eFailure;
SingleValueContainerIterator<PDFObjectVector> it = AcroFormFields->GetIterator();
while(it.MoveNext())
{
if(it.GetItem()->GetType() != PDFObject::ePDFObjectIndirectObjectReference)
{
TRACE_LOG1("PDFParser::ParsePagesIDs, unexpected type for a AcroForm array object, type = %s",PDFObject::scPDFObjectTypeLabel[it.GetItem()->GetType()]);
status = PDFHummus::eFailure;
break;
}
PDFObject* pdfObject = it.GetItem();
PDFIndirectObjectReference* pdfIndobjRef = (PDFIndirectObjectReference*) pdfObject;
//pdfIndobjRef->mo
pdfObject = ParseNewObject(pdfIndobjRef->mObjectID);
PDFObjectCastPtr<PDFDictionary> AcroFormFieldObject(ParseNewObject(((PDFIndirectObjectReference*)it.GetItem())->mObjectID));
if(!AcroFormFieldObject)
{
TRACE_LOG("PDFParser::ParsePagesIDs, unable to parse page node object from AcroFormsFields reference");
status = PDFHummus::eFailure;
break;
}
//PDFObjectCastPtr<PDFName> FieldType(AcroFormFieldObject->QueryDirectObject("FT"));
PDFObjectCastPtr<PDFLiteralString> FieldValue(AcroFormFieldObject->QueryDirectObject("T"));
if(!FieldValue)
{
TRACE_LOG("PDFParser::ParseAcroForm, failed to read fieldName");
status = PDFHummus::eFailure;
break;
}
if(FieldValue->GetValue() == fieldName)
{
//return it.GetItem();
//return AcroFormReference->mObjectID;
status = PDFHummus::eSuccess;
outObjectID = pdfIndobjRef->mObjectID;
break;
//return AcroFormFieldObject;
//return status;
}
}
return status;
}
--
You received this message because you are subscribed to a topic in the Google Groups "PDFHummus interest group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pdfhummus-interest-group/rM-WNn2PRjk/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to pdfhummus-interest...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pdfhummus-interest-group/6be90853-d81f-466c-80db-f9ac2b89007d%40googlegroups.com?hl=en.
To unsubscribe from this group and all its topics, send an email to pdfhummus-interest-group+unsub...@googlegroups.com.