mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Add UndoMergePages
This commit is contained in:
@ -295,6 +295,12 @@ public:
|
||||
return ((CPdfFile*)m_pFile)->MergePages(data, size, nMaxID, sPrefixForm);
|
||||
return false;
|
||||
}
|
||||
bool UnmergePages()
|
||||
{
|
||||
if (m_nType == 0)
|
||||
return ((CPdfFile*)m_pFile)->UnmergePages();
|
||||
return false;
|
||||
}
|
||||
|
||||
BYTE* GetGlyphs(int nPageIndex)
|
||||
{
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
"_ScanPage",
|
||||
"_SplitPages",
|
||||
"_MergePages",
|
||||
"_UnmergePages",
|
||||
"_GetImageBase64",
|
||||
"_GetImageBase64Len",
|
||||
"_GetImageBase64Ptr",
|
||||
|
||||
@ -176,6 +176,10 @@ CFile.prototype["MergePages"] = function(arrayBuffer, maxID, prefixForm)
|
||||
{
|
||||
return this._MergePages(arrayBuffer, maxID, prefixForm);
|
||||
};
|
||||
CFile.prototype["UndoMergePages"] = function()
|
||||
{
|
||||
return this._UndoMergePages();
|
||||
};
|
||||
|
||||
// INFO DOCUMENT
|
||||
CFile.prototype.getInfo = function()
|
||||
|
||||
@ -162,6 +162,17 @@ CFile.prototype._MergePages = function(buffer, maxID, prefixForm)
|
||||
return bRes == 1;
|
||||
};
|
||||
|
||||
CFile.prototype._UndoMergePages = function()
|
||||
{
|
||||
let bRes = Module["_UnmergePages"](this.nativeFile);
|
||||
if (bRes == 1)
|
||||
{
|
||||
let str = this.stream.pop();
|
||||
Module["_free"](str);
|
||||
}
|
||||
return bRes == 1;
|
||||
};
|
||||
|
||||
// FONTS
|
||||
CFile.prototype._isNeedCMap = function()
|
||||
{
|
||||
|
||||
@ -185,6 +185,10 @@ WASM_EXPORT int MergePages(CDrawingFile* pFile, BYTE* data, LONG size, int nMaxI
|
||||
{
|
||||
return pFile->MergePages(data, size, nMaxID, sPrefixForm) ? 1 : 0;
|
||||
}
|
||||
WASM_EXPORT int UnmergePages(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->UnmergePages() ? 1 : 0;
|
||||
}
|
||||
|
||||
WASM_EXPORT void* GetImageBase64(CDrawingFile* pFile, int rId)
|
||||
{
|
||||
|
||||
@ -993,7 +993,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// SPLIT & MERGE
|
||||
BYTE* pSplitPages = NULL;
|
||||
if (false)
|
||||
if (true)
|
||||
{
|
||||
std::vector<int> arrPages = { 0 };
|
||||
for (int i = 0; i < 3; i++)
|
||||
@ -1010,11 +1010,14 @@ int main(int argc, char* argv[])
|
||||
|
||||
if (MergePages(pGrFile, pSplitPages + 4, nLength - 4, 0, "merge") == 0)
|
||||
RELEASEARRAYOBJECTS(pSplitPages);
|
||||
|
||||
if (!UnmergePages(pGrFile))
|
||||
std::cout << "error" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
BYTE* pFileMerge = NULL;
|
||||
if (true)
|
||||
if (false)
|
||||
{
|
||||
DWORD nFileMergeLen = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(NSFile::GetProcessDirectory() + L"/test_merge.pdf", &pFileMerge, nFileMergeLen))
|
||||
|
||||
Reference in New Issue
Block a user