本文整理汇总了C++中CPDF_Stream::InitStreamFromFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Stream::InitStreamFromFile方法的具体用法?C++ CPDF_Stream::InitStreamFromFile怎么用?C++ CPDF_Stream::InitStreamFromFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Stream
的用法示例。
在下文中一共展示了CPDF_Stream::InitStreamFromFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _SaveXFADocumentData
//.........这里部分代码省略.........
CPDF_Stream* pTemplateStream = pArray->GetStream(iTemplate);
CPDF_StreamAcc streamAcc;
streamAcc.LoadAllData(pTemplateStream);
uint8_t* pData = (uint8_t*)streamAcc.GetData();
FX_DWORD dwSize2 = streamAcc.GetSize();
IFX_FileStream* pTemplate = FX_CreateMemoryStream(pData, dwSize2);
pContext->UpdateChecksum((IFX_FileRead*)pTemplate);
pTemplate->Release();
}
CPDF_Stream* pFormStream = NULL;
CPDF_Stream* pDataSetsStream = NULL;
if (iFormIndex != -1) {
// Get form CPDF_Stream
CPDF_Object* pFormPDFObj = pArray->GetElement(iFormIndex);
if (pFormPDFObj->GetType() == PDFOBJ_REFERENCE) {
CPDF_Object* pFormDircetObj = pFormPDFObj->GetDirect();
if (NULL != pFormDircetObj &&
pFormDircetObj->GetType() == PDFOBJ_STREAM) {
pFormStream = (CPDF_Stream*)pFormDircetObj;
}
} else if (pFormPDFObj->GetType() == PDFOBJ_STREAM) {
pFormStream = (CPDF_Stream*)pFormPDFObj;
}
}
if (iDataSetsIndex != -1) {
// Get datasets CPDF_Stream
CPDF_Object* pDataSetsPDFObj = pArray->GetElement(iDataSetsIndex);
if (pDataSetsPDFObj->GetType() == PDFOBJ_REFERENCE) {
CPDF_Reference* pDataSetsRefObj = (CPDF_Reference*)pDataSetsPDFObj;
CPDF_Object* pDataSetsDircetObj = pDataSetsRefObj->GetDirect();
if (NULL != pDataSetsDircetObj &&
pDataSetsDircetObj->GetType() == PDFOBJ_STREAM) {
pDataSetsStream = (CPDF_Stream*)pDataSetsDircetObj;
}
} else if (pDataSetsPDFObj->GetType() == PDFOBJ_STREAM) {
pDataSetsStream = (CPDF_Stream*)pDataSetsPDFObj;
}
}
// end
// L"datasets"
{
IFX_FileStream* pDsfileWrite = FX_CreateMemoryStream();
if (NULL == pDsfileWrite) {
pContext->Release();
pDsfileWrite->Release();
return FALSE;
}
if (pXFADocHandler->SavePackage(pXFADocView->GetDoc(),
CFX_WideStringC(L"datasets"),
pDsfileWrite) &&
pDsfileWrite->GetSize() > 0) {
// Datasets
pContext->UpdateChecksum((IFX_FileRead*)pDsfileWrite);
pContext->FinishChecksum();
CPDF_Dictionary* pDataDict = new CPDF_Dictionary;
if (iDataSetsIndex != -1) {
if (pDataSetsStream)
pDataSetsStream->InitStreamFromFile(pDsfileWrite, pDataDict);
} else {
CPDF_Stream* pData = new CPDF_Stream(NULL, 0, NULL);
pData->InitStreamFromFile(pDsfileWrite, pDataDict);
pPDFDocument->AddIndirectObject(pData);
iLast = pArray->GetCount() - 2;
pArray->InsertAt(iLast, new CPDF_String("datasets", FALSE));
pArray->InsertAt(iLast + 1, pData, pPDFDocument);
}
fileList.Add(pDsfileWrite);
}
}
// L"form"
{
IFX_FileStream* pfileWrite = FX_CreateMemoryStream();
if (NULL == pfileWrite) {
pContext->Release();
return FALSE;
}
if (pXFADocHandler->SavePackage(pXFADocView->GetDoc(),
CFX_WideStringC(L"form"), pfileWrite,
pContext) &&
pfileWrite > 0) {
CPDF_Dictionary* pDataDict = new CPDF_Dictionary;
if (iFormIndex != -1) {
if (pFormStream)
pFormStream->InitStreamFromFile(pfileWrite, pDataDict);
} else {
CPDF_Stream* pData = new CPDF_Stream(NULL, 0, NULL);
pData->InitStreamFromFile(pfileWrite, pDataDict);
pPDFDocument->AddIndirectObject(pData);
iLast = pArray->GetCount() - 2;
pArray->InsertAt(iLast, new CPDF_String("form", FALSE));
pArray->InsertAt(iLast + 1, pData, pPDFDocument);
}
fileList.Add(pfileWrite);
}
}
pContext->Release();
return TRUE;
}