Fix Redact in progress

This commit is contained in:
Svetlana Kulikova
2025-10-08 16:43:13 +03:00
parent 7e012dac94
commit 97560748aa

View File

@ -1654,6 +1654,10 @@ bool CPdfEditor::EditPage(int _nPageIndex, bool bSet, bool bActualPos)
if (m_nMode == Mode::Unknown && !IncrementalUpdates()) if (m_nMode == Mode::Unknown && !IncrementalUpdates())
return false; return false;
m_pWriter->AddRedact({});
WriteRedact({});
m_arrRedact.clear();
PDFDoc* pPDFDocument = NULL; PDFDoc* pPDFDocument = NULL;
PdfReader::CPdfFontList* pFontList = NULL; PdfReader::CPdfFontList* pFontList = NULL;
int nStartRefID = 0; int nStartRefID = 0;
@ -2697,6 +2701,10 @@ bool CPdfEditor::DeletePage(int nPageIndex)
if (m_nMode == Mode::Unknown && !IncrementalUpdates()) if (m_nMode == Mode::Unknown && !IncrementalUpdates())
return false; return false;
m_pWriter->AddRedact({});
WriteRedact({});
m_arrRedact.clear();
PdfWriter::CDocument* pDoc = m_pWriter->GetDocument(); PdfWriter::CDocument* pDoc = m_pWriter->GetDocument();
PdfWriter::CPage* pPage = pDoc->GetPage(nPageIndex); PdfWriter::CPage* pPage = pDoc->GetPage(nPageIndex);
int nObjID = m_mObjManager.FindObj(pPage); int nObjID = m_mObjManager.FindObj(pPage);
@ -2721,6 +2729,11 @@ bool CPdfEditor::AddPage(int nPageIndex)
{ {
if (m_nMode == Mode::Unknown && !IncrementalUpdates()) if (m_nMode == Mode::Unknown && !IncrementalUpdates())
return false; return false;
m_pWriter->AddRedact({});
WriteRedact({});
m_arrRedact.clear();
if (m_nMode == Mode::Split) if (m_nMode == Mode::Split)
{ {
std::vector<int>::iterator it = std::find(m_mObjManager.m_arrSplitAddPages.begin(), m_mObjManager.m_arrSplitAddPages.end(), m_nOriginIndex++); std::vector<int>::iterator it = std::find(m_mObjManager.m_arrSplitAddPages.begin(), m_mObjManager.m_arrSplitAddPages.end(), m_nOriginIndex++);
@ -2752,6 +2765,10 @@ bool CPdfEditor::AddPage(int nPageIndex)
} }
bool CPdfEditor::MovePage(int nPageIndex, int nPos) bool CPdfEditor::MovePage(int nPageIndex, int nPos)
{ {
m_pWriter->AddRedact({});
WriteRedact({});
m_arrRedact.clear();
if (m_nMode == Mode::Split || m_nMode == Mode::WriteNew || EditPage(nPageIndex, true, true)) if (m_nMode == Mode::Split || m_nMode == Mode::WriteNew || EditPage(nPageIndex, true, true))
return m_pWriter->GetDocument()->MovePage(nPageIndex, nPos); return m_pWriter->GetDocument()->MovePage(nPageIndex, nPos);
return false; return false;