Multimedia, rendition action

This commit is contained in:
Jakub Melka
2019-11-23 19:02:24 +01:00
parent 2a11fa18e0
commit 18ac9166c0
7 changed files with 1408 additions and 2 deletions

View File

@ -139,7 +139,7 @@ public:
Enum readEnumByName(const PDFObject& object, Iterator begin, Iterator end, Enum defaultValue) const
{
const PDFObject& dereferencedObject = m_document->getObject(object);
if (dereferencedObject.isName())
if (dereferencedObject.isName() || dereferencedObject.isString())
{
QByteArray name = dereferencedObject.getString();
@ -258,6 +258,11 @@ public:
/// \param object Object containing array of references
std::vector<QByteArray> readNameArray(const PDFObject& object) const;
/// Reads string array. Reads all values. If error occurs,
/// then empty array is returned.
/// \param object Object containing array of references
std::vector<QByteArray> readStringArray(const PDFObject& object) const;
/// Reads name array from dictionary. Reads all values. If error occurs,
/// then empty array is returned.
/// \param dictionary Dictionary containing desired data
@ -280,6 +285,12 @@ public:
/// \param key Entry key
QByteArray readStringFromDictionary(const PDFDictionary* dictionary, const char* key);
/// Reads string array from dictionary. Reads all values. If error occurs,
/// then empty array is returned.
/// \param dictionary Dictionary containing desired data
/// \param key Entry key
std::vector<QByteArray> readStringArrayFromDictionary(const PDFDictionary* dictionary, const char* key) const;
private:
const PDFDocument* m_document;
};
@ -326,6 +337,10 @@ public:
/// is returned (no exception is thrown).
const PDFObject& getObject(const PDFObject& object) const;
/// Returns dictionary from an object. If object is not a dictionary,
/// then nullptr is returned (no exception is thrown).
const PDFDictionary* getDictionaryFromObject(const PDFObject& object) const;
/// Returns object by reference. If dereference attempt fails, then null object
/// is returned (no exception is thrown).
const PDFObject& getObjectByReference(PDFObjectReference reference) const;
@ -383,6 +398,22 @@ const PDFObject& PDFDocument::getObject(const PDFObject& object) const
return object;
}
inline
const PDFDictionary* PDFDocument::getDictionaryFromObject(const PDFObject& object) const
{
const PDFObject& dereferencedObject = getObject(object);
if (dereferencedObject.isDictionary())
{
return dereferencedObject.getDictionary();
}
else if (dereferencedObject.isStream())
{
return dereferencedObject.getStream()->getDictionary();
}
return nullptr;
}
inline
const PDFObject& PDFDocument::getObjectByReference(PDFObjectReference reference) const
{