diff options
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 6 | ||||
-rw-r--r-- | vcl/source/pdf/ResourceDict.cxx | 24 |
2 files changed, 20 insertions, 10 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 84e40b463fe9..69e9740b9a3b 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2218,7 +2218,7 @@ bool PDFWriterImpl::emitTilings() aTilingObj.append( "]\n" ); } aTilingObj.append( "/Resources" ); - tiling.m_aResources.append( aTilingObj, getFontDictObject() ); + tiling.m_aResources.append(aTilingObj, getFontDictObject(), m_aContext.Version); if( bDeflate ) aTilingObj.append( "/Filter/FlateDecode" ); aTilingObj.append( "/Length " @@ -2688,7 +2688,7 @@ bool PDFWriterImpl::emitType3Font(const vcl::font::PhysicalFontFace* pFace, // write resources dict aLine.setLength(0); aLine.append(OString::number(nResources) + " 0 obj\n"); - aResourceDict.append(aLine, nFontDict); + aResourceDict.append(aLine, nFontDict, m_aContext.Version); aLine.append("endobj\n\n"); if (!updateObject(nResources)) return false; @@ -3192,7 +3192,7 @@ sal_Int32 PDFWriterImpl::emitResources() aLine.setLength( 0 ); aLine.append( OString::number(nResourceDict) + " 0 obj\n" ); - m_aGlobalResourceDict.append( aLine, getFontDictObject() ); + m_aGlobalResourceDict.append(aLine, getFontDictObject(), m_aContext.Version); aLine.append( "endobj\n\n" ); if (!writeBuffer(aLine)) return 0; return nResourceDict; diff --git a/vcl/source/pdf/ResourceDict.cxx b/vcl/source/pdf/ResourceDict.cxx index f4647cb38335..f19a428a6283 100644 --- a/vcl/source/pdf/ResourceDict.cxx +++ b/vcl/source/pdf/ResourceDict.cxx @@ -9,6 +9,7 @@ */ #include <pdf/ResourceDict.hxx> +#include <pdf/COSWriter.hxx> namespace vcl::pdf { @@ -40,19 +41,28 @@ void appendResourceMap(OStringBuffer& rBuf, const char* pPrefix, } } -void ResourceDict::append(OStringBuffer& rBuf, sal_Int32 nFontDictObject) +void ResourceDict::append(OStringBuffer& rBuf, sal_Int32 nFontDictObject, + PDFWriter::PDFVersion eVersion) { - rBuf.append("<<\n"); + COSWriter aWriter(rBuf); + aWriter.startDict(); if (nFontDictObject) - rBuf.append("/Font " + OString::number(nFontDictObject) + " 0 R\n"); + aWriter.writeKeyAndReference("/Font", nFontDictObject); appendResourceMap(rBuf, "XObject", m_aXObjects); appendResourceMap(rBuf, "ExtGState", m_aExtGStates); appendResourceMap(rBuf, "Shading", m_aShadings); appendResourceMap(rBuf, "Pattern", m_aPatterns); - rBuf.append("/ProcSet[/PDF/Text"); - if (!m_aXObjects.empty()) - rBuf.append("/ImageC/ImageI/ImageB"); - rBuf.append("]\n>>\n"); + + if (eVersion < PDFWriter::PDFVersion::PDF_2_0) + { + rBuf.append("/ProcSet"); + rBuf.append("["); + rBuf.append("/PDF/Text"); + if (!m_aXObjects.empty()) + rBuf.append("/ImageC/ImageI/ImageB"); + rBuf.append("]\n"); + } + aWriter.endDict(); } } // end vcl::pdf |