Kaydet (Commit) bf64b4f1 authored tarafından Miklos Vajna's avatar Miklos Vajna

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/30726Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst f68b1541
......@@ -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())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment