本文整理汇总了C++中CPDF_Dictionary::GetStartPos方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Dictionary::GetStartPos方法的具体用法?C++ CPDF_Dictionary::GetStartPos怎么用?C++ CPDF_Dictionary::GetStartPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Dictionary
的用法示例。
在下文中一共展示了CPDF_Dictionary::GetStartPos方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CountInterFormFonts
FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict)
{
if (pFormDict == NULL) {
return 0;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
return 0;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
return 0;
}
FX_DWORD dwCount = 0;
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL) {
continue;
}
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect != NULL && pDirect->GetType() == PDFOBJ_DICTIONARY) {
if (((CPDF_Dictionary*)pDirect)->GetString("Type") == "Font") {
dwCount ++;
}
}
}
return dwCount;
}
示例2: info
FX_BOOL Document::info(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
ASSERT(m_pDocument != NULL);
CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo();
if (!pDictionary)return FALSE;
CFX_WideString cwAuthor = pDictionary->GetUnicodeText("Author");
CFX_WideString cwTitle = pDictionary->GetUnicodeText("Title");
CFX_WideString cwSubject = pDictionary->GetUnicodeText("Subject");
CFX_WideString cwKeywords = pDictionary->GetUnicodeText("Keywords");
CFX_WideString cwCreator = pDictionary->GetUnicodeText("Creator");
CFX_WideString cwProducer = pDictionary->GetUnicodeText("Producer");
CFX_WideString cwCreationDate = pDictionary->GetUnicodeText("CreationDate");
CFX_WideString cwModDate = pDictionary->GetUnicodeText("ModDate");
CFX_WideString cwTrapped = pDictionary->GetUnicodeText("Trapped");
v8::Isolate* isolate = GetIsolate(cc);
if (vp.IsGetting())
{
CJS_Context* pContext = (CJS_Context *)cc;
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, -1);
JS_PutObjectString(isolate, pObj, L"Author", cwAuthor.c_str());
JS_PutObjectString(isolate, pObj, L"Title", cwTitle.c_str());
JS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str());
JS_PutObjectString(isolate, pObj, L"Keywords", cwKeywords.c_str());
JS_PutObjectString(isolate, pObj, L"Creator", cwCreator.c_str());
JS_PutObjectString(isolate, pObj, L"Producer", cwProducer.c_str());
JS_PutObjectString(isolate, pObj, L"CreationDate", cwCreationDate.c_str());
JS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str());
JS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str());
// It's to be compatible to non-standard info dictionary.
FX_POSITION pos = pDictionary->GetStartPos();
while(pos)
{
CFX_ByteString bsKey;
CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey);
CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength());
if((pValueObj->GetType()==PDFOBJ_STRING) || (pValueObj->GetType()==PDFOBJ_NAME) )
JS_PutObjectString(isolate, pObj, wsKey.c_str(), pValueObj->GetUnicodeText().c_str());
if(pValueObj->GetType()==PDFOBJ_NUMBER)
JS_PutObjectNumber(isolate,pObj, wsKey.c_str(), (float)pValueObj->GetNumber());
if(pValueObj->GetType()==PDFOBJ_BOOLEAN)
JS_PutObjectBoolean(isolate,pObj, wsKey.c_str(), (bool)pValueObj->GetInteger());
}
vp << pObj;
return TRUE;
}
else
{
return TRUE;
}
}
示例3: SetOnStateName
void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn)
{
ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csValue = csOn;
if (csValue.IsEmpty()) {
csValue = "Yes";
}
if (csValue == "Off") {
csValue = "Yes";
}
CFX_ByteString csAS = m_pWidgetDict->GetString("AS", "Off");
if (csAS != "Off") {
m_pWidgetDict->SetAtName("AS", csValue);
}
CPDF_Dictionary* pAP = m_pWidgetDict->GetDict("AP");
if (pAP == NULL) {
return;
}
FX_POSITION pos1 = pAP->GetStartPos();
while (pos1) {
CFX_ByteString csKey1;
CPDF_Object* pObj1 = pAP->GetNextElement(pos1, csKey1);
if (pObj1 == NULL) {
continue;
}
CPDF_Object* pObjDirect1 = pObj1->GetDirect();
if (pObjDirect1->GetType() != PDFOBJ_DICTIONARY) {
continue;
}
CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)pObjDirect1;
FX_POSITION pos2 = pSubDict->GetStartPos();
while (pos2) {
CFX_ByteString csKey2;
CPDF_Object* pObj2 = pSubDict->GetNextElement(pos2, csKey2);
if (pObj2 == NULL) {
continue;
}
if (csKey2 != "Off") {
pSubDict->ReplaceKey(csKey2, csValue);
break;
}
}
}
}
示例4: nameTree
DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index, void* buffer, long* buflen)
{
if (!buffer)
*buflen = 0;
if (!document || index < 0) return NULL;
CPDF_Document* pDoc = (CPDF_Document*)document;
CPDF_Dictionary* pRoot = pDoc->GetRoot();
if (!pRoot) return NULL;
CPDF_Object* pDestObj = NULL;
CFX_ByteString bsName;
CPDF_NameTree nameTree(pDoc, FX_BSTRC("Dests"));
int count = nameTree.GetCount();
if (index >= count) {
CPDF_Dictionary* pDest = pRoot->GetDict(FX_BSTRC("Dests"));
if (!pDest) return NULL;
if (index >= count + pDest->GetCount()) return NULL;
index -= count;
FX_POSITION pos = pDest->GetStartPos();
int i = 0;
while (pos) {
pDestObj = pDest->GetNextElement(pos, bsName);
if (!pDestObj) continue;
if (i == index) break;
i++;
}
} else {
pDestObj = nameTree.LookupValue(index, bsName);
}
if (!pDestObj) return NULL;
if (pDestObj->GetType() == PDFOBJ_DICTIONARY) {
pDestObj = ((CPDF_Dictionary*)pDestObj)->GetArray(FX_BSTRC("D"));
if (!pDestObj) return NULL;
}
if (pDestObj->GetType() != PDFOBJ_ARRAY) return NULL;
CFX_WideString wsName = PDF_DecodeText(bsName);
CFX_ByteString utf16Name = wsName.UTF16LE_Encode();
unsigned int len = utf16Name.GetLength();
if (!buffer) {
*buflen = len;
} else if (*buflen >= len) {
memcpy(buffer, utf16Name.c_str(), len);
*buflen = len;
} else {
*buflen = -1;
}
return (FPDF_DEST)pDestObj;
}
示例5: FindInterFormFont
FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag)
{
if (pFormDict == NULL) {
return FALSE;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
return FALSE;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
return FALSE;
}
if (csFontName.GetLength() > 0) {
csFontName.Remove(' ');
}
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey, csTmp;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL) {
continue;
}
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) {
continue;
}
CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
if (pElement->GetString("Type") != "Font") {
continue;
}
pFont = pDocument->LoadFont(pElement);
if (pFont == NULL) {
continue;
}
CFX_ByteString csBaseFont;
csBaseFont = pFont->GetBaseFont();
csBaseFont.Remove(' ');
if (csBaseFont == csFontName) {
csNameTag = csKey;
return TRUE;
}
}
return FALSE;
}
示例6: FindResFontSameCharset
CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
CFX_ByteString& sFontAlias,
int32_t nCharset) {
if (!pResDict)
return NULL;
CPDF_Document* pDocument = GetDocument();
ASSERT(pDocument != NULL);
CPDF_Dictionary* pFonts = pResDict->GetDict("Font");
if (pFonts == NULL)
return NULL;
CPDF_Font* pFind = NULL;
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL)
continue;
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY)
continue;
CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
if (pElement->GetString("Type") != "Font")
continue;
CPDF_Font* pFont = pDocument->LoadFont(pElement);
if (pFont == NULL)
continue;
const CFX_SubstFont* pSubst = pFont->GetSubstFont();
if (pSubst == NULL)
continue;
if (pSubst->m_Charset == nCharset) {
sFontAlias = csKey;
pFind = pFont;
}
}
return pFind;
}
示例7: GetNativeInterFormFont
CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag)
{
if (pFormDict == NULL) {
return NULL;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
return NULL;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
return NULL;
}
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL) {
continue;
}
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) {
continue;
}
CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
if (pElement->GetString("Type") != "Font") {
continue;
}
CPDF_Font* pFind = pDocument->LoadFont(pElement);
if (pFind == NULL) {
continue;
}
CFX_SubstFont* pSubst = (CFX_SubstFont*)pFind->GetSubstFont();
if (pSubst == NULL) {
continue;
}
if (pSubst->m_Charset == (int)charSet) {
csNameTag = csKey;
return pFind;
}
}
return NULL;
}
示例8: GetOnStateName
CFX_ByteString CPDF_FormControl::GetOnStateName()
{
ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csOn;
CPDF_Dictionary* pAP = m_pWidgetDict->GetDict("AP");
if (pAP == NULL) {
return csOn;
}
CPDF_Dictionary* pN = pAP->GetDict("N");
if (pN == NULL) {
return csOn;
}
FX_POSITION pos = pN->GetStartPos();
while (pos) {
pN->GetNextElement(pos, csOn);
if (csOn != "Off") {
return csOn;
}
}
return CFX_ByteString();
}
示例9: GetInterFormFont
CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_DWORD index, CFX_ByteString& csNameTag)
{
if (pFormDict == NULL) {
return NULL;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
return NULL;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
return NULL;
}
FX_DWORD dwCount = 0;
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL) {
continue;
}
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) {
continue;
}
CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
if (pElement->GetString("Type") != "Font") {
continue;
}
if (dwCount == index) {
csNameTag = csKey;
return pDocument->LoadFont(pElement);
}
dwCount ++;
}
return NULL;
}
示例10: TraceObject
FX_BOOL CFFL_Utils::TraceObject(CPDF_Object* pObj)
{
if (!pObj) return FALSE;
FX_DWORD dwObjNum = pObj->GetObjNum();
switch (pObj->GetType())
{
case PDFOBJ_ARRAY:
{
CPDF_Array* pArray = (CPDF_Array*)pObj;
for (FX_DWORD i = 0; i < pArray->GetCount(); i ++)
{
CPDF_Object* pElement = pArray->GetElementValue(i);
TraceObject(pElement);
}
}
break;
case PDFOBJ_DICTIONARY:
{
CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj;
FX_POSITION fPos = pDict->GetStartPos();
CFX_ByteString csKey;
do
{
CPDF_Object* pElement = pDict->GetNextElement(fPos, csKey);
//TRACE(csKey + "\n");
if (!pElement) break;
TraceObject(pElement);
}while (TRUE);
}
break;
case PDFOBJ_STREAM:
{
CPDF_Stream* pStream = (CPDF_Stream*)pObj;
CPDF_Dictionary* pDict = pStream->GetDict();
TraceObject(pDict);
}
break;
case PDFOBJ_REFERENCE:
{
CPDF_Object* pDirectObj = pObj->GetDirect();
TraceObject(pDirectObj);
}
break;
case PDFOBJ_BOOLEAN:
break;
case PDFOBJ_NUMBER:
//TRACE("%d\n",(int32_t)pObj);
break;
case PDFOBJ_STRING:
//TRACE(((CPDF_String*)pObj)->GetString() + "\n");
break;
case PDFOBJ_NAME:
//TRACE(((CPDF_Name*)pObj)->GetString() + "\n");
break;
case PDFOBJ_NULL:
// case PDFOBJ_KEYWORD:
// case PDFOBJ_EOF:
default:
break;
}
if (dwObjNum == 0) return FALSE;
return TRUE;
}
示例11: rect
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX* matrix, FS_RECTF* clipRect)
{
if(!page)
return FALSE;
CFX_ByteTextBuf textBuf;
textBuf<<"q ";
CFX_FloatRect rect(clipRect->left, clipRect->bottom, clipRect->right, clipRect->top);
rect.Normalize();
CFX_ByteString bsClipping;
bsClipping.Format("%f %f %f %f re W* n ", rect.left, rect.bottom, rect.Width(), rect.Height());
textBuf<<bsClipping;
CFX_ByteString bsMatix;
bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b,matrix->c,matrix->d,matrix->e,matrix->f);
textBuf<<bsMatix;
CPDF_Page* pPage = (CPDF_Page*)page;
CPDF_Dictionary* pPageDic = pPage->m_pFormDict;
CPDF_Object* pContentObj = pPageDic->GetElement("Contents");
if(!pContentObj)
pContentObj = pPageDic->GetArray("Contents");
if(!pContentObj)
return FALSE;
CPDF_Dictionary* pDic = FX_NEW CPDF_Dictionary;
CPDF_Stream* pStream = FX_NEW CPDF_Stream(NULL,0, pDic);
pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize(), FALSE, FALSE);
CPDF_Document* pDoc = pPage->m_pDocument;
if(!pDoc)
return FALSE;
pDoc->AddIndirectObject(pStream);
pDic = FX_NEW CPDF_Dictionary;
CPDF_Stream* pEndStream = FX_NEW CPDF_Stream(NULL,0, pDic);
pEndStream->SetData((FX_LPCBYTE)" Q", 2, FALSE, FALSE);
pDoc->AddIndirectObject(pEndStream);
CPDF_Array* pContentArray = NULL;
if (pContentObj && pContentObj->GetType() == PDFOBJ_ARRAY)
{
pContentArray = (CPDF_Array*)pContentObj;
CPDF_Reference* pRef = FX_NEW CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
pContentArray->AddReference(pDoc,pEndStream);
}
else if(pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE)
{
CPDF_Reference* pReference = (CPDF_Reference*)pContentObj;
CPDF_Object* pDirectObj = pReference->GetDirect();
if(pDirectObj != NULL)
{
if(pDirectObj->GetType() == PDFOBJ_ARRAY)
{
pContentArray = (CPDF_Array*)pDirectObj;
CPDF_Reference* pRef = FX_NEW CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
pContentArray->AddReference(pDoc,pEndStream);
}
else if(pDirectObj->GetType() == PDFOBJ_STREAM)
{
pContentArray = FX_NEW CPDF_Array();
pContentArray->AddReference(pDoc,pStream->GetObjNum());
pContentArray->AddReference(pDoc,pDirectObj->GetObjNum());
pContentArray->AddReference(pDoc, pEndStream);
pPageDic->SetAtReference("Contents", pDoc, pDoc->AddIndirectObject(pContentArray));
}
}
}
//Need to transform the patterns as well.
CPDF_Dictionary* pRes = pPageDic->GetDict(FX_BSTRC("Resources"));
if(pRes)
{
CPDF_Dictionary* pPattenDict = pRes->GetDict(FX_BSTRC("Pattern"));
if(pPattenDict)
{
FX_POSITION pos = pPattenDict->GetStartPos();
while(pos)
{
CPDF_Dictionary* pDict = NULL;
CFX_ByteString key;
CPDF_Object* pObj = pPattenDict->GetNextElement(pos, key);
if(pObj->GetType() == PDFOBJ_REFERENCE)
pObj = pObj->GetDirect();
if(pObj->GetType() == PDFOBJ_DICTIONARY)
{
pDict = (CPDF_Dictionary*)pObj;
}
else if(pObj->GetType() == PDFOBJ_STREAM)
{
pDict = ((CPDF_Stream*)pObj)->GetDict();
}
else
continue;
CFX_AffineMatrix m = pDict->GetMatrix(FX_BSTRC("Matrix"));
//.........这里部分代码省略.........
示例12: ExportPage
FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
CFX_WordArray* nPageNum,
CPDF_Document* pDestPDFDoc,
int nIndex) {
int curpage = nIndex;
nonstd::unique_ptr<ObjectNumberMap> pObjNumberMap(new ObjectNumberMap);
for (int i = 0; i < nPageNum->GetSize(); ++i) {
CPDF_Dictionary* pCurPageDict = pDestPDFDoc->CreateNewPage(curpage);
CPDF_Dictionary* pSrcPageDict = pSrcPDFDoc->GetPage(nPageNum->GetAt(i) - 1);
if (!pSrcPageDict || !pCurPageDict)
return FALSE;
// Clone the page dictionary///////////
FX_POSITION SrcPos = pSrcPageDict->GetStartPos();
while (SrcPos) {
CFX_ByteString cbSrcKeyStr;
CPDF_Object* pObj = pSrcPageDict->GetNextElement(SrcPos, cbSrcKeyStr);
if (cbSrcKeyStr.Compare(("Type")) && cbSrcKeyStr.Compare(("Parent"))) {
if (pCurPageDict->KeyExist(cbSrcKeyStr))
pCurPageDict->RemoveAt(cbSrcKeyStr);
pCurPageDict->SetAt(cbSrcKeyStr, pObj->Clone());
}
}
// inheritable item///////////////////////
CPDF_Object* pInheritable = nullptr;
// 1 MediaBox //required
if (!pCurPageDict->KeyExist("MediaBox")) {
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "MediaBox");
if (!pInheritable) {
// Search the "CropBox" from source page dictionary,
// if not exists,we take the letter size.
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "CropBox");
if (pInheritable) {
pCurPageDict->SetAt("MediaBox", pInheritable->Clone());
} else {
// Make the default size to be letter size (8.5'x11')
CPDF_Array* pArray = new CPDF_Array;
pArray->AddNumber(0);
pArray->AddNumber(0);
pArray->AddNumber(612);
pArray->AddNumber(792);
pCurPageDict->SetAt("MediaBox", pArray);
}
} else {
pCurPageDict->SetAt("MediaBox", pInheritable->Clone());
}
}
// 2 Resources //required
if (!pCurPageDict->KeyExist("Resources")) {
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Resources");
if (!pInheritable)
return FALSE;
pCurPageDict->SetAt("Resources", pInheritable->Clone());
}
// 3 CropBox //Optional
if (!pCurPageDict->KeyExist("CropBox")) {
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "CropBox");
if (pInheritable)
pCurPageDict->SetAt("CropBox", pInheritable->Clone());
}
// 4 Rotate //Optional
if (!pCurPageDict->KeyExist("Rotate")) {
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Rotate");
if (pInheritable)
pCurPageDict->SetAt("Rotate", pInheritable->Clone());
}
/////////////////////////////////////////////
// Update the reference
FX_DWORD dwOldPageObj = pSrcPageDict->GetObjNum();
FX_DWORD dwNewPageObj = pCurPageDict->GetObjNum();
(*pObjNumberMap)[dwOldPageObj] = dwNewPageObj;
UpdateReference(pCurPageDict, pDestPDFDoc, pObjNumberMap.get());
++curpage;
}
return TRUE;
}
示例13: UpdateReference
FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
CPDF_Document* pDoc,
ObjectNumberMap* pObjNumberMap) {
switch (pObj->GetType()) {
case PDFOBJ_REFERENCE: {
CPDF_Reference* pReference = pObj->AsReference();
FX_DWORD newobjnum = GetNewObjId(pDoc, pObjNumberMap, pReference);
if (newobjnum == 0)
return FALSE;
pReference->SetRef(pDoc, newobjnum);
break;
}
case PDFOBJ_DICTIONARY: {
CPDF_Dictionary* pDict = pObj->AsDictionary();
FX_POSITION pos = pDict->GetStartPos();
while (pos) {
CFX_ByteString key("");
CPDF_Object* pNextObj = pDict->GetNextElement(pos, key);
if (!FXSYS_strcmp(key, "Parent") || !FXSYS_strcmp(key, "Prev") ||
!FXSYS_strcmp(key, "First")) {
continue;
}
if (pNextObj) {
if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
pDict->RemoveAt(key);
} else {
return FALSE;
}
}
break;
}
case PDFOBJ_ARRAY: {
CPDF_Array* pArray = pObj->AsArray();
FX_DWORD count = pArray->GetCount();
for (FX_DWORD i = 0; i < count; ++i) {
CPDF_Object* pNextObj = pArray->GetElement(i);
if (!pNextObj)
return FALSE;
if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
return FALSE;
}
break;
}
case PDFOBJ_STREAM: {
CPDF_Stream* pStream = pObj->AsStream();
CPDF_Dictionary* pDict = pStream->GetDict();
if (pDict) {
if (!UpdateReference(pDict, pDoc, pObjNumberMap))
return FALSE;
} else {
return FALSE;
}
break;
}
default:
break;
}
return TRUE;
}
示例14: Load
CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj)
{
if (pObj == NULL) {
return NULL;
}
if (pObj->GetType() == PDFOBJ_NAME) {
return _CSFromName(pObj->GetString());
}
if (pObj->GetType() == PDFOBJ_STREAM) {
CPDF_Dictionary *pDict = ((CPDF_Stream *)pObj)->GetDict();
if (!pDict) {
return NULL;
}
CPDF_ColorSpace *pRet = NULL;
FX_POSITION pos = pDict->GetStartPos();
while (pos) {
CFX_ByteString bsKey;
CPDF_Object *pValue = pDict->GetNextElement(pos, bsKey);
if (pValue && pValue->GetType() == PDFOBJ_NAME) {
pRet = _CSFromName(pValue->GetString());
}
if (pRet) {
return pRet;
}
}
return NULL;
}
if (pObj->GetType() != PDFOBJ_ARRAY) {
return NULL;
}
CPDF_Array* pArray = (CPDF_Array*)pObj;
if (pArray->GetCount() == 0) {
return NULL;
}
CPDF_Object *pFamilyObj = pArray->GetElementValue(0);
if (!pFamilyObj) {
return NULL;
}
CFX_ByteString familyname = pFamilyObj->GetString();
if (pArray->GetCount() == 1) {
return _CSFromName(familyname);
}
CPDF_ColorSpace* pCS = NULL;
FX_DWORD id = familyname.GetID();
if (id == FXBSTR_ID('C', 'a', 'l', 'G')) {
pCS = new CPDF_CalGray(pDoc);
} else if (id == FXBSTR_ID('C', 'a', 'l', 'R')) {
pCS = new CPDF_CalRGB(pDoc);
} else if (id == FXBSTR_ID('L', 'a', 'b', 0)) {
pCS = new CPDF_LabCS(pDoc);
} else if (id == FXBSTR_ID('I', 'C', 'C', 'B')) {
pCS = new CPDF_ICCBasedCS(pDoc);
} else if (id == FXBSTR_ID('I', 'n', 'd', 'e') || id == FXBSTR_ID('I', 0, 0, 0)) {
pCS = new CPDF_IndexedCS(pDoc);
} else if (id == FXBSTR_ID('S', 'e', 'p', 'a')) {
pCS = new CPDF_SeparationCS(pDoc);
} else if (id == FXBSTR_ID('D', 'e', 'v', 'i')) {
pCS = new CPDF_DeviceNCS(pDoc);
} else if (id == FXBSTR_ID('P', 'a', 't', 't')) {
pCS = new CPDF_PatternCS(pDoc);
} else {
return NULL;
}
pCS->m_pArray = pArray;
if (!pCS->v_Load(pDoc, pArray)) {
pCS->ReleaseCS();
return NULL;
}
return pCS;
}
示例15: if
//.........这里部分代码省略.........
pNewOXbjectDic->SetAt("Resources", pNewXORes);
pNewOXbjectDic->SetAtName("Type", "XObject");
pNewOXbjectDic->SetAtName("Subtype", "Form");
pNewOXbjectDic->SetAtInteger("FormType", 1);
pNewOXbjectDic->SetAtName("Name", "FRM");
CPDF_Rect rcBBox = pPageDict->GetRect("ArtBox");
pNewOXbjectDic->SetAtRect("BBox", rcBBox);
}
for (int i = 0; i < nStreams; i++)
{
CPDF_Dictionary* pAnnotDic = ObjectArray.GetAt(i);
if (!pAnnotDic)continue;
CPDF_Rect rcAnnot = pAnnotDic->GetRect("Rect");
rcAnnot.Normalize();
CFX_ByteString sAnnotState = pAnnotDic->GetString("AS");
CPDF_Dictionary* pAnnotAP = pAnnotDic->GetDict("AP");
if (!pAnnotAP)continue;
CPDF_Stream* pAPStream = pAnnotAP->GetStream("N");
if (!pAPStream)
{
CPDF_Dictionary* pAPDic = pAnnotAP->GetDict("N");
if (!pAPDic)continue;
if (!sAnnotState.IsEmpty())
{
pAPStream = pAPDic->GetStream(sAnnotState);
}
else
{
FX_POSITION pos = pAPDic->GetStartPos();
if (pos)
{
CFX_ByteString sKey;
CPDF_Object* pFirstObj = pAPDic->GetNextElement(pos, sKey);
if (pFirstObj)
{
if (pFirstObj->GetType() == PDFOBJ_REFERENCE)
pFirstObj = pFirstObj->GetDirect();
if (pFirstObj->GetType() != PDFOBJ_STREAM)
continue;
pAPStream = (CPDF_Stream*)pFirstObj;
}
}
}
}
if (!pAPStream)continue;
CPDF_Dictionary* pAPDic = pAPStream->GetDict();
CFX_AffineMatrix matrix = pAPDic->GetMatrix("Matrix");
CPDF_Rect rcStream;
if (pAPDic->KeyExist("Rect"))
rcStream = pAPDic->GetRect("Rect");
else if (pAPDic->KeyExist("BBox"))
rcStream = pAPDic->GetRect("BBox");
if (rcStream.IsEmpty())continue;
CPDF_Object* pObj = pAPStream;