mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Bugfixing: correct handling of optional content
This commit is contained in:
@ -2741,29 +2741,29 @@ void PDFPageContentProcessor::operatorPaintXObject(PDFPageContentProcessor::PDFO
|
||||
|
||||
if (m_xobjectDictionary)
|
||||
{
|
||||
// According to the specification, XObjects are skipped entirely, as no operator was invoked.
|
||||
if (m_xobjectDictionary->hasKey("OC"))
|
||||
{
|
||||
const PDFObject& object = m_xobjectDictionary->get("OC");
|
||||
if (object.isReference())
|
||||
{
|
||||
if (isContentSuppressedByOC(object.getReference()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw PDFRendererException(RenderErrorType::Error, PDFTranslationContext::tr("Reference to optional content expected."));
|
||||
}
|
||||
}
|
||||
|
||||
const PDFObject& object = m_document->getObject(m_xobjectDictionary->get(name.name));
|
||||
if (object.isStream())
|
||||
{
|
||||
const PDFStream* stream = object.getStream();
|
||||
const PDFDictionary* streamDictionary = stream->getDictionary();
|
||||
|
||||
// According to the specification, XObjects are skipped entirely, as no operator was invoked.
|
||||
if (streamDictionary->hasKey("OC"))
|
||||
{
|
||||
const PDFObject& object = streamDictionary->get("OC");
|
||||
if (object.isReference())
|
||||
{
|
||||
if (isContentSuppressedByOC(object.getReference()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw PDFRendererException(RenderErrorType::Error, PDFTranslationContext::tr("Reference to optional content expected."));
|
||||
}
|
||||
}
|
||||
|
||||
PDFDocumentDataLoaderDecorator loader(m_document);
|
||||
QByteArray subtype = loader.readNameFromDictionary(streamDictionary, "Subtype");
|
||||
if (subtype == "Image")
|
||||
|
Reference in New Issue
Block a user