本文整理汇总了C++中CPDF_Dictionary::RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Dictionary::RemoveAt方法的具体用法?C++ CPDF_Dictionary::RemoveAt怎么用?C++ CPDF_Dictionary::RemoveAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Dictionary
的用法示例。
在下文中一共展示了CPDF_Dictionary::RemoveAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveInterFormFont
void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) {
if (!pFormDict || !pFont) {
return;
}
CFX_ByteString csTag;
if (!FindInterFormFont(pFormDict, pFont, csTag)) {
return;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
pFonts->RemoveAt(csTag);
}
示例2: GenerateContent
void CPDF_PageContentGenerate::GenerateContent() {
CFX_ByteTextBuf buf;
CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict;
for (int i = 0; i < m_pageObjects.GetSize(); ++i) {
CPDF_PageObject* pPageObj = (CPDF_PageObject*)m_pageObjects[i];
if (!pPageObj || pPageObj->m_Type != PDFPAGE_IMAGE) {
continue;
}
ProcessImage(buf, (CPDF_ImageObject*)pPageObj);
}
CPDF_Object* pContent =
pPageDict ? pPageDict->GetElementValue("Contents") : NULL;
if (pContent != NULL) {
pPageDict->RemoveAt("Contents");
}
CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);
pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE);
m_pDocument->AddIndirectObject(pStream);
pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum());
}
示例3: 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;
}
示例4: 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;
}
示例5: if
//.........这里部分代码省略.........
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;
if (pObj)
{
CPDF_Dictionary* pObjDic = pObj->GetDict();
if (pObjDic)
{
pObjDic->SetAtName("Type", "XObject");
pObjDic->SetAtName("Subtype", "Form");
}
}
CPDF_Dictionary* pXObject = pNewXORes->GetDict("XObject");
if (!pXObject)
{
pXObject = FX_NEW CPDF_Dictionary;
pNewXORes->SetAt("XObject", pXObject);
}
CFX_ByteString sFormName;
sFormName.Format("F%d", i);
FX_DWORD dwObjNum = pDocument->AddIndirectObject(pObj);
pXObject->SetAtReference(sFormName, pDocument, dwObjNum);
CPDF_StreamAcc acc;
acc.LoadAllData(pNewXObject);
FX_LPCBYTE pData = acc.GetData();
CFX_ByteString sStream(pData, acc.GetSize());
CFX_ByteString sTemp;
if (matrix.IsIdentity())
{
matrix.a = 1.0f;
matrix.b = 0.0f;
matrix.c = 0.0f;
matrix.d = 1.0f;
matrix.e = 0.0f;
matrix.f = 0.0f;
}
CFX_AffineMatrix m = GetMatrix(rcAnnot, rcStream, matrix);
sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, sFormName.c_str());
sStream += sTemp;
pNewXObject->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE);
}
pPageDict->RemoveAt( "Annots" );
ObjectArray.RemoveAll();
RectArray.RemoveAll();
return FLATTEN_SUCCESS;
}