Commit 8a7c8660 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Добавлена новая кроссплатформенная библиотека для записи Pdf файлов.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63069 954022d7-b5bf-4e40-9824-e11837661b57
parent 03bcfc8e
......@@ -7338,6 +7338,9 @@ PdfReader/Resources/Fonts/n022024l.pfm svn_mime_002dtype=application%2Foctet-str
PdfReader/Resources/Fonts/s050000l.pfb svn_mime_002dtype=application%2Foctet-stream
PdfReader/Resources/Fonts/s050000l.pfm svn_mime_002dtype=application%2Foctet-stream
PdfReader/Src svnc_tsvn_003alogminsize=5
/PdfWriter svnc_tsvn_003alogminsize=5
PdfWriter/PdfWriterTest svnc_tsvn_003alogminsize=5
PdfWriter/Src svnc_tsvn_003alogminsize=5
Redist/ASCEBOOKWriter.dll svn_mime_002dtype=application%2Foctet-stream
Redist/ASCFontConverter.dll svn_mime_002dtype=application%2Foctet-stream
Redist/ASCGraphics.dll svn_mime_002dtype=application%2Foctet-stream

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PdfWriter", "PdfWriter.vcxproj", "{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PdfWriterTest", "PdfWriterTest\PdfWriterTest.vcxproj", "{B819B482-8822-4809-B633-09F8946D761E}"
ProjectSection(ProjectDependencies) = postProject
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5} = {D4A77282-62EC-465D-ACB4-9CEE6BC704E5}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Debug|Win32.ActiveCfg = Debug|x64
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Debug|Win32.Build.0 = Debug|x64
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Debug|x64.ActiveCfg = Debug|x64
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Debug|x64.Build.0 = Debug|x64
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Release|Mixed Platforms.Build.0 = Release|Win32
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Release|Win32.ActiveCfg = Release|Win32
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Release|Win32.Build.0 = Release|Win32
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Release|x64.ActiveCfg = Release|x64
{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}.Release|x64.Build.0 = Release|x64
{B819B482-8822-4809-B633-09F8946D761E}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{B819B482-8822-4809-B633-09F8946D761E}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{B819B482-8822-4809-B633-09F8946D761E}.Debug|Win32.ActiveCfg = Debug|Win32
{B819B482-8822-4809-B633-09F8946D761E}.Debug|Win32.Build.0 = Debug|Win32
{B819B482-8822-4809-B633-09F8946D761E}.Debug|x64.ActiveCfg = Debug|x64
{B819B482-8822-4809-B633-09F8946D761E}.Debug|x64.Build.0 = Debug|x64
{B819B482-8822-4809-B633-09F8946D761E}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{B819B482-8822-4809-B633-09F8946D761E}.Release|Mixed Platforms.Build.0 = Release|Win32
{B819B482-8822-4809-B633-09F8946D761E}.Release|Win32.ActiveCfg = Release|Win32
{B819B482-8822-4809-B633-09F8946D761E}.Release|Win32.Build.0 = Release|Win32
{B819B482-8822-4809-B633-09F8946D761E}.Release|x64.ActiveCfg = Release|x64
{B819B482-8822-4809-B633-09F8946D761E}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D4A77282-62EC-465D-ACB4-9CEE6BC704E5}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>PdfWriter</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<DisableSpecificWarnings>4018;4005;4267</DisableSpecificWarnings>
<AdditionalIncludeDirectories>..\DesktopEditor\freetype-2.5.2\include;..\DesktopEditor\agg-2.4\include;..\DesktopEditor\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Src\Annotation.cpp" />
<ClCompile Include="Src\Catalog.cpp" />
<ClCompile Include="Src\Destination.cpp" />
<ClCompile Include="Src\Document.cpp" />
<ClCompile Include="Src\Encrypt.cpp" />
<ClCompile Include="Src\EncryptDictionary.cpp" />
<ClCompile Include="Src\Font.cpp" />
<ClCompile Include="Src\Font14.cpp" />
<ClCompile Include="Src\FontCidTT.cpp" />
<ClCompile Include="Src\FontTTWriter.cpp" />
<ClCompile Include="Src\GState.cpp" />
<ClCompile Include="Src\Image.cpp" />
<ClCompile Include="Src\Info.cpp" />
<ClCompile Include="Src\Objects.cpp" />
<ClCompile Include="Src\Outline.cpp" />
<ClCompile Include="Src\Pages.cpp" />
<ClCompile Include="Src\Pattern.cpp" />
<ClCompile Include="Src\Shading.cpp" />
<ClCompile Include="Src\Streams.cpp" />
<ClCompile Include="Src\Utils.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Src\Annotation.h" />
<ClInclude Include="Src\Catalog.h" />
<ClInclude Include="Src\Consts.h" />
<ClInclude Include="Src\Destination.h" />
<ClInclude Include="Src\Document.h" />
<ClInclude Include="Src\Encrypt.h" />
<ClInclude Include="Src\EncryptDictionary.h" />
<ClInclude Include="Src\Font.h" />
<ClInclude Include="Src\Font14.h" />
<ClInclude Include="Src\FontCidTT.h" />
<ClInclude Include="Src\FontTTWriter.h" />
<ClInclude Include="Src\GState.h" />
<ClInclude Include="Src\Image.h" />
<ClInclude Include="Src\Info.h" />
<ClInclude Include="Src\Objects.h" />
<ClInclude Include="Src\Outline.h" />
<ClInclude Include="Src\Pages.h" />
<ClInclude Include="Src\Pattern.h" />
<ClInclude Include="Src\Shading.h" />
<ClInclude Include="Src\Streams.h" />
<ClInclude Include="Src\Types.h" />
<ClInclude Include="Src\Utils.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Src">
<UniqueIdentifier>{1fccc0b6-4331-4120-a261-6d13ed199aab}</UniqueIdentifier>
</Filter>
<Filter Include="Src\Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Src\Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Src\Font">
<UniqueIdentifier>{207e9ca3-771d-48cd-b185-e8557f5a59c9}</UniqueIdentifier>
</Filter>
<Filter Include="Src\Encrypt">
<UniqueIdentifier>{e955fc8f-90e5-44a8-89b6-4f281e87c89a}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Src\Annotation.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Catalog.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Destination.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Document.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\GState.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Image.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Info.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Objects.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Outline.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Pages.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Streams.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Utils.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Font.cpp">
<Filter>Src\Font</Filter>
</ClCompile>
<ClCompile Include="Src\Encrypt.cpp">
<Filter>Src\Encrypt</Filter>
</ClCompile>
<ClCompile Include="Src\EncryptDictionary.cpp">
<Filter>Src\Encrypt</Filter>
</ClCompile>
<ClCompile Include="Src\Font14.cpp">
<Filter>Src\Font</Filter>
</ClCompile>
<ClCompile Include="Src\FontCidTT.cpp">
<Filter>Src\Font</Filter>
</ClCompile>
<ClCompile Include="Src\FontTTWriter.cpp">
<Filter>Src\Font</Filter>
</ClCompile>
<ClCompile Include="Src\Shading.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
<ClCompile Include="Src\Pattern.cpp">
<Filter>Src\Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Src\Annotation.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Catalog.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Consts.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Destination.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Document.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\GState.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Image.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Info.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Objects.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Outline.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Pages.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Streams.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Types.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Utils.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Font.h">
<Filter>Src\Font</Filter>
</ClInclude>
<ClInclude Include="Src\Encrypt.h">
<Filter>Src\Encrypt</Filter>
</ClInclude>
<ClInclude Include="Src\EncryptDictionary.h">
<Filter>Src\Encrypt</Filter>
</ClInclude>
<ClInclude Include="Src\Font14.h">
<Filter>Src\Font</Filter>
</ClInclude>
<ClInclude Include="Src\FontCidTT.h">
<Filter>Src\Font</Filter>
</ClInclude>
<ClInclude Include="Src\FontTTWriter.h">
<Filter>Src\Font</Filter>
</ClInclude>
<ClInclude Include="Src\Shading.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\Pattern.h">
<Filter>Src\Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B819B482-8822-4809-B633-09F8946D761E}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>PdfWriterTest</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\..\DesktopEditor\freetype-2.5.2\include;..\..\..\DesktopEditor\agg-2.4\include;..\..\..\DesktopEditor\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\..\DesktopEditor\freetype-2.5.2\include;..\..\..\DesktopEditor\agg-2.4\include;..\..\..\DesktopEditor\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4018;4005;4267</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="PdfWriterTest.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PdfWriterTest.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
========================================================================
CONSOLE APPLICATION : PdfWriterTest Project Overview
========================================================================
AppWizard has created this PdfWriterTest application for you.
This file contains a summary of what you will find in each of the files that
make up your PdfWriterTest application.
PdfWriterTest.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
PdfWriterTest.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).
PdfWriterTest.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named PdfWriterTest.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
// stdafx.cpp : source file that includes just the standard includes
// PdfWriterTest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#ifdef _DEBUG
#pragma comment(lib, "../x64/Debug/PdfWriter.lib")
#pragma comment(lib, "../../DesktopEditor/Qt_build/graphics/project/debug/graphics.lib")
#pragma comment(lib, "../../ASCOfficeUtils/ASCOfficeUtilsLib/Win/x64/Debug/ASCOfficeUtilsLib.lib")
#pragma comment(lib, "Ws2_32.lib")
#else
#pragma comment(lib, "../x64/Release/PdfWriter.lib")
#pragma comment(lib, "../../../DesktopEditor/Qt_build/graphics/project/release/graphics.lib")
#endif
// TODO: reference additional headers your program requires here
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>
========================================================================
STATIC LIBRARY : PdfWriter Project Overview
========================================================================
AppWizard has created this PdfWriter library project for you.
No source files were created as part of your project.
PdfWriter.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
PdfWriter.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
#include "Annotation.h"
#include "Pages.h"
#define BS_DEF_WIDTH 1
namespace PdfWriter
{
const static char* c_sAnnotTypeNames[] =
{
"Text",
"Link",
"Sound",
"FreeText",
"Stamp",
"Square",
"Circle",
"StrikeOut",
"Highlight",
"Underline",
"Ink",
"FileAttachment",
"Popup"
};
const static char* c_sAnnotIconNames[] =
{
"Comment",
"Key",
"Note",
"Help",
"NewParagraph",
"Paragraph",
"Insert"
};
//----------------------------------------------------------------------------------------
// CAnnotation
//----------------------------------------------------------------------------------------
CAnnotation::CAnnotation(CXref* pXref, EAnnotType eType, const TRect& oRect)
{
pXref->Add(this);
CArrayObject* pArray = new CArrayObject();
if (!pArray)
return;
Add("Rect", pArray);
if (oRect.fTop < oRect.fBottom)
{
pArray->Add(oRect.fLeft);
pArray->Add(oRect.fTop);
pArray->Add(oRect.fRight);
pArray->Add(oRect.fBottom);
}
else
{
pArray->Add(oRect.fLeft);
pArray->Add(oRect.fBottom);
pArray->Add(oRect.fRight);
pArray->Add(oRect.fTop);
}
Add("Type", "Annot");
Add("Subtype", c_sAnnotTypeNames[(int)eType]);
}
void CAnnotation::SetBorderStyle(EBorderSubtype eSubtype, float fWidth, unsigned short nDashOn, unsigned short nDashOff, unsigned short nDashPhase)
{
CDictObject* pBorderStyleDict = new CDictObject();
if (!pBorderStyleDict)
return;
Add("BS", pBorderStyleDict);
if (border_subtype_Dashed == eSubtype)
{
CArrayObject* pDash = new CArrayObject();
if (!pDash)
return;
pBorderStyleDict->Add("D", pDash);
pBorderStyleDict->Add("Type", "Border");
pDash->Add(nDashOn);
pDash->Add(nDashOff);
if (0 != nDashPhase)
pDash->Add(nDashOff);
}
switch (eSubtype)
{
case border_subtype_Solid: pBorderStyleDict->Add("S", "S"); break;
case border_subtype_Dashed: pBorderStyleDict->Add("S", "D"); break;
case border_subtype_Beveled: pBorderStyleDict->Add("S", "B"); break;
case border_subtype_Inset: pBorderStyleDict->Add("S", "I"); break;
case border_subtype_Underlined: pBorderStyleDict->Add("S", "U"); break;
}
if (BS_DEF_WIDTH != fWidth)
pBorderStyleDict->Add("W", fWidth);
}
//----------------------------------------------------------------------------------------
// CLinkAnnotation
//----------------------------------------------------------------------------------------
CLinkAnnotation::CLinkAnnotation(CXref* pXref, const TRect& oRect, CDestination* pDestination) : CAnnotation(pXref, AnnotLink, oRect)
{
Add("Dest", (CObjectBase*)pDestination);
}
void CLinkAnnotation::SetBorderStyle(float fWidth, unsigned short nDashOn, unsigned short nDashOff)
{
fWidth = max(fWidth, 0);
CArrayObject* pArray = new CArrayObject();
if (!pArray)
return;
Add("Border", pArray);
pArray->Add(0);
pArray->Add(0);
pArray->Add(fWidth);
if (nDashOn && nDashOff)
{
CArrayObject* pDash = new CArrayObject();
if (!pDash)
return;
pArray->Add(pDash);
pDash->Add(nDashOn);
pDash->Add(nDashOff);
}
}
void CLinkAnnotation::SetHighlightMode(EAnnotHighlightMode eMode)
{
switch (eMode)
{
case AnnotNoHighlight: Add("H", "N"); break;
case AnnotInvertBorder: Add("H", "O"); break;
case AnnotDownAppearance: Add("H", "P"); break;
default: Remove("H"); break;
}
}
//----------------------------------------------------------------------------------------
// CTextAnnotation
//----------------------------------------------------------------------------------------
CTextAnnotation::CTextAnnotation(CXref* pXref, const TRect& oRect, const char* sText) : CAnnotation(pXref, AnnotTextNotes, oRect)
{
Add("Contents", new CStringObject(sText));
}
void SetIcon(EAnnotIcon eIcon);
void SetOpened(bool bOpened);
void CTextAnnotation::SetIcon(EAnnotIcon eIcon)
{
eIcon = (EAnnotIcon)min(max(AnnotIconMin, eIcon), AnnotIconMax);
Add("Name", c_sAnnotIconNames[(int)eIcon]);
}
void CTextAnnotation::SetOpened(bool bOpened)
{
Add("Open", new CBoolObject(bOpened));
}
//----------------------------------------------------------------------------------------
// CUriLinkAnnotation
//----------------------------------------------------------------------------------------
CUriLinkAnnotation::CUriLinkAnnotation(CXref* pXref, const TRect& oRect, const char* sUri) : CAnnotation(pXref, AnnotLink, oRect)
{
CDictObject* pAction = new CDictObject();
if (!pAction)
return;
Add("A", pAction);
pAction->Add("Type", "Action");
pAction->Add("S", "URI");
pAction->Add("URI", new CStringObject(sUri));
}
}
\ No newline at end of file
#ifndef _PDF_WRITER_SRC_ANNOTATION_H
#define _PDF_WRITER_SRC_ANNOTATION_H
#include "Objects.h"
#include "Types.h"
namespace PdfWriter
{
class CDestination;
enum EBorderSubtype
{
border_subtype_Solid,
border_subtype_Dashed,
border_subtype_Beveled,
border_subtype_Inset,
border_subtype_Underlined
};
enum EAnnotType
{
AnnotUnknown = -1,
AnnotTextNotes = 0,
AnnotLink = 1,
AnnotSound = 2,
AnnotFreeText = 3,
AnnotStamp = 4,
AnnotSquare = 5,
AnnotCircle = 6,
AnnotStrikeOut = 7,
AnnotHighLight = 8,
AnnotUnderline = 9,
AnnotInk = 10,
AnnotFileAttachment = 11,
AnnotPopup = 12
};
enum EAnnotHighlightMode
{
AnnotNoHighlight = 0,
AnnotInvertBox,
AnnotInvertBorder,
AnnotDownAppearance,
AnnotHighlightModeEOF
};
enum EAnnotIcon
{
AnnotIconComment = 0,
AnnotIconKey = 1,
AnnotIconNote = 2,
AnnotIconHelp = 3,
AnnotIconNewParagraph = 4,
AnnotIconParagraph = 5,
AnnotIconInsert = 6,
AnnotIconMin = 0,
AnnotIconMax = 6
};
class CAnnotation : public CDictObject
{
public:
CAnnotation(CXref* pXref, EAnnotType eType, const TRect& oRect);
void SetBorderStyle(EBorderSubtype eSubtype, float fWidth, unsigned short nDashOn, unsigned short nDashOff, unsigned short nDashPhase);
EDictType GetDictType() const
{
return dict_type_ANNOTATION;
}
virtual EAnnotType GetAnnotationType() const
{
return AnnotUnknown;
}
};
class CLinkAnnotation : public CAnnotation
{
public:
CLinkAnnotation(CXref* pXref, const TRect& oRect, CDestination* pDestination);
EAnnotType GetAnnotationType() const
{
return AnnotLink;
}
void SetBorderStyle (float fWidth, unsigned short nDashOn, unsigned short nDashOff);
void SetHighlightMode(EAnnotHighlightMode eMode);
};
class CTextAnnotation : public CAnnotation
{
public:
CTextAnnotation(CXref* pXref, const TRect& oRect, const char* sText);
EAnnotType GetAnnotationType() const
{
return AnnotTextNotes;
}
void SetIcon(EAnnotIcon eIcon);
void SetOpened(bool bOpened);
};
class CUriLinkAnnotation : public CAnnotation
{
public:
CUriLinkAnnotation(CXref* pXref, const TRect& oRect, const char* sUri);
EAnnotType GetAnnotationType() const
{
return AnnotLink;
}
};
}
#endif // _PDF_WRITER_SRC_ANNOTATION_H
#include "Catalog.h"
#include "Destination.h"
#include "Pages.h"
#include "Utils.h"
namespace PdfWriter
{
static const char* c_sPageLayoutNames[] =
{
"SinglePage",
"OneColumn",
"TwoColumnLeft",
"TwoColumnRight",
NULL
};
static const char* c_sPageModeNames[] =
{
"UseNone",
"UseOutlines",
"UseThumbs",
"FullScreen",
"UseOC",
"UseAttachments",
NULL
};
//----------------------------------------------------------------------------------------
// CCatalog
//----------------------------------------------------------------------------------------
CCatalog::CCatalog(CXref* pXref)
{
pXref->Add(this);
Add("Type", "Catalog");
Add("Pages", new CPageTree(pXref));
}
CPageTree* CCatalog::GetRoot() const
{
return (CPageTree*)Get("Pages");
}
EPageLayout CCatalog::GetPageLayout() const
{
CNameObject* pLayout = (CNameObject*)Get("PageLayout");
if (!pLayout)
return pagelayout_Single;
unsigned int unIndex = 0;
while (c_sPageLayoutNames[unIndex])
{
if (0 == StrCmp(pLayout->Get(), c_sPageLayoutNames[unIndex]))
return (EPageLayout)unIndex;
unIndex++;
}
return pagelayout_Single;
}
void CCatalog::SetPageLayout(EPageLayout eLayout)
{
return Add("PageLayout", c_sPageLayoutNames[(int)eLayout]);
}
EPageMode CCatalog::GetPageMode() const
{
CNameObject* pMode = (CNameObject*)Get("PageMode");
if (!pMode)
return pagemode_UseNone;
unsigned int unIndex = 0;
while (c_sPageModeNames[unIndex])
{
if (0 == StrCmp(pMode->Get(), c_sPageModeNames[unIndex]))
return (EPageMode)unIndex;
unIndex++;
}
return pagemode_UseNone;
}
void CCatalog::SetPageMode(EPageMode eMode)
{
Add("PageMode", c_sPageModeNames[(int)eMode]);
}
void CCatalog::SetOpenAction(CDestination* pOpenAction)
{
if (!pOpenAction)
Remove("OpenAction");
else
Add("OpenAction", pOpenAction);
}
void CCatalog::AddPageLabel(unsigned int unPageNum, CDictObject* pPageLabel)
{
CDictObject* pLabels = (CDictObject*)Get("PageLabels");
if (!pLabels)
{
pLabels = new CDictObject();
if (!pLabels)
return;
Add("PageLabels", pLabels);
}
CArrayObject* pNums = (CArrayObject*)pLabels->Get("Nums");
if (!pNums)
{
pNums = new CArrayObject();
if (!pNums)
return;
pLabels->Add("Nums", pNums);
}
pNums->Add(unPageNum);
pNums->Add(pPageLabel);
}
}
\ No newline at end of file
#ifndef _PDF_WRITER_SRC_CATALOG_H
#define _PDF_WRITER_SRC_CATALOG_H
#include "Objects.h"
namespace PdfWriter
{
class CPageTree;
class CDestination;
class CCatalog : public CDictObject
{
public:
CCatalog(CXref* pXref);
CPageTree* GetRoot() const;
EPageLayout GetPageLayout() const;
void SetPageLayout(EPageLayout eLayout);
EPageMode GetPageMode() const;
void SetPageMode(EPageMode eMode);
void SetOpenAction(CDestination* pOpenAction);
void AddPageLabel(unsigned int unIndex, CDictObject* pPageLabel);
EDictType GetDictType() const
{
return dict_type_CATALOG;
}
};
}
#endif // _PDF_WRITER_SRC_CATALOG_H
This diff is collapsed.
#include "Destination.h"
#include "Pages.h"
namespace PdfWriter
{
//----------------------------------------------------------------------------------------
// CDestination
//----------------------------------------------------------------------------------------
CDestination::CDestination(CPage* pPage, CXref* pXref)
{
pXref->Add(this);
// Первый элемент массива должен быть страницей, которой принадлежит объект
Add((CObjectBase*)pPage);
Add("Fit"); // Значение по умолчанию Fit
}
bool CDestination::IsValid() const
{
if (m_arrList.size() < 2)
return false;
CObjectBase* pObject = Get(0, false);
if (object_type_DICT != pObject->GetType() || dict_type_PAGE != ((CDictObject*)pObject)->GetDictType())
return false;
return true;
}
void CDestination::PrepareArray()
{
CPage* pPage = (CPage*)Get(0);
if (m_arrList.size() > 1)
{
Clear();
Add((CObjectBase*)pPage);
}
}
void CDestination::SetXYZ(float fLeft, float fTop, float fZoom)
{
if (!IsValid())
return;
// Если параметр приближения задан некорректно, тогда оставляем его нетронутым(что соответствует значению 0)
if (fZoom < 0.08 || fZoom > 32)
fZoom = 0;
fLeft = max(fLeft, 0);
fTop = max(fTop, 0);
PrepareArray();
Add("XYZ");
Add(fLeft);
Add(fTop);
Add(fZoom);
}
void CDestination::SetFit()
{
if (!IsValid())
return;
PrepareArray();
Add("Fit");
}
void CDestination::SetFitH(float fTop)
{
if (!IsValid())
return;
PrepareArray();
Add("FitH");
Add(fTop);
}
void CDestination::SetFitV(float fLeft)
{
if (!IsValid())
return;
PrepareArray();
Add("FitV");
Add(fLeft);
}
void CDestination::SetFitR(float fLeft, float fBottom, float fRight, float fTop)
{
if (!IsValid())
return;
PrepareArray();
Add("FitR");
Add(fLeft);
Add(fBottom);
Add(fRight);
Add(fTop);
}
void CDestination::SetFitB()
{
if (!IsValid())
return;
PrepareArray();
Add("FitB");
}
void CDestination::SetFitBH(float fTop)
{
if (!IsValid())
return;
PrepareArray();
Add("FitBH");
Add(fTop);
}
void CDestination::SetFitBV(float fLeft)
{
if (!IsValid())
return;
PrepareArray();
Add("FitBV");
Add(fLeft);
}
}
#ifndef _PDF_WRITER_SRC_ANNOTATION_DESTINATION_H
#define _PDF_WRITER_SRC_ANNOTATION_DESTINATION_H
#include "Objects.h"
namespace PdfWriter
{
class CPage;
class CDestination : public CArrayObject
{
public:
CDestination(CPage* pPage, CXref* pXref);
bool IsValid() const;
void SetXYZ (float fLeft, float fTop, float fZoom);
void SetFit ();
void SetFitH (float fTop);
void SetFitV (float fLeft);
void SetFitR (float fLeft, float fBottom, float fRight, float fTop);
void SetFitB ();
void SetFitBH(float fTop);
void SetFitBV(float fLeft);
private:
void PrepareArray();
};
}
#endif // _PDF_WRITER_SRC_ANNOTATION_DESTINATION_H
This diff is collapsed.
#ifndef _PDF_WRITER_SRC_DOCUMENT_H
#define _PDF_WRITER_SRC_DOCUMENT_H
#include <vector>
#include <string>
#include "Types.h"
#ifdef CreateFont
#undef CreateFont
#endif
class CFontManager;
namespace PdfWriter
{
class CCatalog;
class COutline;
class CXref;
class CPageTree;
class CPage;
class CInfoDict;
class CDictObject;
class CEncryptDict;
class CStream;
class CDestination;
class CExtGrState;
class CAnnotation;
class CImageDict;
class CFontDict;
class CFont14;
class CFontCidTrueType;
class CJbig2Global;
class CShading;
class CImageTilePattern;
//----------------------------------------------------------------------------------------
// CDocument
//----------------------------------------------------------------------------------------
class CDocument
{
public:
CDocument();
~CDocument();
bool CreateNew();
void Close();
bool SaveToFile(const std::wstring& wsPath);
void SetEncryptionMode(EEncryptMode eMode, unsigned int unKeyLen = 0);
void SetPassword(const char* sOwnerPassword, const char* sUserPassword);
void SetPermission(unsigned int unPermission);
void SetCompressionMode(unsigned int unMode);
CPage* AddPage();
void AddPageLabel(EPageNumStyle eStyle, unsigned int unFirstPage, const char* sPrefix);
void AddPageLabel(unsigned int unPageIndex, EPageNumStyle eStyle, unsigned int unFirstPage, const char* sPrefix);
COutline* CreateOutline(COutline* pParent, const char* sTitle);
CDestination* CreateDestination(unsigned int unPageIndex);
CExtGrState* GetExtGState(double dAlphaStroke = -1, double dAlphaFill = -1, EBlendMode eMode = blendmode_Unknown, int nStrokeAdjustment = -1);
CJbig2Global* GetJbig2Global();
CAnnotation* CreateTextAnnot(unsigned int unPageNum, TRect oRect, const char* sText);
CAnnotation* CreateLinkAnnot(unsigned int unPageNum, TRect oRect, CDestination* pDest);
CAnnotation* CreateUriLinkAnnot(unsigned int unPageNum, TRect oRect, const char* sUri);
CImageDict* CreateImage();
CFont14* CreateFont14(EStandard14Fonts eType);
CFontCidTrueType* CreateTrueTypeFont(const std::wstring& wsFontPath, unsigned int unIndex);
CShading* CreateAxialShading(double dX0, double dY0, double dX1, double dY1, unsigned char* pColors, double* pPoints, int nCount);
CShading* CreateRaidalShading(double dX0, double dY0, double dR0, double dX1, double dY1, double dR1, unsigned char* pColors, double* pPoints, int nCount);
CImageTilePattern*CreateImageTilePattern(double dW, double dH, CImageDict* pImageDict, EImageTilePatternType eType = imagetilepatterntype_Default);
private:
char* GetTTFontTag();
CExtGrState* FindExtGrState(double dAlphaStroke = -1, double dAlphaFill = -1, EBlendMode eMode = blendmode_Unknown, int nStrokeAdjustment = -1);
void SaveToStream(CStream* pStream);
void PrepareEncryption();
CDictObject* CreatePageLabel(EPageNumStyle eStyle, unsigned int unFirstPage, const char* sPrefix);
private:
CCatalog* m_pCatalog;
COutline* m_pOutlines;
CXref* m_pXref;
CPageTree* m_pPageTree;
CPage* m_pCurPage;
int m_nCurPageNum;
CInfoDict* m_pInfo;
CDictObject* m_pTrailer;
CDictObject* m_pResources;
bool m_bEncrypt;
CEncryptDict* m_pEncryptDict;
unsigned int m_unCompressMode;
std::vector<CPage*> m_vPages;
std::vector<CExtGrState*> m_vExtGrStates;
char m_sTTFontTag[8]; // 6 символов + '+' + 0x00 ("BAAAAA+/0")
CJbig2Global* m_pJbig2;
std::vector<CShading*> m_vShadings;
friend class CFontCidTrueType;
};
}
#endif // _PDF_WRITER_SRC_DOCUMENT_H
This diff is collapsed.
#ifndef _PDF_WRITER_SRC_ENCRYPT_H
#define _PDF_WRITER_SRC_ENCRYPT_H
#include "Utils.h"
#define ID_LEN 16
#define PASSWD_LEN 32
#define ENCRYPT_KEY_MAX 16
#define MD5_KEY_LEN 16
#define PERMISSION_PAD 0xFFFFFFC0
#define ARC4_BUF_SIZE 256
namespace PdfWriter
{
void PadOrTrancatePassword(const char *sPassword, BYTE *pNewPassword);
//----------------------------------------------------------------------------------------
//
// The code implements MD5 message-digest algorithm.
// To compute the message digest of a chunk of bytes, declare an
// MD5Context structure, pass it to MD5Init, call MD5Update as
// needed on buffers full of bytes, and then call MD5Final, which
// will fill a supplied 16-byte array with the digest.
//
//----------------------------------------------------------------------------------------
class CMd5
{
public:
CMd5();
void Init();
void Update(const BYTE* pBuffer, unsigned int unLen);
void Final(BYTE anDigest[16]);
private:
void Clear();
private:
unsigned int m_anBuf[4];
unsigned int m_anBits[2];
BYTE m_anIn[64];
};
class CArc4
{
public:
void Init(const BYTE* pKey, unsigned int unKeyLen);
void CryptBuf(const BYTE* pIn, BYTE* pOut, unsigned int unLen);
private:
BYTE m_nIndex1;
BYTE m_nIndex2;
BYTE m_anState[ARC4_BUF_SIZE];
};
class CEncrypt
{
public:
CEncrypt();
void Init();
void CreateUserKey();
void CreateOwnerKey();
void CreateEncryptionKey();
void InitKey(unsigned int unObjectId, unsigned short unGenNo);
void Reset();
void CryptBuf(const BYTE* pSrc, BYTE* pDst, unsigned int unLen);
void SetPermission(unsigned int unPermission);
void SetMode(EEncryptMode eMode, unsigned int unKeyLen);
private:
EEncryptMode m_eMode;
unsigned int m_unKeyLen; // unKeyLen должно быть кратно 8, и лежать в отрезке от 40 и до 128
BYTE m_anOwnerPassword[PASSWD_LEN]; // Owner-Password (не шифрованный)
BYTE m_anUserPassword[PASSWD_LEN]; // User-Password (не шифрованный)
BYTE m_anOwnerKey[PASSWD_LEN]; // Owner-Password (шифрованный)
BYTE m_anUserKey[PASSWD_LEN]; // User-Password (шифрованный)
unsigned int m_unPermission;
BYTE m_anEncryptID[ID_LEN];
BYTE m_anEncryptionKey[MD5_KEY_LEN + 5];
BYTE m_anMD5EncryptionKey[MD5_KEY_LEN];
CArc4 m_oArc4Context;
friend class CEncryptDict;
friend class CDocument;
};
}
#endif // _PDF_WRITER_SRC_ENCRYPT_H
#include "EncryptDictionary.h"
#include "Encrypt.h"
#include "Info.h"
#include <ctime>
namespace PdfWriter
{
//----------------------------------------------------------------------------------------
// CEncryptDict
//----------------------------------------------------------------------------------------
CEncryptDict::CEncryptDict(CXref* pXref)
{
m_pEncrypt = new CEncrypt();
if (m_pEncrypt)
m_pEncrypt->Init();
pXref->Add(this);
}
CEncryptDict::~CEncryptDict()
{
if (m_pEncrypt)
delete m_pEncrypt;
}
void CEncryptDict::CreateId(CInfoDict* pInfo, CXref* pXref)
{
CMd5 oMd5;
oMd5.Init();
std::time_t oTime = time(0);
oMd5.Update((BYTE*)&oTime, sizeof(oTime));
// Создаем идентификатор файла по элементам библиотеки Info.
if (pInfo)
{
const char *sTemp = NULL;
unsigned int nLen = 0;
// Author
sTemp = pInfo->GetInfo(InfoAuthor);
if ((nLen = StrLen(sTemp, -1)) > 0)
oMd5.Update((const BYTE *)sTemp, nLen);
// Creator
sTemp = pInfo->GetInfo(InfoCreator);
if ((nLen = StrLen(sTemp, -1)) > 0)
oMd5.Update((const BYTE *)sTemp, nLen);
// Producer
sTemp = pInfo->GetInfo(InfoProducer);
if ((nLen = StrLen(sTemp, -1)) > 0)
oMd5.Update((const BYTE *)sTemp, nLen);
// Title
sTemp = pInfo->GetInfo(InfoTitle);
if ((nLen = StrLen(sTemp, -1)) > 0)
oMd5.Update((const BYTE *)sTemp, nLen);
// Subject
sTemp = pInfo->GetInfo(InfoSubject);
if ((nLen = StrLen(sTemp, -1)) > 0)
oMd5.Update((const BYTE *)sTemp, nLen);
// Keywords
sTemp = pInfo->GetInfo(InfoKeyWords);
if ((nLen = StrLen(sTemp, -1)) > 0)
oMd5.Update((const BYTE *)sTemp, nLen);
int nXrefEntriesCount = pXref->GetCount();
oMd5.Update((const BYTE *)&nXrefEntriesCount, sizeof(unsigned int));
}
oMd5.Final(m_pEncrypt->m_anEncryptID);
}
void CEncryptDict::SetPassword(const char* sOwnerPassword, const char* sUserPassword)
{
if (0 == StrLen(sOwnerPassword, 2))
return;
if (sOwnerPassword && sUserPassword && 0 == StrCmp(sOwnerPassword, sUserPassword))
return;
PadOrTrancatePassword(sOwnerPassword, m_pEncrypt->m_anOwnerPassword);
PadOrTrancatePassword(sUserPassword, m_pEncrypt->m_anUserPassword);
}
void CEncryptDict::Prepare(CInfoDict* pInfo, CXref* pXref)
{
CreateId(pInfo, pXref);
m_pEncrypt->CreateOwnerKey();
m_pEncrypt->CreateEncryptionKey();
m_pEncrypt->CreateUserKey();
CBinaryObject* pOwnerKey = new CBinaryObject(m_pEncrypt->m_anOwnerKey, PASSWD_LEN);
if (!pOwnerKey)
return;
Add("O", pOwnerKey);
CBinaryObject* pUserKey = new CBinaryObject(m_pEncrypt->m_anUserKey, PASSWD_LEN);
if (!pUserKey)
return;
Add("U", pUserKey);
Add("Filter", "Standard");
if (encryptmode_R2 == m_pEncrypt->m_eMode)
{
Add("V", 1);
Add("R", 2);
}
else if (encryptmode_R3 == m_pEncrypt->m_eMode)
{
Add("V", 2);
Add("R", 3);
Add("Length", m_pEncrypt->m_unKeyLen * 8);
}
Add("P", m_pEncrypt->m_unPermission);
}
}
\ No newline at end of file
#ifndef _PDF_WRITER_SRC_ENCRYPT_DICTIONARY_H
#define _PDF_WRITER_SRC_ENCRYPT_DICTIONARY_H
#include "Objects.h"
namespace PdfWriter
{
class CEncrypt;
class CInfoDict;
class CEncryptDict : public CDictObject
{
public:
CEncryptDict(CXref* pXref);
~CEncryptDict();
EDictType GetDictType() const
{
return dict_type_ENCRYPT;
}
void CreateId(CInfoDict* pInfo, CXref* pXref);
void SetPassword(const char* sOwnerPassword, const char* sUserPassword);
void Prepare(CInfoDict* pInfo, CXref* pXref);
CEncrypt* GetEncrypt() const
{
return m_pEncrypt;
}
private:
CEncrypt* m_pEncrypt;
};
}
#endif // _PDF_WRITER_SRC_ENCRYPT_DICTIONARY_H
#include "Font.h"
namespace PdfWriter
{
CFontDict::CFontDict(CXref* pXref, CDocument* pDocument)
{
m_pXref = pXref;
pXref->Add(this);
m_pDocument = pDocument;
}
CFontDict::~CFontDict()
{
}
}
#ifndef _PDF_WRITER_SRC_FONT_H
#define _PDF_WRITER_SRC_FONT_H
#include "Objects.h"
namespace PdfWriter
{
class CDocument;
class CFontDict : public CDictObject
{
public:
CFontDict(CXref* pXref, CDocument* pDocument);
virtual ~CFontDict();
EDictType GetDictType() const
{
return dict_type_FONT;
}
virtual EFontType GetFontType()
{
return fontUnknownType;
}
protected:
CXref* m_pXref;
CDocument* m_pDocument;
};
}
#endif // _PDF_WRITER_SRC_FONT_H
#include "Font14.h"
namespace PdfWriter
{
static const char* c_sStandardFontNames[] =
{
"Helvetica",
"Helvetica-Bold",
"Helvetica-Oblique",
"Helvetice-BoldOblique",
"Courier",
"Courier-Bold",
"Courier-Oblique",
"Courier-BoldOblique",
"Times",
"Times-Bold",
"Times-Oblique",
"Times-BoldOblique",
"Symbol",
"ZapfDingbats",
NULL
};
CFont14::CFont14(CXref* pXref, CDocument* pDocument, EStandard14Fonts eType) : CFontDict(pXref, pDocument)
{
Add("Type", "Font");
Add("Subtype", "Type1");
Add("BaseFont", c_sStandardFontNames[(int)eType]);
}
}
\ No newline at end of file
#ifndef _PDF_WRITER_SRC_FONT14_H
#define _PDF_WRITER_SRC_FONT14_H
#include "Font.h"
namespace PdfWriter
{
class CXref;
class CDocument;
class CFont14 : public CFontDict
{
public:
CFont14(CXref* pXref, CDocument* pDocument, EStandard14Fonts eType);
EFontType GetFontType()
{
return fontType1;
}
};
}
#endif // _PDF_WRITER_SRC_FONT14_H
\ No newline at end of file
This diff is collapsed.
#ifndef _PDF_WRITER_SRC_FONTCIDTT_H
#define _PDF_WRITER_SRC_FONTCIDTT_H
#include "Font.h"
#include "Objects.h"
#include <string>
#include <map>
#include <vector>
namespace PdfWriter
{
class CXref;
class CStream;
class CFontFileTrueType;
class CDocument;
//----------------------------------------------------------------------------------------
// CFontFileBase
//----------------------------------------------------------------------------------------
class CFontCidTrueType : public CFontDict
{
public:
CFontCidTrueType(CXref* pXref, CDocument* pDocument, const std::wstring& wsFontPath, unsigned int unIndex);
~CFontCidTrueType();
unsigned char* EncodeString(unsigned int* pUnicodes, unsigned int unLen);
EFontType GetFontType()
{
return fontCIDType2;
}
private:
void BeforeWrite();
void GetWidthsAndGids(unsigned short** ppCodeToGid, unsigned int** pWidths, unsigned char** ppGlyphs, unsigned int& unGlyphsCount);
void CreateCIDFont2(CDictObject* pFont);
void WriteToUnicode();
private:
std::wstring m_wsFontPath;
unsigned int m_unFontIndex;
CFontFileTrueType* m_pFontFile;
CDictObject* m_pFontFileDict;
CStream* m_pCidToGidMapStream;
CStream* m_pToUnicodeStream;
CDictObject* m_pFont;
CDictObject* m_pFontDescriptor;
unsigned short m_ushCodesCount; //
std::map<unsigned int, unsigned short> m_mUnicodeToCode; // ->
std::vector<unsigned int> m_vUnicodes; // ->
};
}
#endif // _PDF_WRITER_SRC_FONTCIDTT_H
\ No newline at end of file
This diff is collapsed.
#ifndef _PDF_WRITER_SRC_TTWRITER_H
#define _PDF_WRITER_SRC_TTWRITER_H
#include "Streams.h"
namespace PdfWriter
{
struct TrueTypeTable;
struct TrueTypeCmap;
//----------------------------------------------------------------------------------------
// CFontFileBase
//----------------------------------------------------------------------------------------
class CFontFileBase
{
public:
virtual ~CFontFileBase();
protected:
CFontFileBase(char *sFile, int nLen, bool bFreeFileData);
static char *ReadFile(const std::wstring & wsFileName, int *pnFileLen);
int GetS8(int nPos, bool *pbSuccess);
int GetU8(int nPos, bool *pbSuccess);
int GetS16BE(int nPos, bool *pbSuccess);
int GetU16BE(int nPos, bool *pbSuccess);
int GetS32BE(int nPos, bool *pbSuccess);
unsigned int GetU32BE(int nPos, bool *pbSuccess);
unsigned int GetUVarBE(int nPos, int nSize, bool *pbSuccess);
bool CheckRegion(int nPos, int nSize);
protected:
unsigned char *m_sFileData;
unsigned char *m_sFile;
int m_nLen;
bool m_bFreeFileData;
};
//----------------------------------------------------------------------------------------
// CFontFileTrueType
//----------------------------------------------------------------------------------------
class CFontFileTrueType : public CFontFileBase
{
public:
static CFontFileTrueType *LoadFromBuffer(char* sBuffer, int nLen, unsigned int unIndex);
static CFontFileTrueType *LoadFromFile(const std::wstring& wsFileName, unsigned int unIndex);
~CFontFileTrueType();
// Записываем TrueTypeFont File, заполняя недостающие таблицы и корректируя
// различные ошибки. Если задан парметр <sName>, в шрифте переписываем таблицу
// 'name'. Если задан парамтре <pCodeToGID>, тогда в шрифте переписываем
// таблицу 'cmap'.
void WriteTTF(CStream* pOutputStream, char *sName = NULL, unsigned short *pCodeToGID = NULL, unsigned int unCodesCount = 0, unsigned char *pUseGlyfs = NULL, long lGlyfsCount = 0);
void WriteOTF(CStream* pOutputStream, char *sName = NULL, unsigned short *pCodeToGID = NULL);
int GetAscent();
int GetDescent();
int GetCapHeight();
int* GetBBox();
int GetWeight();
private:
CFontFileTrueType(char *sBuffer, int nLen, bool bFreeFileData, unsigned int unFontIndex);
unsigned int ComputeTableChecksum(unsigned char *sData, int nLength);
void Parse();
int SeekTable(char *sTag);
void ReadOS2();
private:
unsigned int m_unFontIndex;
TrueTypeTable* m_pTables;
int m_nTablesCount;
TrueTypeCmap* m_pCMaps;
int m_nCMapsCount;
int m_nGlyphs;
int m_nLocaFormat;
int m_arrBBox[4];
bool m_bOpenTypeCFF;
int m_nAscent;
int m_nDescent;
int m_nCapHeight;
int m_nWeight;
bool m_bSuccess;
};
}
#endif // _PDF_WRITER_SRC_TTWRITER_H
#include "GState.h"
namespace PdfWriter
{
const static char* c_sBlendModeNames[] =
{
"Normal",
"Multiply",
"Screen",
"Overlay",
"Darken",
"Lighten",
"ColorDodge",
"ColorBurn",
"HardLight",
"SoftLight",
"Difference",
"Exclusion"
};
//----------------------------------------------------------------------------------------
// CGrState
//----------------------------------------------------------------------------------------
CGrState::CGrState(CGrState* pCurrent)
{
if (pCurrent)
{
m_oMatrix = pCurrent->m_oMatrix;
m_dLineWidth = pCurrent->m_dLineWidth;
m_eLineCap = pCurrent->m_eLineCap;
m_eLineJoin = pCurrent->m_eLineJoin;
m_dMiterLimit = pCurrent->m_dMiterLimit;
m_oDashMode = pCurrent->m_oDashMode;
m_dFlatness = pCurrent->m_dFlatness;
m_dCharSpace = pCurrent->m_dCharSpace;
m_dWordSpace = pCurrent->m_dWordSpace;
m_dHScalling = pCurrent->m_dHScalling;
m_dTextLeading = pCurrent->m_dTextLeading;
m_eRenderingMode = pCurrent->m_eRenderingMode;
m_dTextRise = pCurrent->m_dTextRise;
m_oFillColor = pCurrent->m_oFillColor;
m_oStrokeColor = pCurrent->m_oStrokeColor;
m_pFont = pCurrent->m_pFont;
m_dFontSize = pCurrent->m_dFontSize;
m_pPrev = pCurrent;
m_unDepth = pCurrent->m_unDepth + 1;
}
else
{
m_dLineWidth = DEF_LINEWIDTH;
m_eLineCap = DEF_LINECAP;
m_eLineJoin = DEF_LINEJOIN;
m_dMiterLimit = DEF_MITERLIMIT;
m_dFlatness = DEF_FLATNESS;
m_dCharSpace = DEF_CHARSPACE;
m_dWordSpace = DEF_WORDSPACE;
m_dHScalling = DEF_HSCALING;
m_dTextLeading = DEF_LEADING;
m_eRenderingMode = DEF_RENDERING_MODE;
m_dTextRise = DEF_RISE;
m_pFont = NULL;
m_dFontSize = 0;
m_pPrev = NULL;
m_unDepth = 1;
}
}
CGrState::~CGrState()
{
}
//----------------------------------------------------------------------------------------
// CExtGrState
//----------------------------------------------------------------------------------------
CExtGrState::CExtGrState(CXref* pXref)
{
pXref->Add(this);
Add("Type", "ExtGState");
m_eBlendMode = blendmode_Unknown;
m_dAlphaFill = 1;
m_dAlphaStroke = 1;
m_bStrokeAdj = true;
}
void CExtGrState::SetAlphaStroke (double dValue)
{
dValue = min(1, max(0, dValue));
Add("CA", dValue);
}
void CExtGrState::SetAlphaFill (double dValue)
{
dValue = min(1, max(0, dValue));
Add("ca", dValue);
}
void CExtGrState::SetBlendMode (EBlendMode eBlendMode)
{
eBlendMode = min(blendmode_Max, max(blendmode_Min, eBlendMode));
Add("BM", c_sBlendModeNames[(int)eBlendMode]);
}
void CExtGrState::SetStrokeAdjustment(bool bValue)
{
Add("SA", bValue);
}
double CExtGrState::GetAlphaStroke()
{
return m_dAlphaStroke;
}
double CExtGrState::GetAlphaFill()
{
return m_dAlphaFill;
}
EBlendMode CExtGrState::GetBlendMode()
{
return m_eBlendMode;
}
bool CExtGrState::GetStrokeAdjustment()
{
return m_bStrokeAdj;
}
}
#ifndef _PDF_WRITER_SRC_GSTATE_H
#define _PDF_WRITER_SRC_GSTATE_H
#include "Types.h"
#include "Objects.h"
// Стандартные значения для Graphic State
#define DEF_FONT "Helvetica"
#define DEF_WORDSPACE 0
#define DEF_CHARSPACE 0
#define DEF_FONTSIZE 10
#define DEF_HSCALING 100
#define DEF_LEADING 0
#define DEF_RENDERING_MODE PdfWriter::textrenderingmode_Fill
#define DEF_RISE 0
#define DEF_LINEWIDTH 1
#define DEF_LINECAP PdfWriter::linecap_Butt
#define DEF_LINEJOIN PdfWriter::linejoin_Miter
#define DEF_MITERLIMIT 10
#define DEF_FLATNESS 1
#define DEF_PAGE_NUM 1
namespace PdfWriter
{
class CFontDict;
class CDictObject;
//----------------------------------------------------------------------------------------
// CGrState
//----------------------------------------------------------------------------------------
class CGrState
{
public:
CGrState(CGrState* pCurrent);
~CGrState();
CGrState* GetPrev()
{
return m_pPrev;
}
unsigned int GetDepth()
{
return m_unDepth;
}
private:
CMatrix m_oMatrix;
double m_dLineWidth;
ELineCapStyle m_eLineCap;
ELineJoinStyle m_eLineJoin;
double m_dMiterLimit;
CDashMode m_oDashMode;
double m_dFlatness;
double m_dCharSpace;
double m_dWordSpace;
double m_dHScalling;
double m_dTextLeading;
ETextRenderingMode m_eRenderingMode;
double m_dTextRise;
TRgb m_oFillColor;
TRgb m_oStrokeColor;
CFontDict* m_pFont;
double m_dFontSize;
CGrState* m_pPrev;
unsigned int m_unDepth;
friend class CPage;
};
//----------------------------------------------------------------------------------------
// CExtGrState
//----------------------------------------------------------------------------------------
class CExtGrState : public CDictObject
{
public:
CExtGrState(CXref* pXref);
void SetAlphaStroke (double dValue);
void SetAlphaFill (double dValue);
void SetBlendMode (EBlendMode eBlendMode);
void SetStrokeAdjustment(bool bValue);
double GetAlphaStroke();
double GetAlphaFill();
EBlendMode GetBlendMode();
bool GetStrokeAdjustment();
EDictType GetDictType() const
{
return dict_type_EXT_GSTATE;
}
private:
double m_dAlphaStroke;
double m_dAlphaFill;
EBlendMode m_eBlendMode;
bool m_bStrokeAdj;
};
}
#endif // _PDF_WRITER_SRC_GSTATE_H
This diff is collapsed.
#ifndef _PDF_WRITER_SRC_IMAGE_H
#define _PDF_WRITER_SRC_IMAGE_H
#include "Objects.h"
struct jbig2ctx;
struct Pix;
namespace PdfWriter
{
class CDocument;
class CXObject : public CDictObject
{
public:
EDictType GetDictType() const
{
return dict_type_XOBJECT;
}
};
//----------------------------------------------------------------------------------------
// CImageDict
//----------------------------------------------------------------------------------------
class CImageDict : public CXObject
{
public:
CImageDict(CXref* pXref, CDocument* pDocument);
void LoadJpeg(const wchar_t* wsTempFile, unsigned int unWidth, unsigned int unHeight);
void LoadJpx(const wchar_t* wsTempFile, unsigned int unWidth, unsigned int unHeight);
void LoadJb2(const wchar_t* wsTempFile, unsigned int unWidth, unsigned int unHeight);
void LoadCCITT4(const wchar_t* wsTempFile, unsigned int unWidth, unsigned int unHeight);
void LoadRaw(const BYTE* pBgra, unsigned int unWidth, unsigned int unHeight);
void LoadSMask(const BYTE* pBgra, unsigned int unWidth, unsigned int unHeight);
void LoadBW(const BYTE* pImage, unsigned int unWidth, unsigned int unHeight, unsigned int unStride);
void LoadBW(Pix* pPix, unsigned int unWidth, unsigned int unHeight);
private:
CDocument* m_pDocument;
CXref* m_pXref;
};
//----------------------------------------------------------------------------------------
// CJbig2Global
//----------------------------------------------------------------------------------------
class CJbig2Global : public CDictObject
{
public:
CJbig2Global(CXref* pXref);
~CJbig2Global();
void AddImage(const BYTE* pImage, unsigned int unWidth, unsigned int unHeight, unsigned int unStride, CStream* pImageStream);
void AddImage(Pix* pPix, CStream* pImageStream);
void FlushStreams();
int GetImagesCount();
private:
CXref* m_pXref;
jbig2ctx* m_pContext;
std::vector<CStream*> m_vImages;
};
}
#endif // _PDF_WRITER_SRC_IMAGE_H
\ No newline at end of file
#include "Info.h"
#include "Utils.h"
#include "Objects.h"
#include <ctime>
static const char *c_asInfoItemNames[] =
{
"CreationDate",
"ModDate",
"Author",
"Creator",
"Producer",
"Title",
"Subject",
"Keywords",
NULL
};
namespace PdfWriter
{
static const char* InfoTypeToName(EInfoType eType)
{
unsigned int nIndex = (unsigned int)eType;
return c_asInfoItemNames[nIndex];
}
//----------------------------------------------------------------------------------------
// CInfoDict
//----------------------------------------------------------------------------------------
CInfoDict::CInfoDict(CXref* pXref)
{
pXref->Add(this);
}
void CInfoDict::SetInfo(EInfoType eType, const char* sValue)
{
const char* sName = InfoTypeToName(eType);
if (eType <= InfoModaDate)
return;
Add(sName, new CStringObject(sValue));
}
const char* CInfoDict::GetInfo(EInfoType eType)
{
const char* sName = InfoTypeToName(eType);
CStringObject* pString = (CStringObject*)Get(std::string(sName));
if (!pString || object_type_STRING != pString->GetType())
return NULL;
return (const char*)pString->GetString();
}
void CInfoDict::SetInfo(EInfoType eType, const TDate& oDate)
{
char sTemp[DATE_TIME_STR_LEN + 1];
char* pTemp = NULL;
const char* sName = InfoTypeToName(eType);
if (eType > InfoModaDate)
return;
MemSet(sTemp, 0, DATE_TIME_STR_LEN + 1);
if (oDate.nMonth < 1 || 12 < oDate.nMonth ||
oDate.nDay < 1 ||
23 < oDate.nHour || 59 < oDate.nMinutes || 59 < oDate.nSeconds ||
(oDate.nInd != '+' && oDate.nInd != '-' && oDate.nInd != 'Z' && oDate.nInd != ' ') ||
23 < oDate.nOffHour || 59 < oDate.nOffMinutes)
{
return;
}
switch (oDate.nMonth)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
if (oDate.nDay > 31)
return;
break;
case 4:
case 6:
case 9:
case 11:
if (oDate.nDay > 30)
return;
break;
case 2:
if (oDate.nDay > 29 || (oDate.nDay == 29 && (oDate.nYear % 4 != 0 || (oDate.nYear % 100 == 0 && oDate.nYear % 400 != 0))))
return;
break;
default:
return;
}
pTemp = (char*)MemCpy((BYTE*)sTemp, (BYTE*)"D:", 2);
pTemp = ItoA2(pTemp, oDate.nYear, 5);
pTemp = ItoA2(pTemp, oDate.nMonth, 3);
pTemp = ItoA2(pTemp, oDate.nDay, 3);
pTemp = ItoA2(pTemp, oDate.nHour, 3);
pTemp = ItoA2(pTemp, oDate.nMinutes, 3);
pTemp = ItoA2(pTemp, oDate.nSeconds, 3);
if (' ' != oDate.nInd)
{
*pTemp++ = oDate.nInd;
pTemp = ItoA2(pTemp, oDate.nOffHour, 3);
*pTemp++ = '\'';
pTemp = ItoA2(pTemp, oDate.nOffMinutes, 3);
*pTemp++ = '\'';
}
*pTemp = 0;
Add(sName, new CStringObject(sTemp));
}
void CInfoDict::SetCreationTime()
{
time_t oTime = time(0);
struct tm* oNow = localtime(&oTime);
TDate oDate;
oDate.nYear = oNow->tm_year + 1900;
oDate.nMonth = oNow->tm_mon + 1;
oDate.nDay = oNow->tm_mday;
oDate.nHour = oNow->tm_hour;
oDate.nMinutes = oNow->tm_min;
oDate.nSeconds = oNow->tm_sec;
oDate.nInd = ' ';
SetInfo(InfoCreationDate, oDate);
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef _PDF_WRITER_SRC_PATTERN_H
#define _PDF_WRITER_SRC_PATTERN_H
#include "Objects.h"
namespace PdfWriter
{
class CImageDict;
//----------------------------------------------------------------------------------------
// CImageTilePattern
//----------------------------------------------------------------------------------------
class CImageTilePattern : public CDictObject
{
public:
CImageTilePattern(CXref* pXref, double dW, double dH, CImageDict* pImageDict, EImageTilePatternType eType = imagetilepatterntype_Default);
};
}
#endif // _PDF_WRITER_SRC_PATTERN_H
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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