mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 03:42:47 +08:00
Открытие всех Xml переделано на XmlLiteReader. Класс Folder переименован в CDocument. Сделано, чтобы темповая папка создавалась новая, если с таким именем уже есть.
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63359 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
3959b21683
commit
f7eb124e32
@ -12,6 +12,8 @@
|
||||
#include "../../DesktopEditor/common/String.h"
|
||||
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
std::vector<std::wstring> GetAllFilesInFolder(std::wstring wsFolder, std::wstring wsExt)
|
||||
{
|
||||
std::vector<std::wstring> vwsNames;
|
||||
@ -35,9 +37,13 @@ std::vector<std::wstring> GetAllFilesInFolder(std::wstring wsFolder, std::wstrin
|
||||
}
|
||||
return vwsNames;
|
||||
}
|
||||
void ConvertFolder(CXpsFile& oReader, std::wstring wsFolderPath)
|
||||
void ConvertFolderToRaster(const std::wstring& wsFolderPath)
|
||||
{
|
||||
oReader.Close();
|
||||
CApplicationFonts oFonts;
|
||||
oFonts.Initialize();
|
||||
|
||||
CXpsFile oReader(&oFonts);
|
||||
oReader.SetTempFolder(L"D:/Test Files/Temp/");
|
||||
|
||||
std::vector<std::wstring> vFiles = GetAllFilesInFolder(wsFolderPath, L"xps");
|
||||
for (int nIndex = 0; nIndex < vFiles.size(); nIndex++)
|
||||
@ -63,14 +69,39 @@ void ConvertFolder(CXpsFile& oReader, std::wstring wsFolderPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
void ConvertFolderToPdf(const std::wstring& wsFolderPath)
|
||||
{
|
||||
CApplicationFonts oFonts;
|
||||
oFonts.Initialize();
|
||||
|
||||
CXpsFile oFile(&oFonts);
|
||||
oFile.SetTempDirectory(L"D:/Test Files/Temp/");
|
||||
ConvertFolder(oFile, L"D:/Test Files//");
|
||||
CXpsFile oReader(&oFonts);
|
||||
oReader.SetTempFolder(L"D:/Test Files/Temp/");
|
||||
|
||||
std::vector<std::wstring> vFiles = GetAllFilesInFolder(wsFolderPath, L"xps");
|
||||
for (int nIndex = 0; nIndex < vFiles.size(); nIndex++)
|
||||
{
|
||||
std::wstring wsFilePath = wsFolderPath;
|
||||
wsFilePath.append(vFiles.at(nIndex));
|
||||
std::wstring wsFilePathName = (wsFilePath.substr(0, wsFilePath.size() - 4));
|
||||
if (oReader.LoadFromFile(wsFilePath.c_str()))
|
||||
{
|
||||
printf("%d of %d %S\n", nIndex + 1, vFiles.size(), vFiles.at(nIndex).c_str());
|
||||
std::wstring wsDstFilePath = wsFilePathName + L".pdf";
|
||||
oReader.ConvertToPdf(wsDstFilePath);
|
||||
oReader.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%d of %d %S error\n", nIndex, vFiles.size(), vFiles.at(nIndex).c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
//ConvertFolderToRaster(L"D:/Test Files//Xps//");
|
||||
ConvertFolderToPdf(L"D:/Test Files//Xps//");
|
||||
|
||||
char q;
|
||||
std::cin >> q;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user