本文整理汇总了C++中CPDF_Dictionary::GetUnicodeTextFor方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Dictionary::GetUnicodeTextFor方法的具体用法?C++ CPDF_Dictionary::GetUnicodeTextFor怎么用?C++ CPDF_Dictionary::GetUnicodeTextFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Dictionary
的用法示例。
在下文中一共展示了CPDF_Dictionary::GetUnicodeTextFor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FPDF_GetFullName
CFX_WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict) {
CFX_WideString full_name;
std::set<CPDF_Dictionary*> visited;
CPDF_Dictionary* pLevel = pFieldDict;
while (pLevel) {
visited.insert(pLevel);
CFX_WideString short_name = pLevel->GetUnicodeTextFor("T");
if (!short_name.IsEmpty()) {
if (full_name.IsEmpty())
full_name = short_name;
else
full_name = short_name + L"." + full_name;
}
pLevel = pLevel->GetDictFor("Parent");
if (pdfium::ContainsKey(visited, pLevel))
break;
}
return full_name;
}
示例2: CPDFDocumentFromFPDFDocument
DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc,
FPDF_BYTESTRING tag,
void* buffer,
unsigned long buflen) {
if (!tag)
return 0;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc);
if (!pDoc)
return 0;
CPDF_Dictionary* pInfo = pDoc->GetInfo();
if (!pInfo)
return 0;
CFX_WideString text = pInfo->GetUnicodeTextFor(tag);
// Use UTF-16LE encoding
CFX_ByteString encodedText = text.UTF16LE_Encode();
unsigned long len = encodedText.GetLength();
if (buffer && buflen >= len) {
FXSYS_memcpy(buffer, encodedText.c_str(), len);
}
return len;
}
示例3: FDFToURLEncodedData
FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf,
FX_STRSIZE& nBufSize) {
CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize);
if (!pFDF)
return TRUE;
CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictFor("FDF");
if (!pMainDict)
return FALSE;
CPDF_Array* pFields = pMainDict->GetArrayFor("Fields");
if (!pFields)
return FALSE;
CFX_ByteTextBuf fdfEncodedData;
for (uint32_t i = 0; i < pFields->GetCount(); i++) {
CPDF_Dictionary* pField = pFields->GetDictAt(i);
if (!pField)
continue;
CFX_WideString name;
name = pField->GetUnicodeTextFor("T");
CFX_ByteString name_b = CFX_ByteString::FromUnicode(name);
CFX_ByteString csBValue = pField->GetStringFor("V");
CFX_WideString csWValue = PDF_DecodeText(csBValue);
CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(csWValue);
fdfEncodedData << name_b.GetBuffer(name_b.GetLength());
name_b.ReleaseBuffer();
fdfEncodedData << "=";
fdfEncodedData << csValue_b.GetBuffer(csValue_b.GetLength());
csValue_b.ReleaseBuffer();
if (i != pFields->GetCount() - 1)
fdfEncodedData << "&";
}
nBufSize = fdfEncodedData.GetLength();
pBuf = FX_Alloc(uint8_t, nBufSize);
FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize);
return TRUE;
}