Commit c373b560 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

add print to pdf (source code only)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@61251 954022d7-b5bf-4e40-9824-e11837661b57
parent 0aab84ea
......@@ -643,6 +643,8 @@
#define ASC_MENU_EVENT_TYPE_DOCUMENT_CHARTSTYLES 201
#define ASC_MENU_EVENT_TYPE_DOCUMENT_PDFBASE64 202
#define ASC_MENU_EVENT_TYPE_USER_SCROLL_PAGE 300
#define ASC_MENU_EVENT_TYPE_USER_ZOOM 301
......
......@@ -530,7 +530,7 @@ namespace NSStructures
{
public:
BOOL Visible;
INT Visible;
double DistanceX;
double DistanceY;
double BlurSize;
......
......@@ -24,7 +24,7 @@ public:
}
public:
bool Print(unsigned char* pSrcData, unsigned int nSrcLen, std::wstring strDstFile);
bool Print(const std::string base64Data, std::wstring strDstFile);
};
#endif
......@@ -10,10 +10,45 @@
#include "./AscEditorPDFPrinter.h"
#include "../../../ASCOfficePDFWriter/PdfWriterLib/PdfWriterLib.h"
#include "../../common/File.h"
bool CAscEditorPDFPrinter::Print(unsigned char *pSrcData, unsigned int nSrcLen, std::wstring strDstFile)
bool CAscEditorPDFPrinter::Print(std::string strBase64, std::wstring strDstFile)
{
return false;
CPdfWriterLib oWriter;
// TODO: fonts initialize
HRESULT hRes = S_OK;
try
{
hRes = oWriter.CreatePDF();
if (S_OK != (hRes))
throw "CreatePDF failed!";
hRes = oWriter.SetPDFCompressionMode(15);
if (S_OK != (hRes))
throw "SetPDFCompressionMode(15) failed!";
int nCountPages = 0;
std::wstring sHypers = L"";
int len = NSBase64::Base64DecodeGetRequiredLength(strBase64.length());
BYTE* dstArray = new BYTE[len];
if (NSBase64::Base64Decode(strBase64.c_str(), strBase64.length(), dstArray, &len))
{
oWriter.OnlineWordToPdfInternal(dstArray, len, m_strImagesPath, sHypers, nCountPages, L"", 1);
oWriter.SaveToFile(strDstFile);
}
RELEASEARRAYOBJECTS(dstArray);
}
catch (char *pcError)
{
//ATLTRACE2 (pcError);
}
return (hRes == S_OK) ? true : false;
}
// file downloader realize
......
......@@ -406,8 +406,9 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = iphoneos;
VALID_ARCHS = "arm64 armv7 armv7s i386";
};
name = Debug;
};
......@@ -440,8 +441,10 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = NO;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
VALID_ARCHS = "arm64 armv7 armv7s i386";
};
name = Release;
};
......@@ -470,9 +473,11 @@
../../../Common/DocxFormat/Source/XML/libxml2/XML/include/libxml,
../../../Common/DocxFormat/Source/XML/libxml2/XML/include,
);
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VALID_ARCHS = "arm64 armv7 armv7s i386";
};
name = Debug;
};
......@@ -501,15 +506,18 @@
../../../Common/DocxFormat/Source/XML/libxml2/XML/include/libxml,
../../../Common/DocxFormat/Source/XML/libxml2/XML/include,
);
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VALID_ARCHS = "arm64 armv7 armv7s i386";
};
name = Release;
};
7C560F8B1AA71AEA000E5860 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
......@@ -517,6 +525,7 @@
7C560F8C1AA71AEA000E5860 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
......
......@@ -373,8 +373,9 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = iphoneos;
VALID_ARCHS = "arm64 armv7 armv7s i386";
};
name = Debug;
};
......@@ -408,8 +409,10 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = NO;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
VALID_ARCHS = "arm64 armv7 armv7s i386";
};
name = Release;
};
......@@ -501,6 +504,7 @@
7C560F631AA71312000E5860 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7C8C2B3B1AA6FEB800A6495B /* Build configuration list for PBXProject "libxml2" */ = {
isa = XCConfigurationList;
......
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