Commit 5818f499 authored by Oleg Korshul's avatar Oleg Korshul

htmlrenderer no base64

parent 691042c5
...@@ -181,7 +181,7 @@ namespace NSHtmlRenderer ...@@ -181,7 +181,7 @@ namespace NSHtmlRenderer
virtual HRESULT put_Mode(LONG lMode); virtual HRESULT put_Mode(LONG lMode);
virtual HRESULT CreateOfficeFile(std::wstring bsFileName, const std::wstring& fontsDir = L""); virtual HRESULT CreateOfficeFile(std::wstring bsFileName, const std::wstring& fontsDir = L"");
virtual HRESULT CloseFile(); virtual HRESULT CloseFile(bool bIsNoBase64 = false);
virtual HRESULT SetAdditionalParam(std::string sParamName, int nValue); virtual HRESULT SetAdditionalParam(std::string sParamName, int nValue);
virtual HRESULT SetAdditionalParam(std::string sParamName, const std::wstring& sParam); virtual HRESULT SetAdditionalParam(std::string sParamName, const std::wstring& sParam);
......
...@@ -1287,14 +1287,14 @@ namespace NSHtmlRenderer ...@@ -1287,14 +1287,14 @@ namespace NSHtmlRenderer
m_pInternal->m_oSimpleGraphicsConverter.SetRenderer(this); m_pInternal->m_oSimpleGraphicsConverter.SetRenderer(this);
return S_OK; return S_OK;
} }
HRESULT CASCHTMLRenderer3::CloseFile() HRESULT CASCHTMLRenderer3::CloseFile(bool bIsNoBase64)
{ {
if (m_pInternal->m_bPageOpened) if (m_pInternal->m_bPageOpened)
{ {
m_pInternal->EndPage(); m_pInternal->EndPage();
} }
m_pInternal->m_oWriter.WriteEndDocument(m_pInternal->m_oDocument); m_pInternal->m_oWriter.WriteEndDocument(m_pInternal->m_oDocument, bIsNoBase64);
return S_OK; return S_OK;
} }
......
...@@ -2075,7 +2075,7 @@ namespace NSHtmlRenderer ...@@ -2075,7 +2075,7 @@ namespace NSHtmlRenderer
m_bIsGids = false; m_bIsGids = false;
} }
void WriteEndDocument(CDocument& oDocument) void WriteEndDocument(CDocument& oDocument, bool bIsNoBase64)
{ {
CMetafile oDocInfo; CMetafile oDocInfo;
oDocInfo.WriteLONG(m_lPagesCount); oDocInfo.WriteLONG(m_lPagesCount);
...@@ -2114,22 +2114,36 @@ namespace NSHtmlRenderer ...@@ -2114,22 +2114,36 @@ namespace NSHtmlRenderer
NSFile::CFileBinary::Remove(m_strDstDirectoryFiles + L"/document_temp.bin"); NSFile::CFileBinary::Remove(m_strDstDirectoryFiles + L"/document_temp.bin");
char* pOutput = NULL; if (bIsNoBase64)
int nOutputLen = 0; {
NSFile::CBase64Converter::Encode(pData, lSizeAll, pOutput, nOutputLen, NSBase64::B64_BASE64_FLAG_NOCRLF); NSFile::CFileBinary oDestinationFile;
oDestinationFile.CreateFileW(m_strDstDirectoryFiles + L"/Editor.bin");
oDestinationFile.WriteFile(pData, (DWORD)lSizeAll);
oDestinationFile.CloseFile();
RELEASEARRAYOBJECTS(pData);
}
else
{
char* pOutput = NULL;
int nOutputLen = 0;
NSFile::CBase64Converter::Encode(pData, lSizeAll, pOutput, nOutputLen, NSBase64::B64_BASE64_FLAG_NOCRLF);
RELEASEARRAYOBJECTS(pData);
RELEASEARRAYOBJECTS(pData); std::string sDstLen = std::to_string(nOutputLen);
sDstLen += ";";
std::string sDstLen = std::to_string(nOutputLen); NSFile::CFileBinary _file;
sDstLen += ";"; _file.CreateFileW(m_strDstDirectoryFiles + L"/Editor.bin");
NSFile::CFileBinary _file; _file.WriteFile((BYTE*)sDstLen.c_str(), (DWORD)sDstLen.length());
_file.CreateFileW(m_strDstDirectoryFiles + L"/Editor.bin"); _file.WriteFile((BYTE*)pOutput, (DWORD)nOutputLen);
_file.WriteFile((BYTE*)sDstLen.c_str(), (DWORD)sDstLen.length()); _file.CloseFile();
_file.WriteFile((BYTE*)pOutput, (DWORD)nOutputLen);
_file.CloseFile(); RELEASEARRAYOBJECTS(pOutput);
}
::CFontManager* pFontManager = m_pApplicationFonts->GenerateFontManager(); ::CFontManager* pFontManager = m_pApplicationFonts->GenerateFontManager();
m_oDstFontGenerator.WriteFonts(pFontManager, m_strDstDirectoryFiles + L"/fonts", m_bIsGids); m_oDstFontGenerator.WriteFonts(pFontManager, m_strDstDirectoryFiles + L"/fonts", m_bIsGids);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment