mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Encryption bugfixing (RC4)
This commit is contained in:
@ -319,8 +319,18 @@ PDFOperationResult PDFDocumentWriter::write(QIODevice* device, const PDFDocument
|
||||
|
||||
// Jakub Melka: Adjust trailer dictionary, to be really dictionary, not a stream
|
||||
PDFDictionary trailerDictionary = *document->getTrailerDictionary();
|
||||
trailerDictionary.removeEntry("XRefStm");
|
||||
PDFObject trailerDictionaryObject = PDFObject::createDictionary(std::make_shared<PDFDictionary>(qMove(trailerDictionary)));
|
||||
PDFDictionary newTrailerDictionary;
|
||||
|
||||
for (const char* entry : { "Size", "Root", "Encrypt", "Info", "ID"})
|
||||
{
|
||||
PDFObject object = trailerDictionary.get(entry);
|
||||
if (!object.isNull())
|
||||
{
|
||||
newTrailerDictionary.addEntry(PDFInplaceOrMemoryString(entry), qMove(object));
|
||||
}
|
||||
}
|
||||
|
||||
PDFObject trailerDictionaryObject = PDFObject::createDictionary(std::make_shared<PDFDictionary>(qMove(newTrailerDictionary)));
|
||||
|
||||
device->write("trailer");
|
||||
writeCRLF(device);
|
||||
|
Reference in New Issue
Block a user