diff --git a/PdfForQtLib/PdfForQtLib.pro b/PdfForQtLib/PdfForQtLib.pro index f82ec4b..e91610f 100644 --- a/PdfForQtLib/PdfForQtLib.pro +++ b/PdfForQtLib/PdfForQtLib.pro @@ -130,6 +130,11 @@ LIBS += -L$$PDFFORQT_DEPENDENCIES_PATH/libjpeg/bin/ -ljpeg INCLUDEPATH += $$PDFFORQT_DEPENDENCIES_PATH/libjpeg/include DEPENDPATH += $$PDFFORQT_DEPENDENCIES_PATH/libjpeg/include +# Add libjpeg to installations +libjpeg.files = $$PDFFORQT_DEPENDENCIES_PATH/libjpeg/bin/jpeg.dll +libjpeg.path = $$DESTDIR/install +INSTALLS += libjpeg + # Link OpenSSL LIBS += -L$$PDFFORQT_DEPENDENCIES_PATH/OpenSSL/ -llibcrypto -llibssl INCLUDEPATH += $$PDFFORQT_DEPENDENCIES_PATH/OpenSSL/include diff --git a/PdfForQtLib/sources/pdfimage.cpp b/PdfForQtLib/sources/pdfimage.cpp index 15bfe8a..35babf9 100644 --- a/PdfForQtLib/sources/pdfimage.cpp +++ b/PdfForQtLib/sources/pdfimage.cpp @@ -464,7 +464,7 @@ PDFImage PDFImage::createImage(const PDFDocument* document, const PDFStream* str } } } - else if (imageFilterName == "CCITTFaxDecode") + else if (imageFilterName == "CCITTFaxDecode" || imageFilterName == "CCF") { throw PDFRendererException(RenderErrorType::NotImplemented, PDFTranslationContext::tr("Not implemented image filter 'CCITFaxDecode'.")); } diff --git a/PdfForQtLib/sources/pdfpagecontentprocessor.cpp b/PdfForQtLib/sources/pdfpagecontentprocessor.cpp index 9d89ae3..c05656e 100644 --- a/PdfForQtLib/sources/pdfpagecontentprocessor.cpp +++ b/PdfForQtLib/sources/pdfpagecontentprocessor.cpp @@ -200,7 +200,6 @@ PDFPageContentProcessor::PDFPageContentProcessor(const PDFPage* page, m_textBeginEndState(0), m_compatibilityBeginEndState(0), m_drawingUncoloredTilingPatternState(0), - m_isWarningColorOperatorsInUncoloredTilingPatternReported(false), m_patternBaseMatrix(pagePointToDevicePointMatrix), m_pagePointToDevicePointMatrix(pagePointToDevicePointMatrix), m_meshQualitySettings(meshQualitySettings) @@ -1628,6 +1627,15 @@ void PDFPageContentProcessor::setRenderingIntentByName(QByteArray renderingInten m_graphicState.setRenderingIntentName(renderingIntentName); } +void PDFPageContentProcessor::reportRenderErrorOnce(RenderErrorType type, QString message) +{ + if (!m_onceReportedErrors.count(message)) + { + m_onceReportedErrors.insert(message); + reportRenderError(type, message); + } +} + void PDFPageContentProcessor::processApplyGraphicState(const PDFDictionary* graphicStateDictionary) { PDFDocumentDataLoaderDecorator loader(m_document); @@ -1717,7 +1725,7 @@ void PDFPageContentProcessor::processApplyGraphicState(const PDFDictionary* grap bool isNone = (softMaskObject.isName() && softMaskObject.getString() == "None"); if (!isNone) { - reportRenderError(RenderErrorType::NotSupported, PDFTranslationContext::tr("Soft masks not supported.")); + reportRenderErrorOnce(RenderErrorType::NotSupported, PDFTranslationContext::tr("Soft masks not supported.")); } } } @@ -2679,11 +2687,7 @@ void PDFPageContentProcessor::paintXObjectImage(const PDFStream* stream) void PDFPageContentProcessor::reportWarningAboutColorOperatorsInUTP() { - if (!m_isWarningColorOperatorsInUncoloredTilingPatternReported) - { - m_isWarningColorOperatorsInUncoloredTilingPatternReported = true; - m_errorList.push_back(PDFRenderError(RenderErrorType::Warning, PDFTranslationContext::tr("Color operators are not allowed in uncolored tilling pattern."))); - } + reportRenderErrorOnce(RenderErrorType::Warning, PDFTranslationContext::tr("Color operators are not allowed in uncolored tilling pattern.")); } void PDFPageContentProcessor::operatorPaintXObject(PDFPageContentProcessor::PDFOperandName name) diff --git a/PdfForQtLib/sources/pdfpagecontentprocessor.h b/PdfForQtLib/sources/pdfpagecontentprocessor.h index 9c4b924..28cf854 100644 --- a/PdfForQtLib/sources/pdfpagecontentprocessor.h +++ b/PdfForQtLib/sources/pdfpagecontentprocessor.h @@ -168,6 +168,10 @@ public: virtual void reportRenderError(RenderErrorType type, QString message) override; + /// Reports render error, but only once - if same error was already reported, + /// then no new error is reported. + void reportRenderErrorOnce(RenderErrorType type, QString message); + protected: class PDFLineDashPattern @@ -883,9 +887,6 @@ private: /// Is drawing uncolored tiling pattern? int m_drawingUncoloredTilingPatternState; - /// Is warning about uncolored tiling patterns reported? - bool m_isWarningColorOperatorsInUncoloredTilingPatternReported; - /// Actually realized physical font PDFCachedItem m_realizedFont; @@ -906,6 +907,9 @@ private: /// Mesh quality settings PDFMeshQualitySettings m_meshQualitySettings; + + /// Set with rendering errors, which were reported (and should be reported once) + std::set m_onceReportedErrors; }; } // namespace pdf diff --git a/PdfForQtLib/sources/pdfpainter.cpp b/PdfForQtLib/sources/pdfpainter.cpp index 70ccc1d..5660205 100644 --- a/PdfForQtLib/sources/pdfpainter.cpp +++ b/PdfForQtLib/sources/pdfpainter.cpp @@ -199,14 +199,14 @@ void PDFPainter::performUpdateGraphicsState(const PDFPageContentProcessorState& if (!PDFBlendModeInfo::isSupportedByQt(blendMode)) { - reportRenderError(RenderErrorType::NotSupported, PDFTranslationContext::tr("Blend mode '%1' not supported.").arg(PDFBlendModeInfo::getBlendModeName(blendMode))); + reportRenderErrorOnce(RenderErrorType::NotSupported, PDFTranslationContext::tr("Blend mode '%1' not supported.").arg(PDFBlendModeInfo::getBlendModeName(blendMode))); } m_painter->setCompositionMode(compositionMode); } else if (blendMode != BlendMode::Normal && blendMode != BlendMode::Compatible) { - reportRenderError(RenderErrorType::NotSupported, PDFTranslationContext::tr("Blend mode '%1' is in transparency group, which is not supported.").arg(PDFBlendModeInfo::getBlendModeName(blendMode))); + reportRenderErrorOnce(RenderErrorType::NotSupported, PDFTranslationContext::tr("Blend mode '%1' is in transparency group, which is not supported.").arg(PDFBlendModeInfo::getBlendModeName(blendMode))); } } @@ -366,7 +366,4 @@ bool PDFPainter::canSetBlendMode(BlendMode mode) const return std::all_of(m_transparencyGroupDataStack.cbegin(), m_transparencyGroupDataStack.cend(), [](const PDFTransparencyGroupPainterData& group) { return group.blendMode == BlendMode::Normal || group.blendMode == BlendMode::Compatible; }); } -// TODO: Check all graphic state parameter dictionaries, warn about missing ones -// TODO: Recompile libraries in MSVC 2019 - } // namespace pdf