Commit f925e5ca authored by konovalovsergey's avatar konovalovsergey

save zip if convert thumbnail with first=false

parent 13d57361
...@@ -697,6 +697,26 @@ namespace NExtractTools ...@@ -697,6 +697,26 @@ namespace NExtractTools
NSFile::CFileBinary::Remove(sPdfBinFile); NSFile::CFileBinary::Remove(sPdfBinFile);
return nRes; return nRes;
} }
std::wstring getExtentionByRasterFormat(int format)
{
std::wstring sExt;
switch(format)
{
case 1:
sExt = L".bmp";
break;
case 2:
sExt = L".gif";
break;
case 3:
sExt = L".jpg";
break;
default:
sExt = L".png";
break;
}
return sExt;
}
//doct_bin -> image //doct_bin -> image
int doct_bin2image(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params) int doct_bin2image(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
{ {
...@@ -756,9 +776,7 @@ namespace NExtractTools ...@@ -756,9 +776,7 @@ namespace NExtractTools
{ {
sThumbnailDir = sTemp + FILE_SEPARATOR_STR + _T("thumbnails"); sThumbnailDir = sTemp + FILE_SEPARATOR_STR + _T("thumbnails");
FileSystem::Directory::CreateDirectory(sThumbnailDir); FileSystem::Directory::CreateDirectory(sThumbnailDir);
std::wstring::size_type pos = sTo.find_last_of('.'); imageWriter.m_sFileName = sThumbnailDir + FILE_SEPARATOR_STR + L"image" + getExtentionByRasterFormat(imageWriter.m_nRasterFormat);
std::wstring sExt = std::wstring::npos == pos ? L"" : sTo.substr(pos);
imageWriter.m_sFileName = sThumbnailDir + FILE_SEPARATOR_STR + L"image" + sExt;
} }
BYTE* pData; BYTE* pData;
DWORD nBytesCount; DWORD nBytesCount;
...@@ -1777,9 +1795,7 @@ namespace NExtractTools ...@@ -1777,9 +1795,7 @@ namespace NExtractTools
{ {
sThumbnailDir = sTemp + FILE_SEPARATOR_STR + _T("thumbnails"); sThumbnailDir = sTemp + FILE_SEPARATOR_STR + _T("thumbnails");
FileSystem::Directory::CreateDirectory(sThumbnailDir); FileSystem::Directory::CreateDirectory(sThumbnailDir);
std::wstring::size_type pos = sTo.find_last_of('.'); sFileToExt = getExtentionByRasterFormat(nRasterFormat);
sFileToExt = std::wstring::npos == pos ? L"" : sTo.substr(pos);
} }
int nPagesCount = pReader->GetPagesCount(); int nPagesCount = pReader->GetPagesCount();
if (bIsOnlyFirst) if (bIsOnlyFirst)
...@@ -1908,7 +1924,7 @@ namespace NExtractTools ...@@ -1908,7 +1924,7 @@ namespace NExtractTools
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT; NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params); nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
} }
else if(AVS_OFFICESTUDIO_FILE_IMAGE == nFormatTo) else if(0 != (AVS_OFFICESTUDIO_FILE_IMAGE & nFormatTo))
{ {
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT; NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params); nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
...@@ -2075,7 +2091,7 @@ namespace NExtractTools ...@@ -2075,7 +2091,7 @@ namespace NExtractTools
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::XLST; NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::XLST;
nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params); nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
} }
else if(AVS_OFFICESTUDIO_FILE_IMAGE == nFormatTo) else if(0 != (AVS_OFFICESTUDIO_FILE_IMAGE & nFormatTo))
{ {
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::XLST; NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::XLST;
nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params); nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
...@@ -2204,7 +2220,7 @@ namespace NExtractTools ...@@ -2204,7 +2220,7 @@ namespace NExtractTools
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::PPTT; NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::PPTT;
nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params); nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
} }
else if(AVS_OFFICESTUDIO_FILE_IMAGE == nFormatTo) else if(0 != (AVS_OFFICESTUDIO_FILE_IMAGE & nFormatTo))
{ {
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::PPTT; NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::PPTT;
nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params); nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
...@@ -2334,7 +2350,7 @@ namespace NExtractTools ...@@ -2334,7 +2350,7 @@ namespace NExtractTools
oHtmlRenderer.CloseFile(); oHtmlRenderer.CloseFile();
RELEASEOBJECT(pReader); RELEASEOBJECT(pReader);
} }
else if(AVS_OFFICESTUDIO_FILE_IMAGE == nFormatTo) else if(0 != (AVS_OFFICESTUDIO_FILE_IMAGE & nFormatTo))
{ {
IOfficeDrawingFile* pReader = NULL; IOfficeDrawingFile* pReader = NULL;
nRes = PdfDjvuXpsToImage(&pReader, sFrom, nFormatFrom, sTo, sTemp, params, &oApplicationFonts); nRes = PdfDjvuXpsToImage(&pReader, sFrom, nFormatFrom, sTo, sTemp, params, &oApplicationFonts);
......
...@@ -293,6 +293,10 @@ namespace NExtractTools ...@@ -293,6 +293,10 @@ namespace NExtractTools
} }
oBuilder.WriteString(_T("</Changes>")); oBuilder.WriteString(_T("</Changes>"));
oBuilder.WriteString(sMailMerge); oBuilder.WriteString(sMailMerge);
if (NULL != params.m_oThumbnail && (NULL == params.m_oThumbnail->first || true == *params.m_oThumbnail->first))
{
oBuilder.WriteString(_T("<OnlyOnePage>1</OnlyOnePage>"));
}
oBuilder.WriteString(_T("</Settings>")); oBuilder.WriteString(_T("</Settings>"));
return oBuilder.GetData(); return oBuilder.GetData();
} }
......
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