xmlsecurity/source/pdfio/pdfdocument.cxx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
New commits: commit bf64b4f1451896810b66fd6edf6175f0dd46ac44 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Nov 9 16:53:51 2016 +0100 xmlsecurity PDF sign: compress the xref stream This way it's a bit smaller for large files and our output is closer to what Acrobat produces. Change-Id: Ide5f7b58a74a9d6ad7d806814eb57cb6931023cc Reviewed-on: https://gerrit.libreoffice.org/30726 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx b/xmlsecurity/source/pdfio/pdfdocument.cxx index fa0d9cc..c73ee5d 100644 --- a/xmlsecurity/source/pdfio/pdfdocument.cxx +++ b/xmlsecurity/source/pdfio/pdfdocument.cxx @@ -738,7 +738,7 @@ bool PDFDocument::Sign(const uno::Reference<security::XCertificate>& xCertificat } m_aEditBuffer.WriteUInt32AsString(nXRefStreamId); - m_aEditBuffer.WriteCharPtr(" 0 obj\n<<"); + m_aEditBuffer.WriteCharPtr(" 0 obj\n<</Filter/FlateDecode"); // ID. auto pID = dynamic_cast<PDFArrayElement*>(m_pXRefStream->Lookup("ID")); @@ -784,6 +784,18 @@ bool PDFDocument::Sign(const uno::Reference<security::XCertificate>& xCertificat // Length. m_aEditBuffer.WriteCharPtr("/Length "); + { + ZCodec aZCodec; + aZCodec.BeginCompression(); + aXRefStream.Seek(0); + SvMemoryStream aStream; + aZCodec.Compress(aXRefStream, aStream); + aZCodec.EndCompression(); + aXRefStream.Seek(0); + aXRefStream.SetStreamSize(0); + aStream.Seek(0); + aXRefStream.WriteStream(aStream); + } m_aEditBuffer.WriteUInt32AsString(aXRefStream.GetSize()); if (!m_aStartXRefs.empty()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits