Create RedactOutputDev

This commit is contained in:
Svetlana Kulikova
2025-08-01 14:01:27 +03:00
parent c1bb697725
commit d6c58a4655
12 changed files with 303 additions and 141 deletions

View File

@ -852,9 +852,22 @@ namespace PdfWriter
pEntry->unByteOffset = 0;
pEntry->unGenNo = unObjectGen;
pEntry->pObject = pObject;
pObject->SetRef(m_unStartOffset + m_arrEntries.size() - 1, pEntry->unGenNo);
pObject->SetRef(0, pEntry->unGenNo);
pObject->SetIndirect();
}
void CXref::Remove(CObjectBase* pObject)
{
for (unsigned int unIndex = 0, unCount = m_arrEntries.size(); unIndex < unCount; ++unIndex)
{
TXrefEntry* pEntry = m_arrEntries.at(unIndex);
if (pEntry->pObject == pObject)
{
m_arrEntries.erase(m_arrEntries.begin() + unIndex);
delete pEntry;
break;
}
}
}
void CXref::WriteTrailer(CStream* pStream)
{
CXref* pPrev = m_pPrev;
@ -879,6 +892,18 @@ namespace PdfWriter
char* pEndPtr = sBuf + SHORT_BUFFER_SIZE - 1;
CXref* pXref = this;
while (pXref)
{
for (unsigned int unIndex = 0, unCount = pXref->m_arrEntries.size(); unIndex < unCount; unIndex++)
{
TXrefEntry* pEntry = pXref->m_arrEntries.at(unIndex);
if (pEntry->nEntryType != FREE_ENTRY && pEntry->pObject->GetObjId() == 0)
pEntry->pObject->SetRef(pXref->m_unStartOffset + unIndex, pEntry->unGenNo);
}
pXref = pXref->m_pPrev;
}
pXref = this;
TXrefEntry* pNextFreeObj = NULL;
while (pXref)
{