Finishing of actions

This commit is contained in:
Jakub Melka
2019-11-24 15:43:27 +01:00
parent 18ac9166c0
commit a857e061b8
7 changed files with 339 additions and 4 deletions

View File

@ -241,6 +241,38 @@ PDFActionPtr PDFAction::parseImpl(const PDFDocument* document, PDFObject object,
return PDFActionPtr(new PDFActionSetOCGState(qMove(items), isRadioButtonsPreserved));
}
else if (name == "Rendition")
{
PDFObject annotationObject = dictionary->get("AN");
std::optional<PDFRendition> rendition;
PDFObjectReference annotation = annotationObject.isReference() ? annotationObject.getReference() : PDFObjectReference();
PDFActionRendition::Operation operation = static_cast<PDFActionRendition::Operation>(loader.readIntegerFromDictionary(dictionary, "OP", 4));
QString javascript;
if (dictionary->hasKey("R"))
{
rendition = PDFRendition::parse(document, dictionary->get("R"));
}
PDFObject javascriptObject = document->getObject(dictionary->get("JS"));
if (javascriptObject.isString())
{
javascript = PDFEncoding::convertTextString(javascriptObject.getString());
}
else if (javascriptObject.isStream())
{
javascript = PDFEncoding::convertTextString(document->getDecodedStream(javascriptObject.getStream()));
}
return PDFActionPtr(new PDFActionRendition(qMove(rendition), annotation, operation, qMove(javascript)));
}
else if (name == "Trans")
{
return PDFActionPtr(new PDFActionTransition(PDFPageTransition::parse(document, dictionary->get("Trans"))));
}
else if (name == "GoTo3DView")
{
return PDFActionPtr(new PDFActionGoTo3DView(dictionary->get("TA"), dictionary->get("V")));
}
return PDFActionPtr();
}