mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Merge pull request 'UndoMergePages' (#285) from fix/merge-pages into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/285
This commit is contained in:
@ -618,10 +618,22 @@ HRESULT _ChangePassword(const std::wstring& wsPath, const std::wstring& wsPasswo
|
||||
}
|
||||
case objString:
|
||||
{
|
||||
TextString* s = new TextString(oTemp.getString());
|
||||
std::string sValue = NSStringExt::CConverter::GetUtf8FromUTF32(s->getUnicode(), s->getLength());
|
||||
pObj = new PdfWriter::CStringObject(sValue.c_str());
|
||||
delete s;
|
||||
GString* str = oTemp.getString();
|
||||
if (str->isBinary())
|
||||
{
|
||||
int nLength = str->getLength();
|
||||
BYTE* arrId = new BYTE[nLength];
|
||||
for (int nIndex = 0; nIndex < nLength; ++nIndex)
|
||||
arrId[nIndex] = str->getChar(nIndex);
|
||||
pObj = new PdfWriter::CBinaryObject(arrId, nLength, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
TextString* s = new TextString(str);
|
||||
std::string sValue = NSStringExt::CConverter::GetUtf8FromUTF32(s->getUnicode(), s->getLength());
|
||||
pObj = new PdfWriter::CStringObject(sValue.c_str(), !s->isPDFDocEncoding());
|
||||
delete s;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case objName:
|
||||
|
||||
@ -341,6 +341,12 @@ bool CPdfFile::MergePages(BYTE* data, DWORD length, int nMaxID, const std::strin
|
||||
return false;
|
||||
return m_pInternal->pReader->MergePages(data, length, L"", nMaxID, sPrefixForm) && (m_pInternal->pReader->GetError() == 0);
|
||||
}
|
||||
bool CPdfFile::UnmergePages()
|
||||
{
|
||||
if (!m_pInternal->pReader)
|
||||
return false;
|
||||
return m_pInternal->pReader->UnmergePages();
|
||||
}
|
||||
int CPdfFile::GetRotate(int nPageIndex)
|
||||
{
|
||||
if (!m_pInternal->pReader)
|
||||
|
||||
@ -128,6 +128,7 @@ public:
|
||||
|
||||
bool ValidMetaData();
|
||||
bool MergePages(BYTE* data, DWORD length, int nMaxID = 0, const std::string& sPrefixForm = "");
|
||||
bool UnmergePages();
|
||||
int GetRotate(int nPageIndex);
|
||||
int GetMaxRefID();
|
||||
BYTE* GetWidgets();
|
||||
|
||||
@ -643,6 +643,15 @@ bool CPdfReader::MergePages(const std::wstring& wsFile, const std::wstring& wsPa
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CPdfReader::UnmergePages()
|
||||
{
|
||||
if (m_vPDFContext.size() < 1)
|
||||
return false;
|
||||
CPdfReaderContext* pPDFContext = m_vPDFContext.back();
|
||||
delete pPDFContext;
|
||||
m_vPDFContext.pop_back();
|
||||
return true;
|
||||
}
|
||||
void CPdfReader::DrawPageOnRenderer(IRenderer* pRenderer, int _nPageIndex, bool* pbBreak)
|
||||
{
|
||||
PDFDoc* pDoc = NULL;
|
||||
|
||||
@ -79,6 +79,7 @@ public:
|
||||
bool ValidMetaData();
|
||||
bool MergePages(BYTE* pData, DWORD nLength, const std::wstring& wsPassword = L"", int nMaxID = 0, const std::string& sPrefixForm = "");
|
||||
bool MergePages(const std::wstring& wsFile, const std::wstring& wsPassword = L"", int nMaxID = 0, const std::string& sPrefixForm = "");
|
||||
bool UnmergePages();
|
||||
void GetPageInfo(int nPageIndex, double* pdWidth, double* pdHeight, double* pdDpiX, double* pdDpiY);
|
||||
void DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak);
|
||||
std::wstring GetInfo();
|
||||
|
||||
Reference in New Issue
Block a user