本文整理汇总了C++中CPDF_Document::GetInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Document::GetInfo方法的具体用法?C++ CPDF_Document::GetInfo怎么用?C++ CPDF_Document::GetInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Document
的用法示例。
在下文中一共展示了CPDF_Document::GetInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FPDFDocumentFromCPDFDocument
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() {
CPDF_Document* pDoc = new CPDF_Document;
pDoc->CreateNewDoc();
time_t currentTime;
CFX_ByteString DateStr;
if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) {
if (-1 != time(¤tTime)) {
tm* pTM = localtime(¤tTime);
if (pTM) {
DateStr.Format("D:%04d%02d%02d%02d%02d%02d", pTM->tm_year + 1900,
pTM->tm_mon + 1, pTM->tm_mday, pTM->tm_hour, pTM->tm_min,
pTM->tm_sec);
}
}
}
CPDF_Dictionary* pInfoDict = NULL;
pInfoDict = pDoc->GetInfo();
if (pInfoDict) {
if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS))
pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr));
pInfoDict->SetAt("Creator", new CPDF_String(L"PDFium"));
}
return FPDFDocumentFromCPDFDocument(pDoc);
}
示例2: CPDFDocumentFromFPDFDocument
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document,
FPDF_BYTESTRING tag,
void* buffer,
unsigned long buflen) {
if (!tag)
return 0;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return 0;
const CPDF_Dictionary* pInfo = pDoc->GetInfo();
if (!pInfo)
return 0;
WideString text = pInfo->GetUnicodeTextFor(tag);
return Utf16EncodeMaybeCopyAndReturnLength(text, buffer, buflen);
}
示例3:
DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc,
FPDF_BYTESTRING tag,
void* buffer,
unsigned long buflen) {
if (!doc || !tag)
return 0;
CPDF_Document* pDoc = (CPDF_Document*)doc;
// Get info dictionary
CPDF_Dictionary* pInfo = pDoc->GetInfo();
if (!pInfo)
return 0;
CFX_WideString text = pInfo->GetUnicodeText(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;
}
示例4:
DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTRING tag,
void* buffer, unsigned long buflen)
{
if (doc == NULL || tag == NULL) return 0;
CPDF_Document* pDoc = (CPDF_Document*)doc;
// Get info dictionary
CPDF_Dictionary* pInfo = pDoc->GetInfo();
if (pInfo == NULL) return 0;
CFX_WideString text = pInfo->GetUnicodeText(tag);
// Use UTF-16LE encoding
CFX_ByteString bstr = text.UTF16LE_Encode();
unsigned long len = bstr.GetLength();
if (buffer != NULL || buflen >= len+2) {
FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len);
// use double zero as trailer
((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0;
}
return len+2;
}