From 46391f8bfdf2e2df3c4dd0b56b8a0794bad0f4f1 Mon Sep 17 00:00:00 2001 From: Svetlana Kulikova Date: Sat, 7 Oct 2023 13:17:16 +0300 Subject: [PATCH] Fix EditPdf --- PdfFile/PdfFile.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PdfFile/PdfFile.cpp b/PdfFile/PdfFile.cpp index b5f3a82d44..f348607b59 100644 --- a/PdfFile/PdfFile.cpp +++ b/PdfFile/PdfFile.cpp @@ -399,13 +399,15 @@ void CPdfFile::RotatePage(int nRotate) #ifndef BUILDING_WASM_MODULE bool CPdfFile::EditPdf(const std::wstring& wsDstFile) { + if (wsDstFile.empty()) + return false; + if (!m_pInternal->pReader) return false; + // Создание writer для редактирования RELEASEOBJECT(m_pInternal->pWriter); m_pInternal->pWriter = new CPdfWriter(m_pInternal->pAppFonts, false, this); - if (!wsDstFile.empty()) - NSFile::CFileBinary::Copy(m_pInternal->wsSrcFile, wsDstFile); PDFDoc* pPDFDocument = m_pInternal->pReader->GetPDFDocument(); if (!pPDFDocument) @@ -426,6 +428,8 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile) } else { + if (!NSFile::CFileBinary::Copy(m_pInternal->wsSrcFile, wsDstFile)) + return false; NSFile::CFileBinary oFile; if (!oFile.OpenFile(wsDstFile, true)) return false;