mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Refactoring and support binary shapes inside own pdf
This commit is contained in:
@ -420,29 +420,31 @@ public:
|
||||
oRenderer.SetExternalImageStorage(m_pImageStorage);
|
||||
oRenderer.SetTextAssociationType(NSDocxRenderer::TextAssociationType::tatParagraphToShape);
|
||||
|
||||
std::vector<std::wstring> arShapes;
|
||||
if (0 == mode)
|
||||
arShapes = oRenderer.ScanPage(m_pFile, nPageIndex);
|
||||
else if (1 == mode)
|
||||
arShapes = oRenderer.ScanPagePptx(m_pFile, nPageIndex);
|
||||
|
||||
int nLen = (int)arShapes.size();
|
||||
|
||||
NSWasm::CData oRes;
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
{
|
||||
std::vector<std::wstring> arShapes = (0 == mode) ? oRenderer.ScanPage(m_pFile, nPageIndex) : oRenderer.ScanPagePptx(m_pFile, nPageIndex);
|
||||
int nLen = (int)arShapes.size();
|
||||
|
||||
// mode 2 is binary format
|
||||
if (mode != 2)
|
||||
{
|
||||
oRes.SkipLen();
|
||||
oRes.AddInt(nLen);
|
||||
for (int i = 0; i < nLen; ++i)
|
||||
oRes.WriteString(arShapes[i]);
|
||||
oRes.WriteLen();
|
||||
}
|
||||
else
|
||||
{
|
||||
oRes = oRenderer.ScanPageBin(m_pFile, nPageIndex);
|
||||
oRes.SkipLen();
|
||||
oRes.AddInt(nLen);
|
||||
|
||||
for (int i = 0; i < nLen; ++i)
|
||||
oRes.WriteString(arShapes[i]);
|
||||
|
||||
oRes.WriteLen();
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
oRes = oRenderer.ScanPageBin(m_pFile, nPageIndex);
|
||||
}
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BYTE* res = oRes.GetBuffer();
|
||||
oRes.ClearWithoutAttack();
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user