Remove whole EBX object for PDF when removing DRM

This commit is contained in:
Grégory Soutadé 2024-03-23 18:34:04 +01:00
parent b0fea2f144
commit c86d9d4346

View File

@ -1317,6 +1317,7 @@ namespace gourou
std::vector<uPDFParser::Object*> objects = parser.objects(); std::vector<uPDFParser::Object*> objects = parser.objects();
std::vector<uPDFParser::Object*>::iterator it; std::vector<uPDFParser::Object*>::iterator it;
std::vector<uPDFParser::Object*>::reverse_iterator rIt; std::vector<uPDFParser::Object*>::reverse_iterator rIt;
std::vector<uPDFParser::Object*> ebxObjects;
unsigned char decryptedKey[16]; unsigned char decryptedKey[16];
int ebxId; int ebxId;
@ -1375,7 +1376,7 @@ namespace gourou
if (object->objectId() == ebxId) if (object->objectId() == ebxId)
{ {
object->deleteKey("Filter"); ebxObjects.push_back(object);
continue; continue;
} }
@ -1485,6 +1486,9 @@ namespace gourou
} }
} }
for(it = ebxObjects.begin(); it != ebxObjects.end(); it++)
parser.removeObject(*it);
uPDFParser::Object& trailer = parser.getTrailer(); uPDFParser::Object& trailer = parser.getTrailer();
trailer.deleteKey("Encrypt"); trailer.deleteKey("Encrypt");