本文整理汇总了C++中PdfObject::IsReference方法的典型用法代码示例。如果您正苦于以下问题:C++ PdfObject::IsReference方法的具体用法?C++ PdfObject::IsReference怎么用?C++ PdfObject::IsReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PdfObject
的用法示例。
在下文中一共展示了PdfObject::IsReference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCSType
PDFColorSpace PDFAnalyzer::getCSType(PdfObject* cs)
{
try {
// colorspace is either a name or an array
if (cs && cs->IsName())
{
PdfName csName = cs->GetName();
if (csName == "DeviceGray")
return CS_DeviceGray;
else if (csName == "DeviceRGB")
return CS_DeviceRGB;
else if (csName == "DeviceCMYK")
return CS_DeviceCMYK;
}
else if (cs && cs->IsArray())
{
PdfArray csArr = cs->GetArray();
PdfObject csTypePdfName = csArr[0];
if (csTypePdfName.IsName())
{
PdfName csTypeName = csTypePdfName.GetName();
if (csTypeName == "ICCBased")
return CS_ICCBased;
else if (csTypeName == "CalGray")
return CS_CalGray;
else if (csTypeName == "CalRGB")
return CS_CalRGB;
else if (csTypeName == "Lab")
return CS_Lab;
else if (csTypeName == "Indexed")
{
PdfObject base = cs->GetArray()[1];
PdfObject* pBase = &base;
if (base.IsReference())
{
pBase = cs->GetOwner()->GetObject(base.GetReference());
}
pBase->SetOwner(cs->GetOwner());
return getCSType(pBase);
}
else if (csTypeName == "Separation")
return CS_Separation;
else if (csTypeName == "DeviceN")
return CS_DeviceN;
else if (csTypeName == "Pattern")
return CS_Pattern;
}
}
}
catch (PdfError & e)
{
qDebug() << "Error in identifying the color type";
e.PrintErrorMsg();
return CS_Unknown;
}
return CS_Unknown;
}
示例2: ReadObjects
void PdfParser::ReadObjects()
{
int i = 0;
PdfParserObject* pObject = NULL;
m_vecObjects->Reserve( m_nNumObjects );
// Check for encryption and make sure that the encryption object
// is loaded before all other objects
if( m_pTrailer->GetDictionary().HasKey( PdfName("Encrypt") ) )
{
#ifdef PODOFO_VERBOSE_DEBUG
PdfError::DebugMessage("The PDF file is encrypted.\n" );
#endif // PODOFO_VERBOSE_DEBUG
PdfObject* pEncrypt = m_pTrailer->GetDictionary().GetKey( PdfName("Encrypt") );
if( pEncrypt->IsReference() )
{
i = pEncrypt->GetReference().ObjectNumber();
pObject = new PdfParserObject( m_vecObjects, m_device, m_buffer, m_offsets[i].lOffset );
pObject->SetLoadOnDemand( m_bLoadOnDemand );
try {
pObject->ParseFile( NULL ); // The encryption dictionary is not encrypted :)
m_vecObjects->push_back( pObject );
m_offsets[i].bParsed = false;
m_pEncrypt = PdfEncrypt::CreatePdfEncrypt( pObject );
} catch( PdfError & e ) {
std::ostringstream oss;
if( pObject )
{
oss << "Error while loading object " << pObject->Reference().ObjectNumber() << " "
<< pObject->Reference().GenerationNumber() << std::endl;
delete pObject;
}
e.AddToCallstack( __FILE__, __LINE__, oss.str().c_str() );
throw e;
}
}
else if( pEncrypt->IsDictionary() )
m_pEncrypt = PdfEncrypt::CreatePdfEncrypt( pEncrypt );
else
{
PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidEncryptionDict,
"The encryption entry in the trailer is neither an object nor a reference." );
}
// Generate encryption keys
// Set user password, try first with an empty password
bool bAuthenticate = m_pEncrypt->Authenticate( "", this->GetDocumentId() );
#ifdef PODOFO_VERBOSE_DEBUG
PdfError::DebugMessage("Authentication with empty password: %i.\n", bAuthenticate );
#endif // PODOFO_VERBOSE_DEBUG
if( !bAuthenticate )
{
// authentication failed so we need a password from the user.
// The user can set the password using PdfParser::SetPassword
PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidPassword, "A password is required to read this PDF file.");
}
}
ReadObjectsInternal();
}