diff options
| author | Dave Wilson <[email protected]> | 2015-03-17 19:50:07 -0700 |
|---|---|---|
| committer | Dave Wilson <[email protected]> | 2015-03-17 19:50:07 -0700 |
| commit | 97cf5197cf5b882b2c689d8dc2b555f2edf8f418 (patch) | |
| tree | 46f3701832d70b420eb0fc0eb93261f9da45db3f /print | |
| parent | ef1905bf1e8825bb31120dfb27e0daf3154d859a (diff) | |
Initial publish
Diffstat (limited to 'print')
498 files changed, 19374 insertions, 0 deletions
diff --git a/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj b/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj new file mode 100644 index 00000000..544fe0e2 --- /dev/null +++ b/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj @@ -0,0 +1,141 @@ +<?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="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{8DD661EC-C827-40E9-8894-C81041AC4324}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + <SupportsPackaging>false</SupportsPackaging> + <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <SampleGuid>{AF94EE33-40D5-4CD7-9F09-5A1CC16F2EF0}</SampleGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <OutDir>$(IntDir)</OutDir> + </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </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')" /> + </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')" /> + </ImportGroup> + <ItemGroup Label="WrappedTaskItems" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>BlankProject</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>BlankProject</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>BlankProject</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>BlankProject</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + <Link> + <NoEntryPoint>true</NoEntryPoint> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + <Link> + <NoEntryPoint>true</NoEntryPoint> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + <Link> + <NoEntryPoint>true</NoEntryPoint> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + <Link> + <NoEntryPoint>true</NoEntryPoint> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <Inf Exclude="@(Inf)" Include="*.inf" /> + <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> + </ItemGroup> + <ItemGroup> + <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> + <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> + <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> + </ItemGroup> + <ItemGroup> + <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project>
\ No newline at end of file diff --git a/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj.Filters b/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj.Filters new file mode 100644 index 00000000..fee230a4 --- /dev/null +++ b/print/SampleOpenXPS/BlankProjSrc/BlankProject.vcxproj.Filters @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> + <UniqueIdentifier>{B2CC4F75-22F6-4939-B93F-DAFE36BFD9D6}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + <UniqueIdentifier>{0A89D084-FD85-4B63-B752-7C0852CD9001}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> + <UniqueIdentifier>{74429B5A-7FD5-4707-BEED-E41681C9E5B0}</UniqueIdentifier> + </Filter> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.1a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.1a.oxps Binary files differnew file mode 100644 index 00000000..7d57c6fa --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.1a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.2a.oxps Binary files differnew file mode 100644 index 00000000..8da67915 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M1.2a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.14a.oxps Binary files differnew file mode 100644 index 00000000..a68e8299 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.14a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.17a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.17a.oxps Binary files differnew file mode 100644 index 00000000..5787ab9e --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.17a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.20a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.20a.oxps Binary files differnew file mode 100644 index 00000000..272f75ff --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.20a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.24a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.24a.oxps Binary files differnew file mode 100644 index 00000000..3cb95fbd --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.24a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27a.oxps Binary files differnew file mode 100644 index 00000000..b6dd42fc --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27b.oxps Binary files differnew file mode 100644 index 00000000..2d5a4a59 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.27b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.30a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.30a.oxps Binary files differnew file mode 100644 index 00000000..0063c896 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.30a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.31a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.31a.oxps Binary files differnew file mode 100644 index 00000000..82a3cec8 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.31a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.32a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.32a.oxps Binary files differnew file mode 100644 index 00000000..821826a6 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.32a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.33a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.33a.oxps Binary files differnew file mode 100644 index 00000000..1a709467 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.33a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.35a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.35a.oxps Binary files differnew file mode 100644 index 00000000..c35fb749 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.35a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36a.oxps Binary files differnew file mode 100644 index 00000000..d9176b43 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36b.oxps Binary files differnew file mode 100644 index 00000000..ca568053 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.36b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41a.oxps Binary files differnew file mode 100644 index 00000000..092826a0 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41b.oxps Binary files differnew file mode 100644 index 00000000..1c48a335 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.41b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42a.oxps Binary files differnew file mode 100644 index 00000000..b57510e9 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42b.oxps Binary files differnew file mode 100644 index 00000000..7877aadf --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.42b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43a.oxps Binary files differnew file mode 100644 index 00000000..91f3c64a --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43b.oxps Binary files differnew file mode 100644 index 00000000..661578e4 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.43b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.44a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.44a.oxps Binary files differnew file mode 100644 index 00000000..a5a26d00 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.44a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.48a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.48a.oxps Binary files differnew file mode 100644 index 00000000..15313e86 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.48a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49a.oxps Binary files differnew file mode 100644 index 00000000..7e238cda --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49b.oxps Binary files differnew file mode 100644 index 00000000..3a1c4ae3 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.49b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.50a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.50a.oxps Binary files differnew file mode 100644 index 00000000..31045006 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.50a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.52a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.52a.oxps Binary files differnew file mode 100644 index 00000000..d2c0d68f --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.52a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.55a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.55a.oxps Binary files differnew file mode 100644 index 00000000..d9a21ca3 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.55a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.56a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.56a.oxps Binary files differnew file mode 100644 index 00000000..9c82a8c6 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/MarkupCompatibility/M2.56a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M1.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M1.2a.oxps Binary files differnew file mode 100644 index 00000000..12c0d526 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M1.2a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.23a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.23a.oxps Binary files differnew file mode 100644 index 00000000..e4183e92 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.23a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6a.oxps Binary files differnew file mode 100644 index 00000000..18955f95 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6b.oxps Binary files differnew file mode 100644 index 00000000..e2d0085f --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M10.6b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.2a.oxps Binary files differnew file mode 100644 index 00000000..b080ba72 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.2a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3a.oxps Binary files differnew file mode 100644 index 00000000..0a83e2d0 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3b.oxps Binary files differnew file mode 100644 index 00000000..6c0bda7a --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.3b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5a.oxps Binary files differnew file mode 100644 index 00000000..cc2330fa --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5b.oxps Binary files differnew file mode 100644 index 00000000..b02d1522 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5c.oxps Binary files differnew file mode 100644 index 00000000..dd8abe81 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.5c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.7a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.7a.oxps Binary files differnew file mode 100644 index 00000000..f65645da --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M12.7a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10a.oxps Binary files differnew file mode 100644 index 00000000..4db2144d --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10b.oxps Binary files differnew file mode 100644 index 00000000..ccbf170e --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.10b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13a.oxps Binary files differnew file mode 100644 index 00000000..356a7c0a --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13b.oxps Binary files differnew file mode 100644 index 00000000..81819935 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.13b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14a.oxps Binary files differnew file mode 100644 index 00000000..8b629d76 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14b.oxps Binary files differnew file mode 100644 index 00000000..2e23e20b --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.14b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.17a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.17a.oxps Binary files differnew file mode 100644 index 00000000..9aa2db0b --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.17a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.18a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.18a.oxps Binary files differnew file mode 100644 index 00000000..6c4dc4da --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.18a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.25a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.25a.oxps Binary files differnew file mode 100644 index 00000000..d3764cb1 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.25a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2a.oxps Binary files differnew file mode 100644 index 00000000..2e587765 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2b.oxps Binary files differnew file mode 100644 index 00000000..a766c766 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2c.oxps Binary files differnew file mode 100644 index 00000000..f94c3782 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.2c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.35a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.35a.oxps Binary files differnew file mode 100644 index 00000000..5cac28ee --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.35a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.36a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.36a.oxps Binary files differnew file mode 100644 index 00000000..615bcd03 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.36a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.37a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.37a.oxps Binary files differnew file mode 100644 index 00000000..26d9cc97 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.37a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39a.oxps Binary files differnew file mode 100644 index 00000000..4856a8f4 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39b.oxps Binary files differnew file mode 100644 index 00000000..976a3ffb --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39c.oxps Binary files differnew file mode 100644 index 00000000..163a06a0 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.39c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3a.oxps Binary files differnew file mode 100644 index 00000000..fe72bc82 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3b.oxps Binary files differnew file mode 100644 index 00000000..bd84ede6 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3c.oxps Binary files differnew file mode 100644 index 00000000..48f5513e --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.3c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4a.oxps Binary files differnew file mode 100644 index 00000000..635ba653 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4b.oxps Binary files differnew file mode 100644 index 00000000..53f585b7 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.4b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.54a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.54a.oxps Binary files differnew file mode 100644 index 00000000..02e067b0 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.54a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59a.oxps Binary files differnew file mode 100644 index 00000000..749fc46c --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59b.oxps Binary files differnew file mode 100644 index 00000000..1732ba01 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59c.oxps Binary files differnew file mode 100644 index 00000000..d4530964 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.59c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5a.oxps Binary files differnew file mode 100644 index 00000000..eab5315b --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5b.oxps Binary files differnew file mode 100644 index 00000000..003785dc --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.5b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6a.oxps Binary files differnew file mode 100644 index 00000000..7d49183d --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6b.oxps Binary files differnew file mode 100644 index 00000000..344a2a4c --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6c.oxps Binary files differnew file mode 100644 index 00000000..8e6a3fee --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.6c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.70a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.70a.oxps Binary files differnew file mode 100644 index 00000000..dd8207dd --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.70a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71a.oxps Binary files differnew file mode 100644 index 00000000..a4768f4e --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71b.oxps Binary files differnew file mode 100644 index 00000000..3875027e --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71c.oxps Binary files differnew file mode 100644 index 00000000..6f0cb60b --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.71c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72a.oxps Binary files differnew file mode 100644 index 00000000..034178df --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72b.oxps Binary files differnew file mode 100644 index 00000000..24fa8200 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72c.oxps Binary files differnew file mode 100644 index 00000000..cf695786 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.72c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73a.oxps Binary files differnew file mode 100644 index 00000000..a19a1d76 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73b.oxps Binary files differnew file mode 100644 index 00000000..c4c02c89 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.73b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74a.oxps Binary files differnew file mode 100644 index 00000000..34754853 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74b.oxps Binary files differnew file mode 100644 index 00000000..7ec5e802 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74c.oxps Binary files differnew file mode 100644 index 00000000..70df17e7 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.74c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75a.oxps Binary files differnew file mode 100644 index 00000000..3d6c80c6 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75b.oxps Binary files differnew file mode 100644 index 00000000..f9453775 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75c.oxps Binary files differnew file mode 100644 index 00000000..a6af0c05 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75d.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75d.oxps Binary files differnew file mode 100644 index 00000000..860d6ef7 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.75d.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.76a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.76a.oxps Binary files differnew file mode 100644 index 00000000..04009798 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.76a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77a.oxps Binary files differnew file mode 100644 index 00000000..b09370b0 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77b.oxps Binary files differnew file mode 100644 index 00000000..d4c716aa --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.77b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7a.oxps Binary files differnew file mode 100644 index 00000000..43ae8dd4 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7b.oxps Binary files differnew file mode 100644 index 00000000..cd438ae8 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7c.oxps Binary files differnew file mode 100644 index 00000000..5769291e --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.7c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.80.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.80.oxps Binary files differnew file mode 100644 index 00000000..54be15f5 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.80.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.81.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.81.oxps Binary files differnew file mode 100644 index 00000000..3ee96f65 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.81.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.82.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.82.oxps Binary files differnew file mode 100644 index 00000000..c4f7bc34 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.82.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8a.oxps Binary files differnew file mode 100644 index 00000000..6d7ac332 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8b.oxps Binary files differnew file mode 100644 index 00000000..c89d5178 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8c.oxps Binary files differnew file mode 100644 index 00000000..9189599c --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M2.8c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11a.oxps Binary files differnew file mode 100644 index 00000000..6a245834 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11b.oxps Binary files differnew file mode 100644 index 00000000..67b452f2 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.11b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12a.oxps Binary files differnew file mode 100644 index 00000000..51dd9a58 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12b.oxps Binary files differnew file mode 100644 index 00000000..1436e752 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.12b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.13a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.13a.oxps Binary files differnew file mode 100644 index 00000000..86d736fd --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.13a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.14a.oxps Binary files differnew file mode 100644 index 00000000..61153510 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.14a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20a.oxps Binary files differnew file mode 100644 index 00000000..54991b08 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20b.oxps Binary files differnew file mode 100644 index 00000000..48170f5d --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.20b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2a.oxps Binary files differnew file mode 100644 index 00000000..4249ffcf --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2b.oxps Binary files differnew file mode 100644 index 00000000..3fb18d33 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.2b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.3a.oxps Binary files differnew file mode 100644 index 00000000..65627a53 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.3a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5a.oxps Binary files differnew file mode 100644 index 00000000..d692b79e --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5b.oxps Binary files differnew file mode 100644 index 00000000..9c778641 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.5b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6a.oxps Binary files differnew file mode 100644 index 00000000..19bf2016 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6b.oxps Binary files differnew file mode 100644 index 00000000..072980cc --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M3.6b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1a.oxps Binary files differnew file mode 100644 index 00000000..27b1345f --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1b.oxps Binary files differnew file mode 100644 index 00000000..a8ba179c --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1c.oxps Binary files differnew file mode 100644 index 00000000..e0e0dfdd --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.1c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2a.oxps Binary files differnew file mode 100644 index 00000000..f7e297c5 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2b.oxps Binary files differnew file mode 100644 index 00000000..ec497e43 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.2b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.3a.oxps Binary files differnew file mode 100644 index 00000000..fe050dcc --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M4.3a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.15a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.15a.oxps Binary files differnew file mode 100644 index 00000000..75944cfa --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.15a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2a.oxps Binary files differnew file mode 100644 index 00000000..3b83175d --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2b.oxps Binary files differnew file mode 100644 index 00000000..95a4fdfd --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2c.oxps Binary files differnew file mode 100644 index 00000000..3b334728 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.2c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3a.oxps Binary files differnew file mode 100644 index 00000000..9cd37caa --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3b.oxps Binary files differnew file mode 100644 index 00000000..fac36836 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3c.oxps Binary files differnew file mode 100644 index 00000000..47b8e96f --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.3c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4a.oxps Binary files differnew file mode 100644 index 00000000..56874b52 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4b.oxps Binary files differnew file mode 100644 index 00000000..d02e3e5b --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.4b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.7a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.7a.oxps Binary files differnew file mode 100644 index 00000000..67ea2d89 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M5.7a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1a.oxps Binary files differnew file mode 100644 index 00000000..10082c32 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1b.oxps Binary files differnew file mode 100644 index 00000000..a495ea08 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.1b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2a.oxps Binary files differnew file mode 100644 index 00000000..47cb778b --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2b.oxps Binary files differnew file mode 100644 index 00000000..d3f3abc8 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.2b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3a.oxps Binary files differnew file mode 100644 index 00000000..f4366daa --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3b.oxps Binary files differnew file mode 100644 index 00000000..42c68be9 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.3b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4a.oxps Binary files differnew file mode 100644 index 00000000..ca2a1fd8 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4b.oxps Binary files differnew file mode 100644 index 00000000..a5011cc2 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.4b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5a.oxps Binary files differnew file mode 100644 index 00000000..31c389e5 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5b.oxps Binary files differnew file mode 100644 index 00000000..2153d0c1 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.5b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6a.oxps Binary files differnew file mode 100644 index 00000000..8879e4c7 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6b.oxps Binary files differnew file mode 100644 index 00000000..c5c2f609 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M6.6b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11a.oxps Binary files differnew file mode 100644 index 00000000..73a45e80 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11b.oxps Binary files differnew file mode 100644 index 00000000..b86db281 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.11b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2a.oxps Binary files differnew file mode 100644 index 00000000..e82f6990 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2b.oxps Binary files differnew file mode 100644 index 00000000..69ba04cf --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.2b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.3a.oxps Binary files differnew file mode 100644 index 00000000..c6d8e028 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.3a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.5a.oxps Binary files differnew file mode 100644 index 00000000..14bed3c0 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.5a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.6a.oxps Binary files differnew file mode 100644 index 00000000..1e6f679e --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M7.6a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M8.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M8.14a.oxps Binary files differnew file mode 100644 index 00000000..6bd6cba4 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M8.14a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10a.oxps Binary files differnew file mode 100644 index 00000000..b933f9bb --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10b.oxps Binary files differnew file mode 100644 index 00000000..0691b803 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OXPS/M9.10b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10a.oxps Binary files differnew file mode 100644 index 00000000..86bb6c6d --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10b.oxps Binary files differnew file mode 100644 index 00000000..3e2820be --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.10b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.11a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.11a.oxps Binary files differnew file mode 100644 index 00000000..f2a269d9 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.11a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.12a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.12a.oxps Binary files differnew file mode 100644 index 00000000..f0f51a6a --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.12a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13a.oxps Binary files differnew file mode 100644 index 00000000..29fd37e8 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13b.oxps Binary files differnew file mode 100644 index 00000000..4a1aa928 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.13b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14a.oxps Binary files differnew file mode 100644 index 00000000..a5b1c2fd --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14b.oxps Binary files differnew file mode 100644 index 00000000..bda7b613 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14c.oxps Binary files differnew file mode 100644 index 00000000..b16535f1 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.14c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.15a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.15a.oxps Binary files differnew file mode 100644 index 00000000..e62a2c04 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.15a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17a.oxps Binary files differnew file mode 100644 index 00000000..b46a75a8 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17b.oxps Binary files differnew file mode 100644 index 00000000..abc66d3a --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.17b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18a.oxps Binary files differnew file mode 100644 index 00000000..8c4db483 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18b.oxps Binary files differnew file mode 100644 index 00000000..61f134ad --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.18b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.1a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.1a.oxps Binary files differnew file mode 100644 index 00000000..9fb579e9 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.1a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20a.oxps Binary files differnew file mode 100644 index 00000000..dbf7e7b5 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20b.oxps Binary files differnew file mode 100644 index 00000000..5618a606 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.20b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21a.oxps Binary files differnew file mode 100644 index 00000000..7161dda4 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21b.oxps Binary files differnew file mode 100644 index 00000000..600251fa --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.21b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.22a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.22a.oxps Binary files differnew file mode 100644 index 00000000..f115a574 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.22a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.25a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.25a.oxps Binary files differnew file mode 100644 index 00000000..92acd6dc --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.25a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26a.oxps Binary files differnew file mode 100644 index 00000000..a1105597 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26b.oxps Binary files differnew file mode 100644 index 00000000..7f97b408 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.26b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27a.oxps Binary files differnew file mode 100644 index 00000000..66210956 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27b.oxps Binary files differnew file mode 100644 index 00000000..38d0a4c3 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.27b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28a.oxps Binary files differnew file mode 100644 index 00000000..c4cd0cff --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28b.oxps Binary files differnew file mode 100644 index 00000000..0b31ee13 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.28b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2a.oxps Binary files differnew file mode 100644 index 00000000..c28b2d74 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2b.oxps Binary files differnew file mode 100644 index 00000000..a41da49d --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2c.oxps Binary files differnew file mode 100644 index 00000000..e57161b6 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.2c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30a.oxps Binary files differnew file mode 100644 index 00000000..389055ab --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30b.oxps Binary files differnew file mode 100644 index 00000000..34a11721 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.30b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.3a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.3a.oxps Binary files differnew file mode 100644 index 00000000..43458263 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.3a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.5a.oxps Binary files differnew file mode 100644 index 00000000..527dacf3 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.5a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6a.oxps Binary files differnew file mode 100644 index 00000000..3380472a --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6b.oxps Binary files differnew file mode 100644 index 00000000..53b246e8 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6c.oxps Binary files differnew file mode 100644 index 00000000..1b412c9f --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6d.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6d.oxps Binary files differnew file mode 100644 index 00000000..c0656f7a --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.6d.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7a.oxps Binary files differnew file mode 100644 index 00000000..c7312c0c --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7b.oxps Binary files differnew file mode 100644 index 00000000..f30e067c --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.7b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8a.oxps Binary files differnew file mode 100644 index 00000000..edfee4f6 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8b.oxps Binary files differnew file mode 100644 index 00000000..56be3417 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8c.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8c.oxps Binary files differnew file mode 100644 index 00000000..447aa316 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.8c.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.9a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.9a.oxps Binary files differnew file mode 100644 index 00000000..39a2bab7 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M1.9a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.10a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.10a.oxps Binary files differnew file mode 100644 index 00000000..d59d1efb --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.10a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.18a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.18a.oxps Binary files differnew file mode 100644 index 00000000..b913fb02 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.18a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.4a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.4a.oxps Binary files differnew file mode 100644 index 00000000..2ff018f6 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.4a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5a.oxps Binary files differnew file mode 100644 index 00000000..d3377da4 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5b.oxps Binary files differnew file mode 100644 index 00000000..c720fb68 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.5b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6a.oxps Binary files differnew file mode 100644 index 00000000..d91da44f --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6b.oxps Binary files differnew file mode 100644 index 00000000..b6e8e3a2 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.6b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7a.oxps Binary files differnew file mode 100644 index 00000000..2cb5018c --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7b.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7b.oxps Binary files differnew file mode 100644 index 00000000..6f4ee6d0 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M2.7b.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.10a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.10a.oxps Binary files differnew file mode 100644 index 00000000..1cbac9f4 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.10a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.14a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.14a.oxps Binary files differnew file mode 100644 index 00000000..a2579585 --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.14a.oxps diff --git a/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.9a.oxps b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.9a.oxps Binary files differnew file mode 100644 index 00000000..6b5fef0b --- /dev/null +++ b/print/SampleOpenXPS/ConformanceViolations_oxps/OpenPackagingConventions/M3.9a.oxps diff --git a/print/SampleOpenXPS/OpenXPSTestFiles_EndUserLicenseAgreement.txt b/print/SampleOpenXPS/OpenXPSTestFiles_EndUserLicenseAgreement.txt new file mode 100644 index 00000000..bb9b187b --- /dev/null +++ b/print/SampleOpenXPS/OpenXPSTestFiles_EndUserLicenseAgreement.txt @@ -0,0 +1,7 @@ +END-USER LICENSE AGREEMENT +IMPORTANT�READ CAREFULLY: This Microsoft End-User License Agreement (�EULA�) is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation (�Microsoft�) for Test Files owned by Microsoft and identified below. By installing, copying, or otherwise using the Test Files, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, you may not install or use the Test Files. + +Microsoft owns a library of sample Open XML Paper Specification (�OpenXPS�) files, which Microsoft created for testing features of the OpenXPS format (the �Test Files�). The Test Files are protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. This is a license, not a sale, of the Test Files. +1. GRANT OF LICENSE. Microsoft grants to you as an individual, a personal, nonexclusive, and limited license to make and use copies of the Test Files on any number of computers residing on your premises for the sole purpose of developing and testing your software and/or hardware products. These license rights are conditioned on your compliance with the license restrictions and requirements described below. +2. TERMINATION. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. +3. DISCLAIMER OF WARRANTIES. To the maximum extent permitted by applicable law, Microsoft provides the Test Files AS IS AND WITH ALL FAULTS, and hereby disclaim all warranties and conditions, either express, implied or statutory, including, but not limited to, any (if any) implied warranties or conditions of merchantability, of fitness for a particular purpose, of lack of viruses, of accuracy or completeness of responses, of results, and of lack of negligence or lack of workmanlike effort, all with regard to the Test Files. ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT, WITH REGARD TO THE TEST FILES. THE ENTIRE RISK AS TO THE QUALITY OF OR ARISING OUT OF USE OR PERFORMANCE OF THE SAMPLE CODE, IF ANY, REMAINS WITH YOU. diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb01.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb01.oxps Binary files differnew file mode 100644 index 00000000..3e80f38a --- /dev/null +++ b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb01.oxps diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb02.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb02.oxps Binary files differnew file mode 100644 index 00000000..ff9cfa89 --- /dev/null +++ b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb02.oxps diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb03.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb03.oxps Binary files differnew file mode 100644 index 00000000..b92f8aa0 --- /dev/null +++ b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb03.oxps diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb04.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb04.oxps Binary files differnew file mode 100644 index 00000000..4db94294 --- /dev/null +++ b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb04.oxps diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb05.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb05.oxps Binary files differnew file mode 100644 index 00000000..a3352a3c --- /dev/null +++ b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb05.oxps diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb06.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb06.oxps Binary files differnew file mode 100644 index 00000000..99e89c53 --- /dev/null +++ b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb06.oxps diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb07.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb07.oxps Binary files differnew file mode 100644 index 00000000..2fa2eb7e --- /dev/null +++ b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb07.oxps diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb08.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb08.oxps Binary files differnew file mode 100644 index 00000000..f40d61cc --- /dev/null +++ b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb08.oxps diff --git a/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb09.oxps b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb09.oxps Binary files differnew file mode 100644 index 00000000..eca31524 --- /dev/null +++ b/print/SampleOpenXPS/QualityLogicMinBar_oxps/mb09.oxps diff --git a/print/SampleOpenXPS/ReadMe.md b/print/SampleOpenXPS/ReadMe.md new file mode 100644 index 00000000..a50148e4 --- /dev/null +++ b/print/SampleOpenXPS/ReadMe.md @@ -0,0 +1,7 @@ +OpenXPS Documents Print Sample +============================== + +This sample contains a set of documents that were generated from a variety of sources, including those generated from the Windows Presentation Foundation in the .NET Framework, from Office 2007, and from the Microsoft XPS Document Writer (MXDW). A few of the docuemts were either hand-built from scratch or hand-modified from another source. They have been included to provide you with a few documents that exercise a variety of features of the XML Paper Specification. + +In addition, a few high-quality documents have been provided in the Showcase directory to highlight some of the XPS advantages in terms of screen-to-print fidelity. We've also created some documents that are intended to fail, by violating at least one conformance rule. These are in the ConformanceViolations directory. For information about OpenXPS in Windows, see [Improvements in XPSDrv](http://msdn.microsoft.com/en-us/library/windows/hardware/jj218730(v=vs.85).aspx) and [OpenXPS Support in Windows](http://msdn.microsoft.com/en-us/library/windows/hardware/br259130.aspx). + diff --git a/print/SampleOpenXPS/SampleOpenXPS.sln b/print/SampleOpenXPS/SampleOpenXPS.sln new file mode 100644 index 00000000..19ed775e --- /dev/null +++ b/print/SampleOpenXPS/SampleOpenXPS.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlankProject", "BlankProjSrc\BlankProject.vcxproj", "{8DD661EC-C827-40E9-8894-C81041AC4324}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8DD661EC-C827-40E9-8894-C81041AC4324}.Debug|Win32.ActiveCfg = Debug|Win32 + {8DD661EC-C827-40E9-8894-C81041AC4324}.Debug|Win32.Build.0 = Debug|Win32 + {8DD661EC-C827-40E9-8894-C81041AC4324}.Release|Win32.ActiveCfg = Release|Win32 + {8DD661EC-C827-40E9-8894-C81041AC4324}.Release|Win32.Build.0 = Release|Win32 + {8DD661EC-C827-40E9-8894-C81041AC4324}.Debug|x64.ActiveCfg = Debug|x64 + {8DD661EC-C827-40E9-8894-C81041AC4324}.Debug|x64.Build.0 = Debug|x64 + {8DD661EC-C827-40E9-8894-C81041AC4324}.Release|x64.ActiveCfg = Release|x64 + {8DD661EC-C827-40E9-8894-C81041AC4324}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/print/SampleOpenXPS/readme.txt b/print/SampleOpenXPS/readme.txt new file mode 100644 index 00000000..d294a25b --- /dev/null +++ b/print/SampleOpenXPS/readme.txt @@ -0,0 +1,147 @@ +File Name: SampleOXPS.zip +Version: 1.0 +License: These sample documents are covered by the terms of the OpenXPSTestFiles_EndUserLicenseAgreement.doc file included in this ZIP archive. +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +The sample documents in this ZIP archive were generated from a variety of sources, including those generated from +the Windows Presentation Foundation in WinFX, from Office 2007, from the Microsoft XPS Document Writer (MXDW), and a few +that were either hand-built from scratch or hand-modified from another source. They have been included to provide +you with a few documents that exercise a variety of features of the XML Paper Specification. + +In addition, we have included a few high-quality documents in the Showcase directory to highlight some of the XPS advantages in terms of screen-to-print fidelity. We've also created some documents that are intended to fail, violating at least one conformance rule. These are in the ConformanceViolations directory. + +Comments on various files is denoted following the file beginning with '--'. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +These sample Test Files include: + + +QualityLogicMinBar/ -- Minimum bar test documents provided by Quality Logic + mb01.oxps + mb02.oxps + mb03.oxps + mb04.oxps + mb05.oxps + mb06.oxps + mb07.oxps + mb08.oxps + mb09.oxps + + +ConformanceViolations/ -- All these documents violate one conformance rule. They should fail or generate an error. + MarkupCompatibility/ + M1.1a.oxps -- Unrecognized element from a non-ignorable namespace + M1.2a.oxps -- Unrecognized element from Markup Compatibility namespace + M2.14a.oxps -- ProcessContent referencing an element whose namespace is not also listed as Ignorable + M2.17a.oxps -- Xml:lang attribute on a ProcessContent element + M2.20a.oxps -- PreserveElements attribute with no matching Ignorable attribute + M2.24a.oxps -- PreserveAttributes attribute with no matching Ignorable attribute + M2.27a.oxps -- Non-understood and ignorable namespace also identified in the MustUnderstand attribute value + M2.27b.oxps -- Non-understood namespace identified in the MustUnderstand attribute value + M2.30a.oxps -- AlternateContent element with no Choice child elements + M2.31a.oxps -- AlternateContent element with multiple Fallback child elements + M2.32a.oxps -- AlternateContent element with Fallback child element occurring before Choice child element + M2.33a.oxps -- Nested AlternateContent elements + M2.35a.oxps -- AlternateContent element with unprefixed Ignorable attribute. Namespace identified in Ignorable attribute is used. + M2.35b.oxps -- AlternateContent element with unprefixed Ignorable attribute. Namespace identified in Ignorable attribute is not used. + M2.36a.oxps -- AlternateContent having unrecognized child element that is not ignored + M2.41a.oxps -- Choice element having unrecognized and non-ignored attribute + M2.42a.oxps -- Choice element having MustUnderstand attribute referencing bad namespace + M2.43a.oxps -- Xml:lang attribute on AlternateContent element + M2.44a.oxps -- Choice element missing Requires attribute + M2.48a.oxps -- Choice element having unprefixed attribute other than Requires + M2.49a.oxps -- Xml:lang attribute on Choice element + M2.50a.oxps -- Requires attribute referencing non-understood namespace + M2.52a.oxps -- Prefixed Requires attribute applied to Choice element + M2.55a.oxps -- Unprefixed attribute applied to a Fallback element + M2.56a.oxps -- Xml:lang attribute on Fallback element + + OpenPackagingConvetions/ + M1.1a.oxps -- InvalidZip - Simple Text with empty reference to fdseq and empty fdseq name in zip + M1.2a.oxps -- Simple Text without FPAGE Content Type + M1.2b.oxps -- Simple Text without JPEG Content Type + M1.3a.oxps -- Simple Text with empty segment in PARTNAME in fdseq + M1.5a.oxps -- Simple Text PARTNAME with forward slash as last char + M1.6a.oxps -- Simple Text PARTNAME with nonpchar in fdseq with orig doc name + M1.6b.oxps -- Simple Text PARTNAME with nonpchar in fdseq + M1.7a.oxps -- Simple Text core prop contains fwd slash pct encode and reference also contains pct encode + M1.7b.oxps -- Simple Text PARTNAME contains '%/' + M1.8a.oxps -- Simple Text PARTNAME contains '%c' + M1.10a.oxps -- Simple Text PARTNAME only dot + M1.11a.oxps -- Simple Text Fixed Doc Seq Part contains content type part name + M1.17a.oxps -- Invalid comma token in content type + M1.18a.oxps -- Content Types Leading Whitespace + M1.18b.oxps -- Content Types LWS between type and subtype + M1.20a.oxps -- Simple Text Doc with Content Type including param + M1.22a.oxps -- Simple Text Content Types with ISO encoding + M1.26a.oxps -- Relationship Missing ID + M1.26b.oxps -- Relationship with invalid XML Identifier + M1.26c.oxps -- Relationships with duplicate IDs + M1.27a.oxps -- Relationship with missing Type + M1.28a.oxps -- Relationship with missing Target + M2.5a.oxps -- Content Type with duplicate default elements + M2.5b.oxps -- Content Type with duplicate override elements + M2.6a.oxps -- Content Type with Content Type but no Extension attrib + M2.6b.oxps -- Content Type with Extension but no Content Type attrib + M2.7a.oxps -- Content Type with Override with no ContentType attrib + M2.7b.oxps -- Content Type with Override with no PartName attrib + M2.18a.oxps -- Simple Text with Non-Interleaved as two consecutive parts + M2.24a.oxps -- Simple Text with fdseq converted to single dot char + M3.9a.oxps -- Simple Text with dig sig with Object containing PCDATA + M3.10a.oxps -- Simple Text with dig sig with fragment ident after Content Type + M3.14a.oxps -- Simple Text with dig sig Relationships XForm without Canon XForm + + OXPS/ + M1.2a.oxps -- Package is not a zip archive, it�s plain text instead + M2.3a.oxps -- Missing FixedDocumentSequence part + M2.3b.oxps -- Missing fixedrepresentation relationship + M2.3c.oxps -- Two fixedrepresentation relationships + M2.4a.oxps -- Missing FixedDocument part + M2.4b.oxps -- No <DocumentReference> to a FixedDocument + M2.5a.oxps -- Missing FixedPage part + M2.5b.oxps -- No <PageContent> to FixedPage + M2.6a.oxps -- Missing Font Part + M2.6b.oxps -- Missing FontURI attribute + M2.10a.oxps -- Missing required resource relationship for Font in FixedPage + M2.13a.oxps -- Missing fixedrepresentation relationship + M2.13b.oxps -- Two fixedrepresentation relationships + M2.14a.oxps -- Fixedrepresentation relationship pointing to FixedDocucment + M2.18a.oxps -- Corrupt PNG image + M2.25a.oxps -- Corrupt TIF image + M2.36a.oxps -- FixedPage with 2 thumbnails + M2.37a.oxps -- FixedPage with TIF thumbnail + M2.59a.oxps -- Two PrintTickets related to FixedDocumentSequence + M2.71a.oxps -- DTD in Relationship markup + M2.71b.oxps -- DTD in Content_Types markup + M2.71c.oxps -- DTD in FixedPage markup + M2.73a.oxps -- Xml:id attribute in FixedPage markup + M2.73b.oxps -- Xsi:SchemaLocation attribute on <FixedPage> element + M2.74a.oxps -- <Path> having Fill attrib and <Path.Fill> child element + M2.75a.oxps -- Xml:space attribute on <FixedPage> element + M2.75b.oxps -- Xml:space attribute on <Path> element + M2.76a.oxps -- Invalid value for xml:lang attribute on <FixedPage> element + M2.80.oxps -- <DocumentReference> uses absolute URIs + M2.81.oxps -- <PageContent> uses absolute URIs + M2.82.oxps -- FixedPage part uses absolute URIs + M3.2a.oxps -- <DocucmentReference> Source attribute pointing to Fixed Page instead of FixedDocucment + M3.3a.oxps -- Multiple <DocumentReference> elements pointing to same FixedDocument + M3.5a.oxps -- <PageContent> Source attrib pointing to FixedDocucment instead of FixedPage + M3.6a.oxps -- Multiple <PageContent> elements pointing to the same FixedPage from difference FixedDocuments + M3.6b.oxps -- Multiple <PageContent> elements pointing to same FixedPage (from the same FixedDocument) + M4.3a.oxps -- <PathGeometry> element with Figures attribute and <Path.Figure> child element + M5.2a.oxps -- <Glyphs> with empty UnicodeString attribute and no Indices attribute + M5.2b.oxps -- <Glyphs> with UnicodeString attribute that contains �{}� and no Indices attribute + M5.4a.oxps -- <Glyphs> with an Indices attribute that contains an invalid Glyph Index for the specified font + M5.4b.oxps -- <Glyphs> that has more entries in the indices attribute than the UnicodeString attribute + M5.7a.oxps -- <Glyphs> that has a UnicodeString attribute that starts with '{' + M5.15a.oxps -- <Glyphs> that has both BidiLevel and isSideways attributes + M6.2a.oxps -- <ImageBrush> with x:Key attribute not in a <ResourceDictionary> + M6.3a.oxps -- <ImageBrush> that references a font part + M7.5a.oxps -- Remote resource dictionary that references another remote resource dictionary + M12.2a.oxps -- 2 references to the same FixedDocument + M12.3b.oxps -- FixedPage that is referenced twice from the same FixedDocuments + M12.5a.oxps -- FixedDocumentSequence with two PrintTickets + M12.7a.oxps -- ContentType attribute containing a Parameter (ContentType=�image/jpeg;q=0�) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\ No newline at end of file diff --git a/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj b/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj new file mode 100644 index 00000000..b7b96fa8 --- /dev/null +++ b/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj @@ -0,0 +1,141 @@ +<?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="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{D2B639CE-AC86-49E5-82A5-0754C41CE7C2}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + <SupportsPackaging>false</SupportsPackaging> + <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <SampleGuid>{940BB686-F68A-4FA7-B9AC-441E0AA3E7D6}</SampleGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <OutDir>$(IntDir)</OutDir> + </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </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')" /> + </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')" /> + </ImportGroup> + <ItemGroup Label="WrappedTaskItems" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>BlankProject</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>BlankProject</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>BlankProject</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>BlankProject</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + <Link> + <NoEntryPoint>true</NoEntryPoint> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + <Link> + <NoEntryPoint>true</NoEntryPoint> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + <Link> + <NoEntryPoint>true</NoEntryPoint> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + <Link> + <NoEntryPoint>true</NoEntryPoint> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <Inf Exclude="@(Inf)" Include="*.inf" /> + <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> + </ItemGroup> + <ItemGroup> + <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> + <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> + <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> + </ItemGroup> + <ItemGroup> + <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project>
\ No newline at end of file diff --git a/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj.Filters b/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj.Filters new file mode 100644 index 00000000..fd3edb1a --- /dev/null +++ b/print/SampleXPS/BlankProjSrc/BlankProject.vcxproj.Filters @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> + <UniqueIdentifier>{4B942DCE-1A35-4E9F-A667-4A78801DCCB2}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + <UniqueIdentifier>{F50DDDBE-9690-4E91-B1BC-32FA17D99E70}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> + <UniqueIdentifier>{9F0418C7-D852-4109-8654-6A18AD8318D1}</UniqueIdentifier> + </Filter> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.1a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.1a.xps Binary files differnew file mode 100644 index 00000000..c32c6403 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.1a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.2a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.2a.xps Binary files differnew file mode 100644 index 00000000..48bd6490 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M1.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.13a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.13a.xps Binary files differnew file mode 100644 index 00000000..f5f1ac2f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.13a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.14a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.14a.xps Binary files differnew file mode 100644 index 00000000..538f9e59 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.14a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.17a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.17a.xps Binary files differnew file mode 100644 index 00000000..023790ec --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.17a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.20a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.20a.xps Binary files differnew file mode 100644 index 00000000..dd55104c --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.20a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.24a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.24a.xps Binary files differnew file mode 100644 index 00000000..0ba82cb8 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.24a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27a.xps Binary files differnew file mode 100644 index 00000000..3bc52c0c --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27b.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27b.xps Binary files differnew file mode 100644 index 00000000..87fa16b3 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.27b.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.30a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.30a.xps Binary files differnew file mode 100644 index 00000000..2828247f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.30a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.31a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.31a.xps Binary files differnew file mode 100644 index 00000000..f046b027 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.31a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.32a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.32a.xps Binary files differnew file mode 100644 index 00000000..fd60c9c3 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.32a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.33a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.33a.xps Binary files differnew file mode 100644 index 00000000..76ecf75e --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.33a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35a.xps Binary files differnew file mode 100644 index 00000000..8c8483dc --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35b.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35b.xps Binary files differnew file mode 100644 index 00000000..5d98e244 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.35b.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.36a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.36a.xps Binary files differnew file mode 100644 index 00000000..6f77126d --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.36a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.41a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.41a.xps Binary files differnew file mode 100644 index 00000000..34ee4f7d --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.41a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.42a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.42a.xps Binary files differnew file mode 100644 index 00000000..3cb183e0 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.42a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.43a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.43a.xps Binary files differnew file mode 100644 index 00000000..69ecfb7a --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.43a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.44a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.44a.xps Binary files differnew file mode 100644 index 00000000..d0875741 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.44a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.48a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.48a.xps Binary files differnew file mode 100644 index 00000000..d0478fe8 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.48a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.49a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.49a.xps Binary files differnew file mode 100644 index 00000000..11a06bb0 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.49a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.50a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.50a.xps Binary files differnew file mode 100644 index 00000000..58edc94f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.50a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.52a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.52a.xps Binary files differnew file mode 100644 index 00000000..91ae6a0f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.52a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.55a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.55a.xps Binary files differnew file mode 100644 index 00000000..b89e6f3e --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.55a.xps diff --git a/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.56a.xps b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.56a.xps Binary files differnew file mode 100644 index 00000000..96723169 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/MarkupCompatibility/M2.56a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.10a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.10a.xps Binary files differnew file mode 100644 index 00000000..413b8ce8 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.10a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.11a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.11a.xps Binary files differnew file mode 100644 index 00000000..aa8f754c --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.11a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.17a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.17a.xps Binary files differnew file mode 100644 index 00000000..ae7640fb --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.17a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18a.xps Binary files differnew file mode 100644 index 00000000..8b682539 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18b.xps Binary files differnew file mode 100644 index 00000000..b1291f17 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.18b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1a.xps Binary files differnew file mode 100644 index 00000000..cf92a350 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1b.xps Binary files differnew file mode 100644 index 00000000..568f188e --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.1b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.20a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.20a.xps Binary files differnew file mode 100644 index 00000000..84c5263b --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.20a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26a.xps Binary files differnew file mode 100644 index 00000000..0f2ca598 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26b.xps Binary files differnew file mode 100644 index 00000000..0bd649d5 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26c.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26c.xps Binary files differnew file mode 100644 index 00000000..17c7bcc5 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.26c.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.27a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.27a.xps Binary files differnew file mode 100644 index 00000000..bb352cce --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.27a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.28a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.28a.xps Binary files differnew file mode 100644 index 00000000..606b7913 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.28a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2a.xps Binary files differnew file mode 100644 index 00000000..44c799ab --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2b.xps Binary files differnew file mode 100644 index 00000000..1a27e88a --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.2b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.34a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.34a.xps Binary files differnew file mode 100644 index 00000000..b054bbe9 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.34a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.3a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.3a.xps Binary files differnew file mode 100644 index 00000000..597de9ed --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.3a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.5a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.5a.xps Binary files differnew file mode 100644 index 00000000..30da6c1f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.5a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6a.xps Binary files differnew file mode 100644 index 00000000..1dcebd8a --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6b.xps Binary files differnew file mode 100644 index 00000000..b52b7acc --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.6b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7a.xps Binary files differnew file mode 100644 index 00000000..f6746cd0 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7c.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7c.xps Binary files differnew file mode 100644 index 00000000..6bd60336 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.7c.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.8a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.8a.xps Binary files differnew file mode 100644 index 00000000..e3f75acf --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M1.8a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.18a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.18a.xps Binary files differnew file mode 100644 index 00000000..6670b2f0 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.18a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.24a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.24a.xps Binary files differnew file mode 100644 index 00000000..4198d1f8 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.24a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5a.xps Binary files differnew file mode 100644 index 00000000..32d09c18 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5b.xps Binary files differnew file mode 100644 index 00000000..53ae6333 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.5b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6a.xps Binary files differnew file mode 100644 index 00000000..e48d3250 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6b.xps Binary files differnew file mode 100644 index 00000000..50e0193f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.6b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7a.xps Binary files differnew file mode 100644 index 00000000..5ceb15a3 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7b.xps Binary files differnew file mode 100644 index 00000000..f8278ecb --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M2.7b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10a.xps Binary files differnew file mode 100644 index 00000000..477c0183 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10b.xps Binary files differnew file mode 100644 index 00000000..31ac45f5 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10c.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10c.xps Binary files differnew file mode 100644 index 00000000..b4eecdfd --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.10c.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11a.xps Binary files differnew file mode 100644 index 00000000..995040b6 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11b.xps Binary files differnew file mode 100644 index 00000000..64a8af21 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.11b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12a.xps Binary files differnew file mode 100644 index 00000000..498fe5cd --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12b.xps Binary files differnew file mode 100644 index 00000000..ebca085e --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.12b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.13a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.13a.xps Binary files differnew file mode 100644 index 00000000..5ec3479f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.13a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.14a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.14a.xps Binary files differnew file mode 100644 index 00000000..ab717318 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.14a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.15a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.15a.xps Binary files differnew file mode 100644 index 00000000..35dea693 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.15a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.16a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.16a.xps Binary files differnew file mode 100644 index 00000000..4d8ac00d --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.16a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17a.xps Binary files differnew file mode 100644 index 00000000..7cbf5580 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17b.xps Binary files differnew file mode 100644 index 00000000..97876410 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.17b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.18a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.18a.xps Binary files differnew file mode 100644 index 00000000..f81fe6f2 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.18a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1a.xps Binary files differnew file mode 100644 index 00000000..a425eff9 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1b.xps Binary files differnew file mode 100644 index 00000000..052c570b --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.1b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.20a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.20a.xps Binary files differnew file mode 100644 index 00000000..5ec3479f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.20a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21a.xps Binary files differnew file mode 100644 index 00000000..7bb049e6 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21b.xps Binary files differnew file mode 100644 index 00000000..c1d6f3b4 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.21b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.25a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.25a.xps Binary files differnew file mode 100644 index 00000000..08c33e3d --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.25a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.26a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.26a.xps Binary files differnew file mode 100644 index 00000000..8a05d7b7 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.26a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.28a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.28a.xps Binary files differnew file mode 100644 index 00000000..18ccf0d9 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.28a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.29a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.29a.xps Binary files differnew file mode 100644 index 00000000..9f4dede8 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.29a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.2a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.2a.xps Binary files differnew file mode 100644 index 00000000..43d3896e --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31a.xps Binary files differnew file mode 100644 index 00000000..63134db2 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31b.xps Binary files differnew file mode 100644 index 00000000..d4b716da --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.31b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32a.xps Binary files differnew file mode 100644 index 00000000..d1adc199 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32b.xps Binary files differnew file mode 100644 index 00000000..5bbf1e0e --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.32b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4a.xps Binary files differnew file mode 100644 index 00000000..ec57c709 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4b.xps Binary files differnew file mode 100644 index 00000000..6eb0d1ce --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.4b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.5a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.5a.xps Binary files differnew file mode 100644 index 00000000..6593e647 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.5a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.6a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.6a.xps Binary files differnew file mode 100644 index 00000000..ed36762e --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.6a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.7a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.7a.xps Binary files differnew file mode 100644 index 00000000..c7af760c --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.7a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.8a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.8a.xps Binary files differnew file mode 100644 index 00000000..342b5ced --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.8a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9a.xps Binary files differnew file mode 100644 index 00000000..ef42bb32 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9b.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9b.xps Binary files differnew file mode 100644 index 00000000..6dbd62c6 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9b.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9c.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9c.xps Binary files differnew file mode 100644 index 00000000..d791407a --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M3.9c.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.1a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.1a.xps Binary files differnew file mode 100644 index 00000000..abac7f24 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.1a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.2a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.2a.xps Binary files differnew file mode 100644 index 00000000..e3f75acf --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.3a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.3a.xps Binary files differnew file mode 100644 index 00000000..60e7330f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M4.3a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.1a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.1a.xps Binary files differnew file mode 100644 index 00000000..05e660a0 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.1a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.2a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.2a.xps Binary files differnew file mode 100644 index 00000000..544d2978 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.4a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.4a.xps Binary files differnew file mode 100644 index 00000000..942f4003 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.4a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.6a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.6a.xps Binary files differnew file mode 100644 index 00000000..42cf8e0e --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.6a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.7a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.7a.xps Binary files differnew file mode 100644 index 00000000..e71811e5 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.7a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.8a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.8a.xps Binary files differnew file mode 100644 index 00000000..07219ea1 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M6.8a.xps diff --git a/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M7.2a.xps b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M7.2a.xps Binary files differnew file mode 100644 index 00000000..7d0b1036 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/OpenPackagingConventions/M7.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M1.2a.xps b/print/SampleXPS/ConformanceViolations/XPS/M1.2a.xps Binary files differnew file mode 100644 index 00000000..aa0aab99 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M1.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M12.2a.xps b/print/SampleXPS/ConformanceViolations/XPS/M12.2a.xps Binary files differnew file mode 100644 index 00000000..37b7f4a9 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M12.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M12.3b.xps b/print/SampleXPS/ConformanceViolations/XPS/M12.3b.xps Binary files differnew file mode 100644 index 00000000..dd3cd57e --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M12.3b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M12.5a.xps b/print/SampleXPS/ConformanceViolations/XPS/M12.5a.xps Binary files differnew file mode 100644 index 00000000..a559be55 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M12.5a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M12.7a.xps b/print/SampleXPS/ConformanceViolations/XPS/M12.7a.xps Binary files differnew file mode 100644 index 00000000..af87d904 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M12.7a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.10a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.10a.xps Binary files differnew file mode 100644 index 00000000..5a589bb1 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.10a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.13a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.13a.xps Binary files differnew file mode 100644 index 00000000..08dd879f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.13a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.13b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.13b.xps Binary files differnew file mode 100644 index 00000000..cb9c951e --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.13b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.14a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.14a.xps Binary files differnew file mode 100644 index 00000000..5b2d29ef --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.14a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.18a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.18a.xps Binary files differnew file mode 100644 index 00000000..918a5b84 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.18a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.25a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.25a.xps Binary files differnew file mode 100644 index 00000000..64cb6df8 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.25a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.36a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.36a.xps Binary files differnew file mode 100644 index 00000000..cc56b711 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.36a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.37a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.37a.xps Binary files differnew file mode 100644 index 00000000..6832246f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.37a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.3a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.3a.xps Binary files differnew file mode 100644 index 00000000..36faa225 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.3a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.3b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.3b.xps Binary files differnew file mode 100644 index 00000000..a04712b7 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.3b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.3c.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.3c.xps Binary files differnew file mode 100644 index 00000000..61417822 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.3c.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.4a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.4a.xps Binary files differnew file mode 100644 index 00000000..a2b7b46b --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.4a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.4b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.4b.xps Binary files differnew file mode 100644 index 00000000..6ba3ba3d --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.4b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.59a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.59a.xps Binary files differnew file mode 100644 index 00000000..4ed69dc3 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.59a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.5a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.5a.xps Binary files differnew file mode 100644 index 00000000..284cdf99 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.5a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.5b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.5b.xps Binary files differnew file mode 100644 index 00000000..c2779265 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.5b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.6a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.6a.xps Binary files differnew file mode 100644 index 00000000..2b311786 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.6a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.6b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.6b.xps Binary files differnew file mode 100644 index 00000000..a7af6881 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.6b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.71a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.71a.xps Binary files differnew file mode 100644 index 00000000..d2fd6911 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.71a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.71b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.71b.xps Binary files differnew file mode 100644 index 00000000..8e129faf --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.71b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.71c.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.71c.xps Binary files differnew file mode 100644 index 00000000..6fcf2746 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.71c.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.73a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.73a.xps Binary files differnew file mode 100644 index 00000000..3724f3f2 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.73a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.73b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.73b.xps Binary files differnew file mode 100644 index 00000000..cb492cde --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.73b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.74a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.74a.xps Binary files differnew file mode 100644 index 00000000..754a1dac --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.74a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.75a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.75a.xps Binary files differnew file mode 100644 index 00000000..e60d1999 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.75a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.75b.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.75b.xps Binary files differnew file mode 100644 index 00000000..afb8579f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.75b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M2.76a.xps b/print/SampleXPS/ConformanceViolations/XPS/M2.76a.xps Binary files differnew file mode 100644 index 00000000..70dcad6a --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M2.76a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M3.2a.xps b/print/SampleXPS/ConformanceViolations/XPS/M3.2a.xps Binary files differnew file mode 100644 index 00000000..974c52c8 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M3.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M3.3a.xps b/print/SampleXPS/ConformanceViolations/XPS/M3.3a.xps Binary files differnew file mode 100644 index 00000000..2d5f0f4c --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M3.3a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M3.5a.xps b/print/SampleXPS/ConformanceViolations/XPS/M3.5a.xps Binary files differnew file mode 100644 index 00000000..7471ee04 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M3.5a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M3.6a.xps b/print/SampleXPS/ConformanceViolations/XPS/M3.6a.xps Binary files differnew file mode 100644 index 00000000..0a2ec5ec --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M3.6a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M3.6b.xps b/print/SampleXPS/ConformanceViolations/XPS/M3.6b.xps Binary files differnew file mode 100644 index 00000000..3c353b55 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M3.6b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M4.3a.xps b/print/SampleXPS/ConformanceViolations/XPS/M4.3a.xps Binary files differnew file mode 100644 index 00000000..dbceda8b --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M4.3a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.15a.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.15a.xps Binary files differnew file mode 100644 index 00000000..1cea3661 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M5.15a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.2a.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.2a.xps Binary files differnew file mode 100644 index 00000000..abf74ae2 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M5.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.2b.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.2b.xps Binary files differnew file mode 100644 index 00000000..b3f2559d --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M5.2b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.4a.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.4a.xps Binary files differnew file mode 100644 index 00000000..44f206c0 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M5.4a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.4b.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.4b.xps Binary files differnew file mode 100644 index 00000000..77596f04 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M5.4b.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M5.7a.xps b/print/SampleXPS/ConformanceViolations/XPS/M5.7a.xps Binary files differnew file mode 100644 index 00000000..72860767 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M5.7a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M6.2a.xps b/print/SampleXPS/ConformanceViolations/XPS/M6.2a.xps Binary files differnew file mode 100644 index 00000000..7c64d19f --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M6.2a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M6.3a.xps b/print/SampleXPS/ConformanceViolations/XPS/M6.3a.xps Binary files differnew file mode 100644 index 00000000..b62a394a --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M6.3a.xps diff --git a/print/SampleXPS/ConformanceViolations/XPS/M7.5a.xps b/print/SampleXPS/ConformanceViolations/XPS/M7.5a.xps Binary files differnew file mode 100644 index 00000000..93b14d89 --- /dev/null +++ b/print/SampleXPS/ConformanceViolations/XPS/M7.5a.xps diff --git a/print/SampleXPS/QualityLogicMinBar/mb01.xps b/print/SampleXPS/QualityLogicMinBar/mb01.xps Binary files differnew file mode 100644 index 00000000..138c8594 --- /dev/null +++ b/print/SampleXPS/QualityLogicMinBar/mb01.xps diff --git a/print/SampleXPS/QualityLogicMinBar/mb02.xps b/print/SampleXPS/QualityLogicMinBar/mb02.xps Binary files differnew file mode 100644 index 00000000..ed09e1ef --- /dev/null +++ b/print/SampleXPS/QualityLogicMinBar/mb02.xps diff --git a/print/SampleXPS/QualityLogicMinBar/mb03.xps b/print/SampleXPS/QualityLogicMinBar/mb03.xps Binary files differnew file mode 100644 index 00000000..2739c036 --- /dev/null +++ b/print/SampleXPS/QualityLogicMinBar/mb03.xps diff --git a/print/SampleXPS/QualityLogicMinBar/mb04.xps b/print/SampleXPS/QualityLogicMinBar/mb04.xps Binary files differnew file mode 100644 index 00000000..0287b040 --- /dev/null +++ b/print/SampleXPS/QualityLogicMinBar/mb04.xps diff --git a/print/SampleXPS/QualityLogicMinBar/mb05.xps b/print/SampleXPS/QualityLogicMinBar/mb05.xps Binary files differnew file mode 100644 index 00000000..225eed4e --- /dev/null +++ b/print/SampleXPS/QualityLogicMinBar/mb05.xps diff --git a/print/SampleXPS/QualityLogicMinBar/mb06.xps b/print/SampleXPS/QualityLogicMinBar/mb06.xps Binary files differnew file mode 100644 index 00000000..39b38a71 --- /dev/null +++ b/print/SampleXPS/QualityLogicMinBar/mb06.xps diff --git a/print/SampleXPS/QualityLogicMinBar/mb07.xps b/print/SampleXPS/QualityLogicMinBar/mb07.xps Binary files differnew file mode 100644 index 00000000..c844d85f --- /dev/null +++ b/print/SampleXPS/QualityLogicMinBar/mb07.xps diff --git a/print/SampleXPS/QualityLogicMinBar/mb08.xps b/print/SampleXPS/QualityLogicMinBar/mb08.xps Binary files differnew file mode 100644 index 00000000..2b2146f1 --- /dev/null +++ b/print/SampleXPS/QualityLogicMinBar/mb08.xps diff --git a/print/SampleXPS/QualityLogicMinBar/mb09.xps b/print/SampleXPS/QualityLogicMinBar/mb09.xps Binary files differnew file mode 100644 index 00000000..12470ceb --- /dev/null +++ b/print/SampleXPS/QualityLogicMinBar/mb09.xps diff --git a/print/SampleXPS/ReadMe.md b/print/SampleXPS/ReadMe.md new file mode 100644 index 00000000..18a242bb --- /dev/null +++ b/print/SampleXPS/ReadMe.md @@ -0,0 +1,7 @@ +XPS Documents Print Sample +========================== + +This sample is a set of documents that were generated from a variety of sources, including those generated from the Windows Presentation Foundation in the .NET Framework, from Office 2007, and from the Microsoft XPS Document Writer (MXDW). The set of documents also includes documents that were either hand-built from scratch or hand-modified from another source. They have been included to provide you with a few documents that exercise a variety of features of the XML Paper Specification. + +In addition, a few high-quality documents have been provided in the Showcase directory to highlight some of the XPS advantages in terms of screen-to-print fidelity. There are also some documents that are intended to fail by violating at least one conformance rule. These are in the ConformanceViolations directory. For information about XPS in Windows, see [XPS Printing Features](http://msdn.microsoft.com/en-us/library/windows/hardware/ff564299(v=vs.85).aspx). + diff --git a/print/SampleXPS/SampleXPS.sln b/print/SampleXPS/SampleXPS.sln new file mode 100644 index 00000000..7653b4c4 --- /dev/null +++ b/print/SampleXPS/SampleXPS.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlankProject", "BlankProjSrc\BlankProject.vcxproj", "{D2B639CE-AC86-49E5-82A5-0754C41CE7C2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D2B639CE-AC86-49E5-82A5-0754C41CE7C2}.Debug|Win32.ActiveCfg = Debug|Win32 + {D2B639CE-AC86-49E5-82A5-0754C41CE7C2}.Debug|Win32.Build.0 = Debug|Win32 + {D2B639CE-AC86-49E5-82A5-0754C41CE7C2}.Release|Win32.ActiveCfg = Release|Win32 + {D2B639CE-AC86-49E5-82A5-0754C41CE7C2}.Release|Win32.Build.0 = Release|Win32 + {D2B639CE-AC86-49E5-82A5-0754C41CE7C2}.Debug|x64.ActiveCfg = Debug|x64 + {D2B639CE-AC86-49E5-82A5-0754C41CE7C2}.Debug|x64.Build.0 = Debug|x64 + {D2B639CE-AC86-49E5-82A5-0754C41CE7C2}.Release|x64.ActiveCfg = Release|x64 + {D2B639CE-AC86-49E5-82A5-0754C41CE7C2}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/print/SampleXPS/XPSTestFiles_EndUserLicenseAgreement.txt b/print/SampleXPS/XPSTestFiles_EndUserLicenseAgreement.txt new file mode 100644 index 00000000..2e90e5d7 --- /dev/null +++ b/print/SampleXPS/XPSTestFiles_EndUserLicenseAgreement.txt @@ -0,0 +1,7 @@ +END-USER LICENSE AGREEMENT +IMPORTANT�READ CAREFULLY: This Microsoft End-User License Agreement (�EULA�) is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation (�Microsoft�) for Test Files owned by Microsoft and identified below. By installing, copying, or otherwise using the Test Files, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, you may not install or use the Test Files. + +Microsoft owns a library of sample XML Paper Specification (�XPS�) files, which Microsoft created for testing features of the XPS format (the �Test Files�). The Test Files are protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. This is a license, not a sale, of the Test Files. +1. GRANT OF LICENSE. Microsoft grants to you as an individual, a personal, nonexclusive, and limited license to make and use copies of the Test Files on any number of computers residing on your premises for the sole purpose of developing and testing your software and/or hardware products. These license rights are conditioned on your compliance with the license restrictions and requirements described below. +2. TERMINATION. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. +3. DISCLAIMER OF WARRANTIES. To the maximum extent permitted by applicable law, Microsoft provides the Test Files AS IS AND WITH ALL FAULTS, and hereby disclaim all warranties and conditions, either express, implied or statutory, including, but not limited to, any (if any) implied warranties or conditions of merchantability, of fitness for a particular purpose, of lack of viruses, of accuracy or completeness of responses, of results, and of lack of negligence or lack of workmanlike effort, all with regard to the Test Files. ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT, WITH REGARD TO THE TEST FILES. THE ENTIRE RISK AS TO THE QUALITY OF OR ARISING OUT OF USE OR PERFORMANCE OF THE SAMPLE CODE, IF ANY, REMAINS WITH YOU. diff --git a/print/SampleXPS/readme.txt b/print/SampleXPS/readme.txt new file mode 100644 index 00000000..0a5ebab3 --- /dev/null +++ b/print/SampleXPS/readme.txt @@ -0,0 +1,190 @@ +File Name: SampleXps.zip +Version: 1.0 +License: These sample documents are covered by the terms of the XPSTestFiles_EndUserLicenseAgreement.doc file included in this ZIP archive. +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +The sample documents in this ZIP archive were generated from a variety of sources, including those generated from +the Windows Presentation Foundation in WinFX, from Office 2007, from the Microsoft XPS Document Writer (MXDW), and a few +that were either hand-built from scratch or hand-modified from another source. They have been included to provide +you with a few documents that exercise a variety of features of the XML Paper Specification. + +In addition, we have included a few high-quality documents in the Showcase directory to highlight some of the XPS advantages in terms of screen-to-print fidelity. We've also created some documents that are intended to fail, violating at least one conformance rule. These are in the ConformanceViolations directory. + +Comments on various files is denoted following the file beginning with '--'. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +These sample Test Files include: + + +QualityLogicMinBar/ -- Minimum bar test documents provided by Quality Logic + mb01.xps + mb02.xps + mb03.xps + mb04.xps + mb05.xps + mb06.xps + mb07.xps + mb08.xps + mb09.xps + + +ConformanceViolations/ -- All these documents violate one conformance rule. They should fail or generate an error. + MarkupCompatibility/ + M1.1a.xps -- Unrecognized element from a non-ignorable namespace + M1.2a.xps -- Unrecognized element from Markup Compatibility namespace + M2.13a.xps -- ProcessContent attribute on an element without an Ignorable attribute + M2.14a.xps -- ProcessContent referencing an element whose namespace is not also listed as Ignorable + M2.17a.xps -- Xml:lang attribute on a ProcessContent element + M2.20a.xps -- PreserveElements attribute with no matching Ignorable attribute + M2.24a.xps -- PreserveAttributes attribute with no matching Ignorable attribute + M2.27a.xps -- Non-understood and ignorable namespace also identified in the MustUnderstand attribute value + M2.27b.xps -- Non-understood namespace identified in the MustUnderstand attribute value + M2.30a.xps -- AlternateContent element with no Choice child elements + M2.31a.xps -- AlternateContent element with multiple Fallback child elements + M2.32a.xps -- AlternateContent element with Fallback child element occurring before Choice child element + M2.33a.xps -- Nested AlternateContent elements + M2.35a.xps -- AlternateContent element with unprefixed Ignorable attribute. Namespace identified in Ignorable attribute is used. + M2.35b.xps -- AlternateContent element with unprefixed Ignorable attribute. Namespace identified in Ignorable attribute is not used. + M2.36a.xps -- AlternateContent having unrecognized child element that is not ignored + M2.41a.xps -- Choice element having unrecognized and non-ignored attribute + M2.42a.xps -- Choice element having MustUnderstand attribute referencing bad namespace + M2.43a.xps -- Xml:lang attribute on AlternateContent element + M2.44a.xps -- Choice element missing Requires attribute + M2.48a.xps -- Choice element having unprefixed attribute other than Requires + M2.49a.xps -- Xml:lang attribute on Choice element + M2.50a.xps -- Requires attribute referencing non-understood namespace + M2.52a.xps -- Prefixed Requires attribute applied to Choice element + M2.55a.xps -- Unprefixed attribute applied to a Fallback element + M2.56a.xps -- Xml:lang attribute on Fallback element + + OpenPackagingConvetions/ + M1.1a.xps -- InvalidZip - Simple Text with empty reference to fdseq and empty fdseq name in zip + M1.1b.xps -- Simple Text without PARTNAME in fdseq + M1.2a.xps -- Simple Text without FPAGE Content Type + M1.2b.xps -- Simple Text without JPEG Content Type + M1.3a.xps -- Simple Text with empty segment in PARTNAME in fdseq + M1.5a.xps -- Simple Text PARTNAME with forward slash as last char + M1.6a.xps -- Simple Text PARTNAME with nonpchar in fdseq with orig doc name + M1.6b.xps -- Simple Text PARTNAME with nonpchar in fdseq + M1.7a.xps -- Simple Text core prop contains fwd slash pct encode and reference also contains pct encode + M1.7c.xps -- Simple Text PARTNAME contains '%/' + M1.8a.xps -- Simple Text PARTNAME contains '%c' + M1.10a.xps -- Simple Text PARTNAME only dot + M1.11a.xps -- Simple Text Fixed Doc Seq Part contains content type part name + M1.17a.xps -- Invalid comma token in content type + M1.18a.xps -- Content Types Leading Whitespace + M1.18b.xps -- Content Types LWS between type and subtype + M1.20a.xps -- Simple Text Doc with Content Type including param + M1.22a.xps -- Simple Text Content Types with ISO encoding + M1.26a.xps -- Relationship Missing ID + M1.26b.xps -- Relationship with invalid XML Identifier + M1.26c.xps -- Relationships with duplicate IDs + M1.27a.xps -- Relationship with missing Type + M1.28a.xps -- Relationship with missing Target + M2.5a.xps -- Content Type with duplicate default elements + M2.5b.xps -- Content Type with duplicate override elements + M2.6a.xps -- Content Type with Content Type but no Extension attrib + M2.6b.xps -- Content Type with Extension but no Content Type attrib + M2.7a.xps -- Content Type with Override with no ContentType attrib + M2.7b.xps -- Content Type with Override with no PartName attrib + M2.18a.xps -- Simple Text with Non-Interleaved as two consecutive parts + M2.24a.xps -- Simple Text with fdseq converted to single dot char + M3.1a.xps -- Simple Text Doc with core props relationship pointing to thumbnail + M3.1b.xps -- Simple Text Doc with two core props relationships + M3.2a.xps -- Simple Text Core Prop Part with Markup Compat + M3.4a.xps -- Simple Text with dig sig containing 2 dig sig origin parts + M3.4b.xps -- Simple Text with Dig Sig missing relationship to Dig Sig Origin + M3.5a.xps -- Simple Text with Dig Sig with no rel from dig sig orig to dig sig part + M3.6a.xps -- Simple Text with dig sig with no relationship to cert + M3.7a.xps -- Simple Text with dig sig ref with bad fragment identifier + M3.8a.xps -- Simple Text with dig sig with 2 Object Elements + M3.9a.xps -- Simple Text with dig sig with Object containing PCDATA + M3.9b.xps -- Simple Text with dig sig with Object containing Signature + M3.9c.xps -- Simple Text with dig sig with Sig Value in Object Element + M3.10a.xps -- Simple Text with dig sig with fragment ident after Content Type + M3.10b.xps -- Simple Text with dig sig with fragment ident right after URI + M3.10c.xps -- Simple Text with dig sig with reference to external part + M3.11a.xps -- Simple Text with Dig sig with ref query content type with bad content + M3.11b.xps -- Simple Text with Dig Sig with Ref query with missing Content Type + M3.12a.xps -- Simple Text with Dig Sig with Content Type not case matching + M3.12b.xps -- Simple Text with dig sig with mismatched Reference Content Type + M3.13a.xps -- Simple Text with dig sig Reference with unknown XForm + M3.14a.xps -- Simple Text with dig sig Relationships XForm without Canon XForm + M3.15a.xps -- Simple Text with dig sig with Signature Prop with no Sig Time + M3.16a.xps -- Simple Text with dig sig with no Objects + M3.17a.xps -- Simple Text with dig sig Signed Info missing Ref + M3.17b.xps -- Simple Text with dig sig signedinfo with ref to incorrect object + M3.18a.xps -- Simple Text with dig sig with bad algorithm + M3.20a.xps -- Simple Text with dig sig Reference with unknown XForm + M3.21a.xps -- Simple Text with dig sig with Manifest Object with no DigestMethod + M3.21b.xps -- Simple Text with dig sig with no DigestMethod in Package object + M3.25a.xps -- Simple Text with dig sig with Time format not compat with w3c + M3.26a.xps -- Simple Text with dig sig with value element not matching format + M3.28a.xps -- Simple Text with dig sig relation xform after canon xform + M3.29a.xps -- Simple Text with dig sig with Relation xform having SourceType with case sensitive mismatch + M3.31a.xps -- Simple Text with dig sig with DigestValue in Object Ref Descendant mismatch + M3.31b.xps -- Simple Text with dig sig with DigestValue in Object Ref Descendant too long. + M3.32a.xps -- Simple Text with dig sig with Bad DigestValue in Signed Info - Too long + M3.32b.xps -- Simple Text with dig sig with Bad DigestValue in Signed Info � Wrong + M4.1a.xps -- Simple Text with bad URI reference + M4.2a.xps -- Simple Text PARTNAME contains '%c' + M4.3a.xps -- Simple Text with percent encoding + M6.1a.xps -- Simple Text with mismatch filename length + M6.2a.xps -- Simple Text with invalid file name length + M6.4a.xps -- Simple Text with unsupported compression method + M6.6a.xps -- Simple Text with general purpose bit flag specifying files are encrypted + M6.7a.xps -- Simple Text with offset of central directory equal to unsigned int max + M6.8a.xps -- Simple Text with Total number of entries in central directory more than maxint + M7.2a.xps -- Simple Text DC with xml:lang attrib + + XPS/ + M1.2a.xps -- Package is not a zip archive, it�s plain text instead + M2.3a.xps -- Missing FixedDocumentSequence part + M2.3b.xps -- Missing fixedrepresentation relationship + M2.3c.xps -- Two fixedrepresentation relationships + M2.4a.xps -- Missing FixedDocument part + M2.4b.xps -- No <DocumentReference> to a FixedDocument + M2.5a.xps -- Missing FixedPage part + M2.5b.xps -- No <PageContent> to FixedPage + M2.6a.xps -- Missing Font Part + M2.6b.xps -- Missing FontURI attribute + M2.10a.xps -- Missing required resource relationship for Font in FixedPage + M2.13a.xps -- Missing fixedrepresentation relationship + M2.13b.xps -- Two fixedrepresentation relationships + M2.14a.xps -- Fixedrepresentation relationship pointing to FixedDocucment + M2.18a.xps -- Corrupt PNG image + M2.25a.xps -- Corrupt TIF image + M2.36a.xps -- FixedPage with 2 thumbnails + M2.37a.xps -- FixedPage with TIF thumbnail + M2.59a.xps -- Two PrintTickets related to FixedDocumentSequence + M2.71a.xps -- DTD in Relationship markup + M2.71b.xps -- DTD in Content_Types markup + M2.71c.xps -- DTD in FixedPage markup + M2.73a.xps -- Xml:id attribute in FixedPage markup + M2.73b.xps -- Xsi:SchemaLocation attribute on <FixedPage> element + M2.74a.xps -- <Path> having Fill attrib and <Path.Fill> child element + M2.75a.xps -- Xml:space attribute on <FixedPage> element + M2.75b.xps -- Xml:space attribute on <Path> element + M2.76a.xps -- Invalid value for xml:lang attribute on <FixedPage> element + M3.2a.xps -- <DocucmentReference> Source attribute pointing to Fixed Page instead of FixedDocucment + M3.3a.xps -- Multiple <DocumentReference> elements pointing to same FixedDocument + M3.5a.xps -- <PageContent> Source attrib pointing to FixedDocucment instead of FixedPage + M3.6a.xps -- Multiple <PageContent> elements pointing to the same FixedPage from difference FixedDocuments + M3.6b.xps -- Multiple <PageContent> elements pointing to same FixedPage (from the same FixedDocument) + M4.3a.xps -- <PathGeometry> element with Figures attribute and <Path.Figure> child element + M5.2a.xps -- <Glyphs> with empty UnicodeString attribute and no Indices attribute + M5.2b.xps -- <Glyphs> with UnicodeString attribute that contains �{}� and no Indices attribute + M5.4a.xps -- <Glyphs> with an Indices attribute that contains an invalid Glyph Index for the specified font + M5.4b.xps -- <Glyphs> that has more entries in the indices attribute than the UnicodeString attribute + M5.7a.xps -- <Glyphs> that has a UnicodeString attribute that starts with '{' + M5.15a.xps -- <Glyphs> that has both BidiLevel and isSideways attributes + M6.2a.xps -- <ImageBrush> with x:Key attribute not in a <ResourceDictionary> + M6.3a.xps -- <ImageBrush> that references a font part + M7.5a.xps -- Remote resource dictionary that references another remote resource dictionary + M12.2a.xps -- 2 references to the same FixedDocument + M12.3b.xps -- FixedPage that is referenced twice from the same FixedDocuments + M12.5a.xps -- FixedDocumentSequence with two PrintTickets + M12.7a.xps -- ContentType attribute containing a Parameter (ContentType=�image/jpeg;q=0�) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\ No newline at end of file diff --git a/print/SimplePipelineFilter/FilterSample.def b/print/SimplePipelineFilter/FilterSample.def new file mode 100644 index 00000000..f6a38ef5 --- /dev/null +++ b/print/SimplePipelineFilter/FilterSample.def @@ -0,0 +1,8 @@ +LIBRARY "FilterSample.DLL" + +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + + + diff --git a/print/SimplePipelineFilter/FilterSample.rc b/print/SimplePipelineFilter/FilterSample.rc new file mode 100644 index 00000000..caf78af0 --- /dev/null +++ b/print/SimplePipelineFilter/FilterSample.rc @@ -0,0 +1,10 @@ +#include <windows.h> +#include <ntverp.h> + +#define VER_FILETYPE VFT_DLL +#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILEDESCRIPTION_STR "Print Pipeline WDK Filter Sample" +#define VER_INTERNALNAME_STR "WdkPipelineFilter.dll" +#define VER_ORIGINALFILENAME_STR "WdkPipelineFilter.dll" + +#include "common.ver" diff --git a/print/SimplePipelineFilter/ReadMe.md b/print/SimplePipelineFilter/ReadMe.md new file mode 100644 index 00000000..06f17b61 --- /dev/null +++ b/print/SimplePipelineFilter/ReadMe.md @@ -0,0 +1,9 @@ +Print Pipeline Simple Filter +============================ + +The printing system supports a print filter pipeline. The pipeline is run when a print job is consumed by the print spooler and sent to the device. + +This sample shows how to use the print pipeline's filter interfaces. + +The filters in the print pipeline consume a certain data type and produce a certain data type. This information is specified in the pipeline configuration file on a per printer driver basis. The WDK print filter sample contains two filter samples: one that consumes and produces XPS data type, and the other one consumes and produces opaque byte stream. For more information, see the [XpsDrv](http://msdn.microsoft.com/en-us/windows/hardware/gg463364) whitepaper. + diff --git a/print/SimplePipelineFilter/SimplePipelineFilter.sln b/print/SimplePipelineFilter/SimplePipelineFilter.sln new file mode 100644 index 00000000..c7863beb --- /dev/null +++ b/print/SimplePipelineFilter/SimplePipelineFilter.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WdkPipelineFilter", "WdkPipelineFilter.vcxproj", "{D3CE825A-F33C-4DF0-AA6D-F7BC0463164D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D3CE825A-F33C-4DF0-AA6D-F7BC0463164D}.Debug|Win32.ActiveCfg = Debug|Win32 + {D3CE825A-F33C-4DF0-AA6D-F7BC0463164D}.Debug|Win32.Build.0 = Debug|Win32 + {D3CE825A-F33C-4DF0-AA6D-F7BC0463164D}.Release|Win32.ActiveCfg = Release|Win32 + {D3CE825A-F33C-4DF0-AA6D-F7BC0463164D}.Release|Win32.Build.0 = Release|Win32 + {D3CE825A-F33C-4DF0-AA6D-F7BC0463164D}.Debug|x64.ActiveCfg = Debug|x64 + {D3CE825A-F33C-4DF0-AA6D-F7BC0463164D}.Debug|x64.Build.0 = Debug|x64 + {D3CE825A-F33C-4DF0-AA6D-F7BC0463164D}.Release|x64.ActiveCfg = Release|x64 + {D3CE825A-F33C-4DF0-AA6D-F7BC0463164D}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/print/SimplePipelineFilter/StreamFilter.cxx b/print/SimplePipelineFilter/StreamFilter.cxx new file mode 100644 index 00000000..a03aafe0 --- /dev/null +++ b/print/SimplePipelineFilter/StreamFilter.cxx @@ -0,0 +1,263 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This source code is intended only as a supplement to Microsoft +// Development Tools and/or on-line documentation. See these other +// materials for detailed information regarding Microsoft code samples. +// +// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY +// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +// +// Abstract: +// WDK print filter sample. +// This is the C file for the stream filter sample. +// +//---------------------------------------------------------------------------- + +#include "precomp.hxx" +#include "main.hxx" +#include "StreamFilter.tmh" +#include "StreamFilter.hxx" + +#include "winddiui.h" +#include "compstui.h" +#include "printoem.h" + +#include "initguid.h" +#include "prcomoem.h" + +_Analysis_mode_(_Analysis_code_type_user_driver_) + +// +// 5f5460d2-b313-44ca-82e4-37f83d793999 - generate a guid, do not use this one in your code +// +const GUID StreamFilterGuid = {0x5f5460d2, 0xb313, 0x44ca, {0x82, 0xe4, 0x37, 0xf8, 0x3d, 0x79, 0x39, 0x99}}; + +const GUID& +StreamFilter:: +FilterClsid( + void + ) +{ + return StreamFilterGuid; +} + +StreamFilter:: +StreamFilter() : + m_bShutdown(false), + m_cRef(1) +{ +} + +// +// IUnknown methods +// +__override +STDMETHODIMP +StreamFilter:: +QueryInterface( + _In_ REFIID riid, + _Out_ void **ppv + ) +{ + HRESULT hRes = E_POINTER; + + if (ppv) + { + hRes = E_NOINTERFACE; + + *ppv = NULL; + + if (riid == IID_IPrintPipelineFilter) + { + *ppv = static_cast<IPrintPipelineFilter *>(this); + } + else if (riid == IID_IUnknown) + { + *ppv = static_cast<IUnknown *>(this); + } + + if (*ppv) + { + AddRef(); + + hRes = S_OK; + } + } + + return hRes; +} + +__override +STDMETHODIMP_(ULONG) +StreamFilter:: +AddRef( + void + ) +{ + return InterlockedIncrement(&m_cRef); +} + +__override +STDMETHODIMP_(ULONG) +StreamFilter:: +Release( + void + ) +{ + ULONG cRefCount = InterlockedDecrement(&m_cRef); + + if (cRefCount) + { + return cRefCount; + } + + delete this; + + return 0; +} + +// +// IPrintPipelineFilter +// +__override +STDMETHODIMP +StreamFilter:: +ShutdownOperation( + void + ) +{ + m_bShutdown = true; + + return S_OK; +} + +__override +STDMETHODIMP +StreamFilter:: +InitializeFilter( + _In_ IInterFilterCommunicator *pIFilterCommunicator, + _In_ IPrintPipelinePropertyBag *pIPropertyBag, + _In_ IPrintPipelineManagerControl *pIPipelineControl + ) +{ + HRESULT hr = S_OK; + VARIANT varHelper; + PCSTR *pFeatures = NULL; + DWORD dwFeatures = 0; + Tools::SmartPtr<IPrintCoreHelper> pHelper; + + VariantInit(&varHelper); + + // + // StreamAccessSequential, IID_IPrintReadStream + // + hr = pIFilterCommunicator->RequestReader(reinterpret_cast<void **>(&m_pIRead)); + + if (SUCCEEDED(hr)) + { + // + // StreamAccessSequential, StreamModify, IID_IPrintWriteStream + // + hr = pIFilterCommunicator->RequestWriter(reinterpret_cast<void **>(&m_pIWrite)); + } + + if (SUCCEEDED(hr)) + { + m_pIPipelineControl = pIPipelineControl; + } + + // + // This shows how to use the helper interface to read information + // from a UnidrvUI based configuration module. + // + + if (SUCCEEDED(hr)) + { + hr = pIPropertyBag->GetProperty(L"IPrintCoreHelper", &varHelper); + } + + if (SUCCEEDED(hr) && V_UNKNOWN(&varHelper)) + { + hr = (V_UNKNOWN(&varHelper))->QueryInterface(IID_IPrintCoreHelper, (VOID**)(&pHelper)); + } + + // + // No need to release buffers provided by the helper. Their + // lifetime matches that of the helper. + // + if (SUCCEEDED(hr) && pHelper) + { + hr = pHelper->EnumFeatures(&pFeatures, &dwFeatures); + } + + if (SUCCEEDED(hr) && dwFeatures > 0) + { + for (DWORD i = 0; i < dwFeatures; i++) + { + DoTraceMessage(WS_TRACE, L"StreamFilter::InitializeFilter: Feature found: %s", pFeatures[i]); + } + } + + VariantClear(&varHelper); + + return hr; +} + +__override +STDMETHODIMP +StreamFilter:: +StartOperation( + void + ) +{ + HRESULT hr = S_OK; + Tools::SmartPtr<IImgErrorInfo> pIErrorInfo; + DWORD cbRead; + BYTE *pReadBuf; + BOOL bEof = FALSE; + + pReadBuf = new BYTE[kBufferSize]; + + if (!pReadBuf) + { + hr = E_OUTOFMEMORY; + } + + while (SUCCEEDED(hr) && !bEof && !m_bShutdown) + { + hr = m_pIRead->ReadBytes(pReadBuf, kBufferSize, &cbRead, &bEof); + + if (SUCCEEDED(hr) && cbRead) + { + ULONG cbWritten; + + hr = m_pIWrite->WriteBytes(pReadBuf, cbRead, &cbWritten); + + if (SUCCEEDED(hr)) + { + DoTraceMessage(WS_TRACE, "StreamFilter::StartOperation read and wrote %u bytes", cbRead); + } + } + } + + m_pIWrite->Close(); + + if (FAILED(hr)) + { + m_pIPipelineControl->RequestShutdown(hr, pIErrorInfo); + } + + if (m_pIPipelineControl) + { + m_pIPipelineControl->FilterFinished(); + } + + delete [] pReadBuf; + + return hr; +} + + diff --git a/print/SimplePipelineFilter/StreamFilter.hxx b/print/SimplePipelineFilter/StreamFilter.hxx new file mode 100644 index 00000000..c23f5fb2 --- /dev/null +++ b/print/SimplePipelineFilter/StreamFilter.hxx @@ -0,0 +1,99 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This source code is intended only as a supplement to Microsoft +// Development Tools and/or on-line documentation. See these other +// materials for detailed information regarding Microsoft code samples. +// +// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY +// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +// +// Abstract: +// WDK print filter sample. +// This is the header file for the stream filter sample. +// +//---------------------------------------------------------------------------- + +#ifndef _STREAM_FILTER_SAMPLE_HXX_ +#define _STREAM_FILTER_SAMPLE_HXX_ + +class StreamFilter : + public IPrintPipelineFilter, + private DllLockManager +{ +public: + + StreamFilter(); + + // + // IUnknown methods + // + __override + STDMETHODIMP + QueryInterface( + _In_ REFIID riid, + _Out_ void **ppv + ); + + __override + STDMETHODIMP_(ULONG) + AddRef( + void + ); + + __override + STDMETHODIMP_(ULONG) + Release( + void + ); + + // + // IPrintPipelineFilter + // + __override + STDMETHODIMP + ShutdownOperation( + void + ); + + __override + STDMETHODIMP + InitializeFilter( + _In_ IInterFilterCommunicator *pINegotiation, + _In_ IPrintPipelinePropertyBag *pIPropertyBag, + _In_ IPrintPipelineManagerControl *pIPipelineControl + ); + + __override + STDMETHODIMP + StartOperation( + void + ); + + // + // Other methods + // + static + const GUID& + FilterClsid( + void + ); + +private: + + enum + { + kBufferSize = 0x10000 + }; + + Tools::SmartPtr<IPrintReadStream> m_pIRead; + Tools::SmartPtr<IPrintWriteStream> m_pIWrite; + Tools::SmartPtr<IPrintPipelineManagerControl> m_pIPipelineControl; + Tools::SmartPtr<IPrintPipelineProgressReport> m_pProgressReport; + bool m_bShutdown; + LONG m_cRef; +}; + +#endif // _STREAM_FILTER_SAMPLE_HXX_ diff --git a/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj b/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj new file mode 100644 index 00000000..3af320ac --- /dev/null +++ b/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj @@ -0,0 +1,294 @@ +<?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="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{D3CE825A-F33C-4DF0-AA6D-F7BC0463164D}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <SampleGuid>{5BC5D9DA-A9ED-4BE2-8DD9-33853EFC148A}</SampleGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <OutDir>$(IntDir)</OutDir> + </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </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')" /> + </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')" /> + </ImportGroup> + <ItemGroup Label="WrappedTaskItems"> + <ClCompile Include="main.cxx"> + <WppEnabled>true</WppEnabled> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.hxx</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.hxx.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="StreamFilter.cxx"> + <WppEnabled>true</WppEnabled> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.hxx</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.hxx.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="XpsFilter.cxx"> + <WppEnabled>true</WppEnabled> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.hxx</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.hxx.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <OtherWpp Include="FilterSample.rc"> + <WppEnabled>true</WppEnabled> + </OtherWpp> + </ItemGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>WdkPipelineFilter</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>WdkPipelineFilter</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>WdkPipelineFilter</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>WdkPipelineFilter</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);user32.lib;kernel32.lib;oleaut32.lib;ole32.lib;uuid.lib;advapi32.lib</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);user32.lib;kernel32.lib;oleaut32.lib;ole32.lib;uuid.lib;advapi32.lib</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);user32.lib;kernel32.lib;oleaut32.lib;ole32.lib;uuid.lib;advapi32.lib</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);user32.lib;kernel32.lib;oleaut32.lib;ole32.lib;uuid.lib;advapi32.lib</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Link> + <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> + <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Link> + <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> + <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Link> + <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> + <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Link> + <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> + <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <RuntimeLibrary Condition="'$(UseDebugLibraries)'=='false'">MultiThreaded</RuntimeLibrary> + <RuntimeLibrary Condition="'$(UseDebugLibraries)'=='true'">MultiThreadedDebug</RuntimeLibrary> + <TreatWarningAsError>true</TreatWarningAsError> + <WarningLevel>Level4</WarningLevel> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <RuntimeLibrary Condition="'$(UseDebugLibraries)'=='false'">MultiThreaded</RuntimeLibrary> + <RuntimeLibrary Condition="'$(UseDebugLibraries)'=='true'">MultiThreadedDebug</RuntimeLibrary> + <TreatWarningAsError>true</TreatWarningAsError> + <WarningLevel>Level4</WarningLevel> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <RuntimeLibrary Condition="'$(UseDebugLibraries)'=='false'">MultiThreaded</RuntimeLibrary> + <RuntimeLibrary Condition="'$(UseDebugLibraries)'=='true'">MultiThreadedDebug</RuntimeLibrary> + <TreatWarningAsError>true</TreatWarningAsError> + <WarningLevel>Level4</WarningLevel> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <RuntimeLibrary Condition="'$(UseDebugLibraries)'=='false'">MultiThreaded</RuntimeLibrary> + <RuntimeLibrary Condition="'$(UseDebugLibraries)'=='true'">MultiThreadedDebug</RuntimeLibrary> + <TreatWarningAsError>true</TreatWarningAsError> + <WarningLevel>Level4</WarningLevel> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Link> + <AdditionalOptions>%(AdditionalOptions) /ignore:4070</AdditionalOptions> + <ModuleDefinitionFile>FilterSample.def</ModuleDefinitionFile> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Link> + <AdditionalOptions>%(AdditionalOptions) /ignore:4070</AdditionalOptions> + <ModuleDefinitionFile>FilterSample.def</ModuleDefinitionFile> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Link> + <AdditionalOptions>%(AdditionalOptions) /ignore:4070</AdditionalOptions> + <ModuleDefinitionFile>FilterSample.def</ModuleDefinitionFile> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Link> + <AdditionalOptions>%(AdditionalOptions) /ignore:4070</AdditionalOptions> + <ModuleDefinitionFile>FilterSample.def</ModuleDefinitionFile> + </Link> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="precompsrc.cpp"> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.hxx</PreCompiledHeaderFile> + <PreCompiledHeader>Create</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.hxx.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ResourceCompile Include="FilterSample.rc" /> + </ItemGroup> + <ItemGroup> + <Inf Exclude="@(Inf)" Include="*.inf" /> + <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> + </ItemGroup> + <ItemGroup> + <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> + <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> + <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> + </ItemGroup> + <ItemGroup> + <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project>
\ No newline at end of file diff --git a/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj.Filters b/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj.Filters new file mode 100644 index 00000000..65c4c551 --- /dev/null +++ b/print/SimplePipelineFilter/WdkPipelineFilter.vcxproj.Filters @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> + <UniqueIdentifier>{9E97BFB7-9C77-4223-A684-83194A1A1C59}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + <UniqueIdentifier>{ED009CED-C036-41C0-96C7-B993C7F42ECD}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> + <UniqueIdentifier>{F44E5BC1-1970-4C43-A39A-30A1F28A6E42}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="main.cxx"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="precompsrc.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="StreamFilter.cxx"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="XpsFilter.cxx"> + <Filter>Source Files</Filter> + </ClCompile> + <None Include="FilterSample.def"> + <Filter>Source Files</Filter> + </None> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="FilterSample.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/print/SimplePipelineFilter/XpsFilter.cxx b/print/SimplePipelineFilter/XpsFilter.cxx new file mode 100644 index 00000000..fe4945d0 --- /dev/null +++ b/print/SimplePipelineFilter/XpsFilter.cxx @@ -0,0 +1,785 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This source code is intended only as a supplement to Microsoft +// Development Tools and/or on-line documentation. See these other +// materials for detailed information regarding Microsoft code samples. +// +// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY +// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +// +// Abstract: +// WDK print filter sample. +// This is the C file for the stream filter sample. +// +//---------------------------------------------------------------------------- + +#include "precomp.hxx" +#include "main.hxx" +#include "XpsFilter.tmh" +#include "XpsFilter.hxx" + +_Analysis_mode_(_Analysis_code_type_user_driver_) + +// +// 8267d291-6ddd-4972-a94e-3ce88149a1fa - generate a guid, do not use this one in your code +// +const GUID ClsidXpsFilter = {0x8267d291, 0x6ddd, 0x4972, {0xa9, 0x4e, 0x3c, 0xe8, 0x81, 0x49, 0xa1, 0xfa}}; + +const GUID& +XpsFilter:: +FilterClsid( + void + ) +{ + return ClsidXpsFilter; +} + +#define COUNTOF(x) (sizeof(x)/sizeof(*x)) + +HRESULT +GetLastErrorAsHResult( + void + ) +{ + DWORD dwError = GetLastError(); + + return HRESULT_FROM_WIN32(dwError); +} + +HRESULT +ProcessTicket( + _In_ IPartPrintTicket *pIPrintTicket + ) +{ + Tools::SmartBSTR bstr; + + HRESULT hRes = pIPrintTicket->GetUri(&bstr); + + if (SUCCEEDED(hRes)) + { + Tools::SmartPtr<IPrintReadStream> pIStream; + + hRes = pIPrintTicket->GetStream(&pIStream); + + if (SUCCEEDED(hRes)) + { + ULONG cbRead = 0; + BOOL bEof = FALSE; + + DoTraceMessage(WS_TRACE, "ProcessTicket print ticket follows."); + + do + { + BYTE buf[200] = {0}; + + // + // Save one byte to ensure null termination + // + if (SUCCEEDED(hRes = pIStream->ReadBytes(buf, COUNTOF(buf) - 1, &cbRead, &bEof)) && cbRead) + { + // + // use PT data + // + DoTraceMessage(WS_TRACE, "%s", reinterpret_cast<PCSTR>(buf)); + } + } + while (!bEof && cbRead && SUCCEEDED(hRes)); + } + } + + return hRes; +} + +HRESULT +AddFontToPage( + _In_ IPartFont *pNewFont, + _In_ IPrintWriteStream *pFontStream, + _In_ IFixedPage *pNewPage + ) +{ + WCHAR szFont[MAX_PATH]; + HRESULT hRes = S_OK; + + if (!GetWindowsDirectory(szFont, MAX_PATH)) + { + hRes = GetLastErrorAsHResult(); + } + + if (SUCCEEDED(hRes)) + { + hRes = StringCchCat(szFont, MAX_PATH, L"\\fonts\\verdana.TTF"); + } + + if (SUCCEEDED(hRes)) + { + HANDLE hFile = CreateFile(szFont, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + 0, + NULL); + + if (hFile != INVALID_HANDLE_VALUE) + { + BYTE buf[400]; + ULONG cbBuf = 400; + ULONG cbRead, cbWritten; + + do + { + if (ReadFile(hFile, buf, cbBuf, &cbRead, NULL)) + { + hRes = pFontStream->WriteBytes(buf, cbRead, &cbWritten); + } + else + { + hRes = GetLastErrorAsHResult(); + } + } + while (SUCCEEDED(hRes) && cbRead); + + CloseHandle(hFile); + } + else + { + hRes = GetLastErrorAsHResult(); + } + + pFontStream->Close(); + } + + if (SUCCEEDED(hRes)) + { + hRes = pNewPage->SetPagePart(pNewFont); + } + + return hRes; +} + +HRESULT +AddTextToPage( + _In_ PCWSTR pszReferencedFont, + _In_ IPrintWriteStream *pPageMarkupStream + ) +{ + HRESULT hRes; + ULONG cb; + CHAR buf[500]; + + // + // Mark up for page generated on the fly: "hello world" + // + CHAR sz[] = "<FixedPage Width=\"816\" Height=\"1056\" xmlns=\"http://schemas.microsoft.com/xps/2005/06\" xml:lang=\"en-US\">" + "<Glyphs Fill=\"#ff000000\" FontUri=\"%ws\" FontRenderingEmSize=\"15\" StyleSimulations=\"None\" OriginX=\"172\"" + " OriginY=\"129.68\" Indices=\"75;72;79;79;82;3;90;82;85;79;71\" UnicodeString=\"hello world\" />" + "</FixedPage>"; + + // + // Insert the URI of the font we added to the document + // + hRes = StringCchPrintfA(buf, COUNTOF(buf), sz, pszReferencedFont); + + // + // Write markup for page + // + if (SUCCEEDED(hRes) && + SUCCEEDED(hRes = pPageMarkupStream->WriteBytes(buf, static_cast<ULONG>(strlen(buf)), &cb))) + { + pPageMarkupStream->Close(); + } + + return hRes; +} + +// +// This function reads the page content and writes it back. Can be extended +// to do useful work +// +HRESULT +ModifyContent( + _In_ IPrintReadStream *pRead, + _In_ IPrintWriteStream *pWrite + ) +{ + CHAR buf[100] = {0}; + HRESULT hRes; + ULONG cbr, cbw; + BOOL bEof = FALSE; + + do + { + hRes = pRead->ReadBytes(buf, sizeof(buf), &cbr, &bEof); + + if (SUCCEEDED(hRes) && cbr) + { + // + // do something with buffer + // + cbw = cbr; + + hRes = pWrite->WriteBytes(buf, cbr, &cbw); + } + } + while (!bEof && cbr && SUCCEEDED(hRes)); + + return hRes; +} + +HRESULT +XpsFilter:: +ProcessImagePart( + _In_ IPartImage *pIPartImage + ) +{ + Tools::SmartBSTR bstr; + + HRESULT hRes = pIPartImage->GetUri(&bstr); + + DoTraceMessage(WS_TRACE, "ProcessImagePart uri %ws", static_cast<PCWSTR>(bstr)); + + if (SUCCEEDED(hRes)) + { + Tools::SmartPtr<IPrintReadStream> pRead; + + if (SUCCEEDED(hRes = pIPartImage->GetStream(&pRead))) + { + // + // do something with image + // + } + } + + return hRes; +} + +// +// Non-static members +// +XpsFilter:: +XpsFilter() : + m_bShutdown(false), + m_cRef(1), + m_cIdCount(0) +{ +} + +HRESULT +XpsFilter:: +ProcessFixedPage( + _In_ void *pVoid + ) +{ + Tools::SmartPtr<IFixedPage> pIFixedPage; + + // + // XpsFilter::ProcessPart already incremented the reference count for the object. This + // function is taking ownership of the object, there is no need for another AddRef call + // (hence the Attach) + // + pIFixedPage.Attach(static_cast<IFixedPage *>(pVoid)); + + HRESULT hRes; + Tools::SmartBSTR bstr; + + if (SUCCEEDED(pIFixedPage->GetUri(&bstr))) + { + DoTraceMessage(WS_TRACE, "ProcessFixedPage uri %ws", static_cast<PCWSTR>(bstr)); + } + + Tools::SmartPtr<IPartPrintTicket> pIPrintTicket; + + hRes = pIFixedPage->GetPrintTicket(&pIPrintTicket); + + if (SUCCEEDED(hRes)) + { + hRes = ProcessTicket(pIPrintTicket); + } + else if (hRes == E_ELEMENT_NOT_FOUND) + { + // + // No ticket. Benign. + // + hRes = S_OK; + + DoTraceMessage(WS_WARNING, "ProcessFixedPage uri %ws. Page print ticket not present.", static_cast<PCWSTR>(bstr)); + } + + pIFixedPage->SetPartCompression(Compression_Small); + + // + // modify content for page, optional + // + Tools::SmartPtr<IPrintReadStream> pRead; + Tools::SmartPtr<IPrintWriteStream> pWrite; + + if (SUCCEEDED(hRes = pIFixedPage->GetStream(&pRead)) && + SUCCEEDED(hRes = pIFixedPage->GetWriteStream(&pWrite))) + { + hRes = ModifyContent(pRead, pWrite); + + pWrite->Close(); + } + + // + // Send page to next filter + // + if (SUCCEEDED(hRes)) + { + hRes = m_pReachConsumer->SendFixedPage(pIFixedPage); + } + + // + // Add a new page + // + if (SUCCEEDED(hRes)) + { + Tools::SmartPtr<IFixedPage> pNewPage; + Tools::SmartPtr<IPrintWriteStream> pNewPageMarkupStream; + Tools::SmartPtr<IPartFont> pNewFont; + Tools::SmartPtr<IPrintWriteStream> pNewFontStream; + + WCHAR szName[MAX_PATH]; + + // + // Generate unique page name + // + if (SUCCEEDED(hRes = StringCchPrintf(szName, MAX_PATH, L"/pages/newaddedpage%u.xaml", m_cIdCount++))) + { + // + // Create new fixed page + // + hRes = m_pReachConsumer->GetNewEmptyPart(szName, + IID_IFixedPage, + reinterpret_cast<void **>(&pNewPage), + &pNewPageMarkupStream); + + DoTraceMessage(WS_TRACE, "ProcessFixedPage new page %ws", szName); + } + + // + // Generate unique font name, this can, of course, be optimized so we don't include + // the same font multiple times. But this code is supposed to just to show how to + // add a font + // + if (SUCCEEDED(hRes = StringCchPrintf(szName, MAX_PATH, L"/font_%u.ttf", m_cIdCount++))) + { + // + // Create new font resource + // + hRes = m_pReachConsumer->GetNewEmptyPart(szName, + IID_IPartFont, + reinterpret_cast<void **>(&pNewFont), + &pNewFontStream); + + DoTraceMessage(WS_TRACE, "ProcessFixedPage new font %ws", szName); + } + + if (SUCCEEDED(hRes) && + SUCCEEDED(hRes = AddFontToPage(pNewFont, pNewFontStream, pNewPage)) && + SUCCEEDED(hRes = AddTextToPage(szName, pNewPageMarkupStream))) + { + // + // Send page to next filter + // + hRes = m_pReachConsumer->SendFixedPage(pNewPage); + } + } + + return hRes; +} + + + +struct Pair_t +{ + typedef HRESULT (XpsFilter::*PFN)(void *); + + Pair_t(REFIID d, PFN n) : iid(d), pfn(n) {} + + REFIID iid; + PFN pfn; + +private: + + Pair_t& operator=(const Pair_t&); +}; + + +HRESULT +XpsFilter:: +ProcessPart( + _In_ IUnknown *pUnk + ) +{ + HRESULT hRes = S_OK; + + Pair_t pairs[] = + { + Pair_t(IID_IXpsDocument, &XpsFilter::ProcessXpsDoc), + Pair_t(IID_IFixedDocumentSequence, &XpsFilter::ProcessFixedDocSequence), + Pair_t(IID_IFixedDocument, &XpsFilter::ProcessFixedDoc), + Pair_t(IID_IFixedPage, &XpsFilter::ProcessFixedPage), + }; + + // + // Detect what part we got + // + for (ULONG i = 0; i < sizeof(pairs)/sizeof(*pairs); i++) + { + void *pvoid = NULL; + + if (SUCCEEDED(hRes = pUnk->QueryInterface(pairs[i].iid, &pvoid))) + { + // + // QueryInterface increments the reference count for the object it returns + // + hRes = (this->*pairs[i].pfn)(pvoid); + + break; + } + else if (hRes != E_NOINTERFACE) + { + break; + } + } + + // + // IPartDiscardControl objects may float through the pipeline. The code above does not check for IPartDiscardControl. + // So, for maximum compatibility, the filter forwards parts that it doesn't understand. + // + if (hRes == E_NOINTERFACE) + { + hRes = m_pReachConsumer->SendXpsUnknown(pUnk); + } + + return hRes; +} + +HRESULT +XpsFilter:: +ProcessXpsDoc( + _In_ void *pVoid + ) +{ + Tools::SmartPtr<IXpsDocument> pIXpsDoc; + + pIXpsDoc.Attach(static_cast<IXpsDocument *>(pVoid)); + + DoTraceMessage(WS_TRACE, L"ProcessXpsDoc"); + + return m_pReachConsumer->SendXpsDocument(pIXpsDoc); +} + +HRESULT +XpsFilter:: +ProcessFixedDocSequence( + _In_ void *pVoid + ) +{ + Tools::SmartPtr<IFixedDocumentSequence> pIFixedDocumentSequence; + + // + // XpsFilter::ProcessPart already incremented the reference count for the object. This + // function is taking ownership of the object, there is no need for another AddRef call + // (hence the Attach) + // + pIFixedDocumentSequence.Attach(static_cast<IFixedDocumentSequence *>(pVoid)); + + Tools::SmartBSTR bstr; + + if (SUCCEEDED(pIFixedDocumentSequence->GetUri(&bstr))) + { + DoTraceMessage(WS_TRACE, "ProcessFixedDocSequence uri %ws", static_cast<PCWSTR>(bstr)); + } + + Tools::SmartPtr<IPartPrintTicket> pIPrintTicket; + + HRESULT hRes = pIFixedDocumentSequence->GetPrintTicket(&pIPrintTicket); + + if (SUCCEEDED(hRes)) + { + hRes = ProcessTicket(pIPrintTicket); + } + else if (hRes == E_ELEMENT_NOT_FOUND) + { + // + // No ticket. Benign. + // + hRes = S_OK; + + DoTraceMessage(WS_WARNING, "ProcessFixedDocSequence uri %ws. Page print ticket not present.", static_cast<PCWSTR>(bstr)); + } + + return m_pReachConsumer->SendFixedDocumentSequence(pIFixedDocumentSequence); +} + +HRESULT +XpsFilter:: +ProcessFixedDoc( + _In_ void *pVoid + ) +{ + Tools::SmartPtr<IFixedDocument> pIFixedDocument; + + // + // XpsFilter::ProcessPart already incremented the reference count for the object. This + // function is taking ownership of the object, there is not need for another AddRef call + // (hence the Attach) + // + pIFixedDocument.Attach(static_cast<IFixedDocument *>(pVoid)); + + Tools::SmartBSTR bstr; + + if (SUCCEEDED(pIFixedDocument->GetUri(&bstr))) + { + DoTraceMessage(WS_TRACE, "ProcessFixedDoc uri %ws", static_cast<PCWSTR>(bstr)); + } + + Tools::SmartPtr<IPartPrintTicket> pIPrintTicket; + + HRESULT hRes = pIFixedDocument->GetPrintTicket(&pIPrintTicket); + + if (SUCCEEDED(hRes)) + { + hRes = ProcessTicket(pIPrintTicket); + } + else if (hRes == E_ELEMENT_NOT_FOUND) + { + // + // No ticket. Benign. + // + hRes = S_OK; + + DoTraceMessage(WS_WARNING, "ProcessFixedDoc uri %ws. Page print ticket not present.", static_cast<PCWSTR>(bstr)); + } + + return m_pReachConsumer->SendFixedDocument(pIFixedDocument); +} + +// +// IPrintPipelineFilter +// +__override +STDMETHODIMP +XpsFilter:: +ShutdownOperation( + void + ) +{ + m_bShutdown = true; + + return S_OK; +} + +__override +STDMETHODIMP +XpsFilter:: +InitializeFilter( + _In_ IInterFilterCommunicator *pIfc, + _In_ IPrintPipelinePropertyBag *pIPropertyBag, + _In_ IPrintPipelineManagerControl *pIPipelineControl + ) +{ + HRESULT hRes = S_OK; + + // + // IID_IReachPackageProvider must be specified in the config file + // + hRes = pIfc->RequestReader(reinterpret_cast<void **>(&m_pReachProvider)); + + if (SUCCEEDED(hRes)) + { + // + // IID_IReachPackageConsumer must be specified in the config file + // + hRes = pIfc->RequestWriter(reinterpret_cast<void **>(&m_pReachConsumer)); + + m_pIPipelineControl = pIPipelineControl; + } + + VARIANT var, var2, var3, var4; + + VariantInit(&var); + VariantInit(&var2); + VariantInit(&var3); + VariantInit(&var4); + + if (SUCCEEDED(hRes) && + SUCCEEDED(hRes = pIPropertyBag->GetProperty(XPS_FP_PRINTER_NAME, &var)) && + SUCCEEDED(hRes = pIPropertyBag->GetProperty(XPS_FP_PRINTER_HANDLE, &var2)) && + SUCCEEDED(hRes = pIPropertyBag->GetProperty(XPS_FP_JOB_ID, &var3)) && + SUCCEEDED(hRes = pIPropertyBag->GetProperty(XPS_FP_USER_TOKEN, &var4))) + { + PWSTR pszName = var.bstrVal; + HANDLE hPrinter = var2.byref; + ULONG jobId = var3.ulVal; + HANDLE hUserSecurityToken = var4.byref; + + // + // Filter can use devmode, hPrinter and pszName. byref value should not be freed/deleted + // in any way. bstrVal must be deleted by clearing the variant. + // + + // + // Do not free any byref resource. Ex: do not call CloseHandle on the security token + // + + // + // Remove these if you use the variables. This is in order to build clean with /W4 + // + UNREFERENCED_PARAMETER(jobId); + UNREFERENCED_PARAMETER(hPrinter); + UNREFERENCED_PARAMETER(pszName); + + // + // Sample code to show how to impersonate in order to access resources on behalf of the + // user who submitted the job + // + if (SetThreadToken(NULL, hUserSecurityToken)) + { + // + // now revert back to the original security context + // + if (!SetThreadToken(NULL, NULL)) + { + hRes = GetLastErrorAsHResult(); + } + } + else + { + hRes = GetLastErrorAsHResult(); + } + } + + VariantClear(&var); + VariantClear(&var2); + VariantClear(&var3); + VariantClear(&var4); + + // + // Example of how to add and delete a property from the bag + // + var.vt = VT_I4; + var.lVal = 5; + + if (SUCCEEDED(hRes) && + SUCCEEDED(hRes = pIPropertyBag->AddProperty(L"TestProperty", &var))) + { + hRes = pIPropertyBag->DeleteProperty(L"TestProperty") ? S_OK : E_FAIL; + } + + + return hRes; +} + +__override +STDMETHODIMP +XpsFilter:: +StartOperation( + void + ) +{ + HRESULT hRes = S_OK; + + while (SUCCEEDED(hRes) && !m_bShutdown) + { + Tools::SmartPtr<IUnknown> pUnk; + + hRes = m_pReachProvider->GetXpsPart(&pUnk); + + if (SUCCEEDED(hRes)) + { + if (!pUnk) + { + // + // End of objects + // + break; + } + + hRes = ProcessPart(pUnk); + } + } + + m_pReachConsumer->CloseSender(); + + if (FAILED(hRes)) + { +#pragma prefast(suppress:__WARNING_INVALID_PARAM_VALUE_1, "MSDN requires that pReason be NULL.") + m_pIPipelineControl->RequestShutdown(hRes, NULL); + } + + m_pIPipelineControl->FilterFinished(); + + return hRes; +} + +// +// IUnknown +// +STDMETHODIMP_(ULONG) +XpsFilter:: +AddRef( + VOID + ) +{ + return InterlockedIncrement(&m_cRef); +} + +STDMETHODIMP_(ULONG) +XpsFilter:: +Release( + VOID + ) +{ + ULONG cRefCount = InterlockedDecrement(&m_cRef); + + if (cRefCount) + { + return cRefCount; + } + + delete this; + + return 0; +} + +STDMETHODIMP +XpsFilter:: +QueryInterface( + _In_ REFIID riid, + _Out_ VOID **ppv + ) +{ + HRESULT hRes = E_POINTER; + + if (ppv) + { + hRes = E_NOINTERFACE; + + *ppv = NULL; + + if (riid == IID_IPrintPipelineFilter) + { + *ppv = static_cast<IPrintPipelineFilter *>(this); + } + else if (riid == IID_IUnknown) + { + *ppv = static_cast<IUnknown *>(this); + } + + if (*ppv) + { + AddRef(); + + hRes = S_OK; + } + } + + return hRes; +} + diff --git a/print/SimplePipelineFilter/XpsFilter.hxx b/print/SimplePipelineFilter/XpsFilter.hxx new file mode 100644 index 00000000..003650a6 --- /dev/null +++ b/print/SimplePipelineFilter/XpsFilter.hxx @@ -0,0 +1,126 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This source code is intended only as a supplement to Microsoft +// Development Tools and/or on-line documentation. See these other +// materials for detailed information regarding Microsoft code samples. +// +// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY +// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +// +// Abstract: +// WDK print filter sample. +// This is the header file for the XPS sample. +// +//---------------------------------------------------------------------------- + +#ifndef _XPS_FILTER_SAMPLE_HXX_ +#define _XPS_FILTER_SAMPLE_HXX_ + +class XpsFilter : + public IPrintPipelineFilter, + private DllLockManager +{ +public: + + XpsFilter(); + + // + // IUnknown methods + // + __override + STDMETHODIMP + QueryInterface( + _In_ REFIID riid, + _Out_ void **ppv + ); + + __override + STDMETHODIMP_(ULONG) + AddRef( + void + ); + + __override + STDMETHODIMP_(ULONG) + Release( + void + ); + + // + // IPrintPipelineFilter + // + __override + STDMETHODIMP + ShutdownOperation( + void + ); + + __override + STDMETHODIMP + InitializeFilter( + _In_ IInterFilterCommunicator *pINegotiation, + _In_ IPrintPipelinePropertyBag *pIPropertyBag, + _In_ IPrintPipelineManagerControl *pIPipelineControl + ); + + __override + STDMETHODIMP + StartOperation( + void + ); + + // + // Other methods + // + static + const GUID& + FilterClsid( + void + ); + +private: + + HRESULT + ProcessFixedPage( + _In_ void *pVoid + ); + + HRESULT + ProcessXpsDoc( + _In_ void *pVoid + ); + + HRESULT + ProcessFixedDocSequence( + _In_ void *pVoid + ); + + HRESULT + ProcessFixedDoc( + _In_ void *pVoid + ); + + HRESULT + ProcessPart( + _In_ IUnknown *pUnk + ); + + static + HRESULT + ProcessImagePart( + _In_ IPartImage *pIPartImage + ); + + Tools::SmartPtr<IPrintPipelineManagerControl> m_pIPipelineControl; + Tools::SmartPtr<IXpsDocumentProvider> m_pReachProvider; + Tools::SmartPtr<IXpsDocumentConsumer> m_pReachConsumer; + bool m_bShutdown; + LONG m_cRef; + LONG m_cIdCount; +}; + +#endif // _XPS_FILTER_SAMPLE_HXX_ + diff --git a/print/SimplePipelineFilter/main.cxx b/print/SimplePipelineFilter/main.cxx new file mode 100644 index 00000000..180fb4c6 --- /dev/null +++ b/print/SimplePipelineFilter/main.cxx @@ -0,0 +1,172 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This source code is intended only as a supplement to Microsoft +// Development Tools and/or on-line documentation. See these other +// materials for detailed information regarding Microsoft code samples. +// +// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY +// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +// +// Abstract: +// WDK print filter sample. This file contains the implementation for +// DllGetClassObject and DllMain +// +//---------------------------------------------------------------------------- + +#include "precomp.hxx" +#include "main.hxx" +#include "XpsFilter.hxx" +#include "StreamFilter.hxx" +#include "main.tmh" + +_Analysis_mode_(_Analysis_code_type_user_driver_) + +LONG DllLockManager::m_cGlobalRef = 0; + +HRESULT +WINAPI +DllCanUnloadNow(void) throw() +{ + return 0 == DllLockManager::GetGlobalRef() ? S_OK : S_FALSE; +} + +HRESULT +WINAPI +DllGetClassObject( + _In_ REFCLSID rclsid, + _In_ REFIID riid, + _Outptr_ PVOID *ppv + ) throw() +{ + HRESULT hRetval = E_POINTER; + + if (ppv) + { + *ppv = NULL; + + if (rclsid == XpsFilter::FilterClsid()) + { + Tools::SmartPtr<XpsFilter> pFilter; + + pFilter.Attach(new XpsFilter()); + + if (pFilter) + { + hRetval = pFilter->QueryInterface(riid, ppv); + } + else + { + hRetval = E_OUTOFMEMORY; + } + } + else if (rclsid == StreamFilter::FilterClsid()) + { + Tools::SmartPtr<StreamFilter> pFilter; + + pFilter.Attach(new StreamFilter()); + + if (pFilter) + { + hRetval = pFilter->QueryInterface(riid, ppv); + } + else + { + hRetval = E_OUTOFMEMORY; + } + } + else + { + hRetval = CLASS_E_CLASSNOTAVAILABLE; + } + } + + return hRetval; +} + +BOOL WINAPI +DllMain( + _In_ HINSTANCE hInst, + _In_ DWORD dwReason, + _In_opt_ PVOID pReserved + ) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + DisableThreadLibraryCalls(hInst); + + WPP_INIT_TRACING(L"WdkPipelineFilter"); + } + else if (dwReason == DLL_PROCESS_DETACH) + { + WPP_CLEANUP(); + } + + UNREFERENCED_PARAMETER(dwReason); + UNREFERENCED_PARAMETER(pReserved); + + return TRUE; +} + +void +WppTraceDebugOut( + _In_z_ const WCHAR *pszFmt, + ... + ) +{ + va_list pArgs; + + va_start(pArgs, pszFmt); + + WCHAR buf[MAX_PATH]; + + if (SUCCEEDED(StringCchVPrintf(buf, + MAX_PATH, + pszFmt, + pArgs)) && + SUCCEEDED(StringCchCat(buf, + MAX_PATH, + L"\n"))) + { + OutputDebugString(buf); + } + + va_end(pArgs); +} + +void +WppTraceDebugOut( + _In_z_ const CHAR *pszFmt, + ... + ) +{ + va_list pArgs; + + va_start(pArgs, pszFmt); + + CHAR buf[MAX_PATH]; + + if (SUCCEEDED(StringCchVPrintfA(buf, + MAX_PATH, + pszFmt, + pArgs)) && + SUCCEEDED(StringCchCatA(buf, + MAX_PATH, + "\n"))) + { + OutputDebugStringA(buf); + } + + va_end(pArgs); +} + + + + + + + + + diff --git a/print/SimplePipelineFilter/main.hxx b/print/SimplePipelineFilter/main.hxx new file mode 100644 index 00000000..88d8c052 --- /dev/null +++ b/print/SimplePipelineFilter/main.hxx @@ -0,0 +1,51 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This source code is intended only as a supplement to Microsoft +// Development Tools and/or on-line documentation. See these other +// materials for detailed information regarding Microsoft code samples. +// +// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY +// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +// +// Abstract: +// WDK print filter sample. +// The filters need to derive from DllLockManager. Thus the filter constructor and +// destructor call the DllLockManager constructor and destructor, respectively. +// +//---------------------------------------------------------------------------- + +#ifndef _FILTER_MAIN_HXX_ +#define _FILTER_MAIN_HXX_ + +class DllLockManager +{ +public: + + DllLockManager() + { + InterlockedIncrement(&m_cGlobalRef); + } + + ~DllLockManager() + { + InterlockedDecrement(&m_cGlobalRef); + } + + static + LONG + GetGlobalRef() + { + return InterlockedCompareExchange(&m_cGlobalRef, 0, 0); + } + +private: + + static LONG m_cGlobalRef; +}; + +#endif + + diff --git a/print/SimplePipelineFilter/precomp.hxx b/print/SimplePipelineFilter/precomp.hxx new file mode 100644 index 00000000..4ca7012d --- /dev/null +++ b/print/SimplePipelineFilter/precomp.hxx @@ -0,0 +1,26 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This source code is intended only as a supplement to Microsoft +// Development Tools and/or on-line documentation. See these other +// materials for detailed information regarding Microsoft code samples. +// +// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY +// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +// +// Abstract: +// WDK print filter sample. +// This is the precompiled header file. +// +//---------------------------------------------------------------------------- + +#include <windows.h> +#include <common.ver> +#include <filterpipeline.h> +#include <strsafe.h> +#include "smartptr.hxx" +#include "trace.hxx" + +_Analysis_mode_(_Analysis_code_type_user_driver_) diff --git a/print/SimplePipelineFilter/precompsrc.cpp b/print/SimplePipelineFilter/precompsrc.cpp new file mode 100644 index 00000000..5d84a122 --- /dev/null +++ b/print/SimplePipelineFilter/precompsrc.cpp @@ -0,0 +1 @@ +#include "precomp.hxx"
\ No newline at end of file diff --git a/print/SimplePipelineFilter/smartptr.hxx b/print/SimplePipelineFilter/smartptr.hxx new file mode 100644 index 00000000..7f20c530 --- /dev/null +++ b/print/SimplePipelineFilter/smartptr.hxx @@ -0,0 +1,233 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This source code is intended only as a supplement to Microsoft +// Development Tools and/or on-line documentation. See these other +// materials for detailed information regarding Microsoft code samples. +// +// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY +// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +// +// Abstract: +// WDK print filter sample. +// This file contains a smart pointer implementation. +// +//---------------------------------------------------------------------------- + +#ifndef __SAMPLE_SMART_PTR_HXX__ +#define __SAMPLE_SMART_PTR_HXX__ + +namespace Tools +{ + +template<class T> +inline +void +SmartAddRef( + T *pInterface + ) throw() +{ + if (pInterface) + { + pInterface->AddRef(); + } +} + +template<class T> +inline +void +SmartRelease( + T **ppInterface + ) throw() +{ + if (*ppInterface) + { + (*ppInterface)->Release(); + *ppInterface = NULL; + } +} + +template<class T> +class SmartPtr +{ +public: + + inline + SmartPtr( + void + ) throw() : m_Pointer(NULL) + { + } + + inline + SmartPtr( + _In_opt_ T *pointer + ) throw() + : m_Pointer(pointer) + { + SmartAddRef(m_Pointer); + } + + inline + SmartPtr( + _In_ const SmartPtr © + ) throw() + { + m_Pointer = copy.m_Pointer; + SmartAddRef(m_Pointer); + } + + inline + ~SmartPtr( + void + ) throw() + { + SmartRelease(&m_Pointer); + } + + inline + SmartPtr & + operator=( + _In_opt_ T *pointer + ) throw() + { + T *temp = m_Pointer; + + m_Pointer = pointer; + SmartAddRef(m_Pointer); + SmartRelease(&temp); + + return *this; + } + + inline + SmartPtr & + operator=( + _In_ const SmartPtr © + ) throw() + { + T *temp = m_Pointer; + + m_Pointer = copy.m_Pointer; + SmartAddRef(m_Pointer); + SmartRelease(&temp); + + return *this; + } + + inline + operator T *() throw() + { + return m_Pointer; + } + + inline + operator const T *() const throw() + { + return m_Pointer; + } + + inline + T ** + operator&() throw() + { + return &m_Pointer; + } + + inline + const T ** + operator&() const throw() + { + return &m_Pointer; + } + + inline + T * + operator->() throw() + { + return m_Pointer; + } + + inline + const T * + operator->( + ) const throw() + { + return m_Pointer; + } + + inline + void + Attach( + _In_opt_ T *pointer + ) throw() + { + T *temp = m_Pointer; + m_Pointer = pointer; + + SmartRelease(&temp); + } + + inline + T * + Detach( + void + ) throw() + { + T *pTemp = m_Pointer; + m_Pointer = NULL; + + return pTemp; + } + + inline + void + Clear( + void + ) throw() + { + SmartRelease(&m_Pointer); + } + +private: + + T *m_Pointer; +}; + +/////////////////////////////////////////////////////////////////////////////// + +class SmartBSTR +{ +public: + + SmartBSTR() throw() + : m_bstr (NULL) + { + } + + ~SmartBSTR() throw() + { + ::SysFreeString(m_bstr); + } + + operator BSTR() const throw() + { + return m_bstr; + } + + BSTR* + operator&() throw() + { + return &m_bstr; + } + +private: + + BSTR m_bstr; +}; + +}; // namespace tools + +#endif diff --git a/print/SimplePipelineFilter/trace.hxx b/print/SimplePipelineFilter/trace.hxx new file mode 100644 index 00000000..8b905c49 --- /dev/null +++ b/print/SimplePipelineFilter/trace.hxx @@ -0,0 +1,51 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This source code is intended only as a supplement to Microsoft +// Development Tools and/or on-line documentation. See these other +// materials for detailed information regarding Microsoft code samples. +// +// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY +// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +// +// Abstract: +// WDK print filter sample. +// Declares what is needed to Event Tracing. +// +//---------------------------------------------------------------------------- + +#ifndef __WDK_SAMPLE_TRACE_HXX__ +#define __WDK_SAMPLE_TRACE_HXX__ + +// +// Generate your own guid. Feel free to add more flags, as needed. +// +#define WPP_CONTROL_GUIDS \ + WPP_DEFINE_CONTROL_GUID(WdkSample, (79ad6dce, adad, 47ae, b49e, 41bcdccf9ed8), \ + WPP_DEFINE_BIT(WS_ERROR) \ + WPP_DEFINE_BIT(WS_WARNING) \ + WPP_DEFINE_BIT(WS_TRACE) \ + ) + +void +WppTraceDebugOut( + _In_z_ const WCHAR *pszFmt, + ... + ); + +void +WppTraceDebugOut( + _In_z_ const CHAR *pszFmt, + ... + ); + +// +// For checked builds, send output to debugger rather than to file +// +#ifdef DBG +#define WPP_DEBUG(x) WppTraceDebugOut x +#endif + +#endif diff --git a/print/XpsRasFilter/ReadMe.md b/print/XpsRasFilter/ReadMe.md new file mode 100644 index 00000000..2dc4fe52 --- /dev/null +++ b/print/XpsRasFilter/ReadMe.md @@ -0,0 +1,38 @@ +XPS Rasterization Filter Service Sample +======================================= + +This sample implements an XPSDrv filter that rasterizes fixed pages in an XPS document. Hardware vendors can modify this sample to build an XPSDrv filter that produces bitmap images for their printers or other display devices. The sample uses the XPS Rasterization Service in Windows 7. The sample does not run in versions of Windows before Windows 7. + +This document describes the contents and use of the XPS Rasterization Service Filter sample included in the Windows 7 WDK. This document will serve as a point-of-reference to gather and draft the information required for the MSDN entries to accompany the sample prior to flowing this text and information into the appropriate MSDN format. + +The XPS Rasterization Service creates rasterizer objects for use by XPSDrv filters. A rasterizer object takes an XPS Object Model (XPS OM) page object and creates a bitmap of a specified region of the page. The sample implements an XPSDrv filter (xpsrasfilter.dll) that can be inserted into the XPS Filter Pipeline. For each fixed page in an XPS document, the sample filter does the following: + +- Uses the XPS rasterization service to create a rasterizer object for the fixed page. +- Partitions the fixed page into several horizontal bands. +- Uses the rasterizer object to render each horizontal band as a bitmap image. + +The Print Filter Pipeline is part of the XPS Print Path [Windows Print Path Overview](print.windows_print_path_overview). Fixed pages are sent as an XPS data stream from the XPS Spooler to the print filter pipeline. The print filter pipeline manager takes the XPS fixed page, calls each filter in the order defined in the pipeline configuration file, and then sends either Fixed Page OM objects or a data stream to each filter as required. The filters process the data and return either Fixed Page OM objects or a data stream back to the print filter pipeline manager. (See MSDN entry for Filter Pipeline Interfaces items IXpsDocumentProvider, IXpsDocumentConsumer, IPrintWriteStream, and IPrintReadStream.) + +As a print filter pipeline service, the XPS Rasterization Service can be loaded into the filter pipeline when the pipeline is initialized by adding a filter service provider tag to the configuration XML file (for example, \<FilterServiceProvider dll="XpsRasterService.dll"/\>). The service is then available to be called by the filters when they are initialized and called by the print filter pipeline manager. + +The XPS Rasterization Service operates as follows: + +- The calling filter initializes an instance of the rasterizer by passing in the XPS OM for the fixed page. +- The calling filter calls the RasterizeRect method of the rasterizer to render a specified rectangle area of the fixed page. +- RasterizeRect writes the WIC (Windows Imaging Component) bitmap data to memory. (The address is specified as a parameter to RasterizeRect.) + +The default parameters in this sample are as follows: + +- Letter-sized physical page (can override in print ticket). +- 0.25-inch margins (creating an 8-inch by 10.5-inch imageable area). +- Scaling is set to FitApplicationBleedSizeToImageableSize. +- •Destination resolution set to 96 dpi (can override in print ticket). + +**Note** + +To build this sample, you can use Microsoft Visual Studio 2013 (Professional, or Ultimate) and Windows Driver Kit (WDK) 8.1 Update. This sample will not build with Microsoft Visual Studio Express 2013 for Windows Desktop, because the sample uses Active Template Library (ATL). You can get Visual Studio 2013 and WDK 8.1 Update [here](http://go.microsoft.com/fwlink/p/?LInkID=239721). + +You can also build this sample with Visual Studio 2013 (Professional or Ultimate) and [Windows Driver Kit (WDK) 8.1](http://go.microsoft.com/fwlink/p/?LInkID=391348). + +For Windows Driver Kit (WDK) 8 samples, download the [WDK 8 samples pack](%20http://go.microsoft.com/fwlink/?LinkId=317090). The samples in the WDK 8 samples pack will build only with Microsoft Visual Studio Professional 2012 (Professional or Ultimate) and WDK 8. + diff --git a/print/XpsRasFilter/XpsRasFilter.sln b/print/XpsRasFilter/XpsRasFilter.sln new file mode 100644 index 00000000..4adc144d --- /dev/null +++ b/print/XpsRasFilter/XpsRasFilter.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xpsrasfilter", "src\xpsrasfilter.vcxproj", "{41965435-F4B0-495B-B669-2291F27F56B5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {41965435-F4B0-495B-B669-2291F27F56B5}.Debug|Win32.ActiveCfg = Debug|Win32 + {41965435-F4B0-495B-B669-2291F27F56B5}.Debug|Win32.Build.0 = Debug|Win32 + {41965435-F4B0-495B-B669-2291F27F56B5}.Release|Win32.ActiveCfg = Release|Win32 + {41965435-F4B0-495B-B669-2291F27F56B5}.Release|Win32.Build.0 = Release|Win32 + {41965435-F4B0-495B-B669-2291F27F56B5}.Debug|x64.ActiveCfg = Debug|x64 + {41965435-F4B0-495B-B669-2291F27F56B5}.Debug|x64.Build.0 = Debug|x64 + {41965435-F4B0-495B-B669-2291F27F56B5}.Release|x64.ActiveCfg = Release|x64 + {41965435-F4B0-495B-B669-2291F27F56B5}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/print/XpsRasFilter/install/xpsrassmpl-PipelineConfig.xml b/print/XpsRasFilter/install/xpsrassmpl-PipelineConfig.xml new file mode 100644 index 00000000..c391b545 --- /dev/null +++ b/print/XpsRasFilter/install/xpsrassmpl-PipelineConfig.xml @@ -0,0 +1,32 @@ +<!-- + +Copyright (c) 2005 Microsoft Corporation + +All rights reserved. + +THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +PARTICULAR PURPOSE. + +File Name: + + xpsrassmpl-pipelineconfig.xml + +Abstract: + + XPSRas WDK sample driver filter configuration file. + +--> + +<Filters> + <Filter dll = "xpsrasfilter.dll" + clsid = "{CFF7BE69-E62D-403b-BE4F-48EC73F5DA1A}" + name = "XPSRas WDK Sample Filter"> + <Input guid = "{b8cf8530-5562-47c4-ab67-b1f69ecf961e}" comment="IID_IXpsDocumentProvider"/> + <Output guid = "{65bb7f1b-371e-4571-8ac7-912f510c1a38}" comment="IID_IPrintWriteStream"/> + </Filter> + <OptionalFilterServiceProvider dll="XpsRasterService.dll"/> +</Filters> + + diff --git a/print/XpsRasFilter/install/xpsrassmpl.gpd b/print/XpsRasFilter/install/xpsrassmpl.gpd new file mode 100644 index 00000000..0c300802 --- /dev/null +++ b/print/XpsRasFilter/install/xpsrassmpl.gpd @@ -0,0 +1,342 @@ +*% +*% Copyright (c) 2005 Microsoft Corporation +*% +*% All rights reserved. +*% +*% THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +*% ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +*% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +*% PARTICULAR PURPOSE. +*% +*% File Name: +*% +*% xpsrassmpl.gpd +*% +*% Abstract: +*% +*% Xps Rasterization Service WDK sample driver install file GPD file. +*% + +*GPDFileVersion: "1.0" +*GPDSpecVersion: "1.0" +*GPDFileName: "xpsrassmpl.gpd" +*Include: "msxpsinc.gpd" +*Include: "StdNames.gpd" +*ModelName: "XPSRas WDK Sample Driver" +*MasterUnits: PAIR(1200, 1200) +*ResourceDLL: "unires.dll" +*PrinterType: PAGE +*MaxCopies: 1 + +*%****************************************************************************** +*% PageMediaSize - Paper Size +*%****************************************************************************** +*Feature: PaperSize +{ + *rcNameID: =PAPER_SIZE_DISPLAY + *DefaultOption: LETTER + + *Option: A3 + { + *rcNameID: =RCID_DMPAPER_SYSTEM_NAME + *PageProtectMem: 9667 + *switch: Orientation + { + *case: PORTRAIT + { + *PrintableArea: PAIR(13460, 19440) + *PrintableOrigin: PAIR(284, 200) + *CursorOrigin: PAIR(284, 200) + } + *case: LANDSCAPE_CC270 + { + *PrintableArea: PAIR(13628, 19368) + *PrintableOrigin: PAIR(200, 236) + *CursorOrigin: PAIR(200, 19604) + } + } + } + + *Option: A4 + { + *rcNameID: =RCID_DMPAPER_SYSTEM_NAME + *PageProtectMem: 4249 + *switch: Orientation + { + *case: PORTRAIT + { + *PrintableArea: PAIR(9352, 13628) + *PrintableOrigin: PAIR(284, 200) + *CursorOrigin: PAIR(284, 200) + } + *case: LANDSCAPE_CC270 + { + *PrintableArea: PAIR(9520, 13556) + *PrintableOrigin: PAIR(200, 236) + *CursorOrigin: PAIR(200, 13792) + } + } + } + + *Option: B4 + { + *rcNameID: =RCID_DMPAPER_SYSTEM_NAME + *PageProtectMem: 6391 + *switch: Orientation + { + *case: PORTRAIT + { + *PrintableArea: PAIR(11572, 16796) + *PrintableOrigin: PAIR(284, 200) + *CursorOrigin: PAIR(284, 200) + } + *case: LANDSCAPE_CC270 + { + *PrintableArea: PAIR(11740, 16724) + *PrintableOrigin: PAIR(200, 236) + *CursorOrigin: PAIR(200, 16960) + } + } + } + + *Option: B5 + { + *rcNameID: =RCID_DMPAPER_SYSTEM_NAME + *PageProtectMem: 3198 + *switch: Orientation + { + *case: PORTRAIT + { + *PrintableArea: PAIR(7900, 11140) + *PrintableOrigin: PAIR(352, 300) + *CursorOrigin: PAIR(300, 100) + } + *case: LANDSCAPE_CC270 + { + *PrintableArea: PAIR(7760, 11140) + *PrintableOrigin: PAIR(300, 400) + *CursorOrigin: PAIR(100, 11940) + } + } + } + + *Option: EXECUTIVE + { + *rcNameID: =RCID_DMPAPER_SYSTEM_NAME + *PageProtectMem: 4109 + *switch: Orientation + { + *case: PORTRAIT + { + *PrintableArea: PAIR(8100, 11500) + *PrintableOrigin: PAIR(300, 300) + *CursorOrigin: PAIR(300, 200) + } + *case: LANDSCAPE_CC270 + { + *PrintableArea: PAIR(8300, 11500) + *PrintableOrigin: PAIR(200, 300) + *CursorOrigin: PAIR(200, 12300) + } + } + } + + *Option: ENV_10 + { + *rcNameID: =RCID_DMPAPER_SYSTEM_NAME + *PageProtectMem: 4109 + *switch: Orientation + { + *case: PORTRAIT + { + *PrintableArea: PAIR(4348, 11000) + *PrintableOrigin: PAIR(300, 200) + *CursorOrigin: PAIR(300, 200) + } + *case: LANDSCAPE_CC270 + { + *PrintableArea: PAIR(4548, 10920) + *PrintableOrigin: PAIR(200, 240) + *CursorOrigin: PAIR(200, 11160) + } + } + } + + *Option: LEGAL + { + *rcNameID: =RCID_DMPAPER_SYSTEM_NAME + *PageProtectMem: 1692 + *switch: Orientation + { + *case: PORTRAIT + { + *PrintableArea: PAIR(9000, 15500) + *PrintableOrigin: PAIR(400, 600) + *CursorOrigin: PAIR(180, 300) + } + *case: LANDSCAPE_CC270 + { + *PrintableArea: PAIR(9000, 15500) + *PrintableOrigin: PAIR(400, 900) + *CursorOrigin: PAIR(180, 16500) + } + } + } + + *Option: LETTER + { + *rcNameID: =RCID_DMPAPER_SYSTEM_NAME + *PageProtectMem: 1028 + *switch: Orientation + { + *case: PORTRAIT + { + *PrintableArea: PAIR(9500, 12500) + *PrintableOrigin: PAIR(400, 400) + *CursorOrigin: PAIR(300, 300) + } + *case: LANDSCAPE_CC270 + { + *PrintableArea: PAIR(9500, 12200) + *PrintableOrigin: PAIR(450, 300) + *CursorOrigin: PAIR(200, 12900) + } + } + } + + *Option: ENV_MONARCH + { + *rcNameID: =RCID_DMPAPER_SYSTEM_NAME + *PageProtectMem: 4109 + *switch: Orientation + { + *case: PORTRAIT + { + *PrintableArea: PAIR(4048, 8600) + *PrintableOrigin: PAIR(300, 200) + *CursorOrigin: PAIR(300, 200) + } + *case: LANDSCAPE_CC270 + { + *PrintableArea: PAIR(4248, 8520) + *PrintableOrigin: PAIR(200, 240) + *CursorOrigin: PAIR(200, 8760) + } + } + } + + *Option: TABLOID + { + *rcNameID: =RCID_DMPAPER_SYSTEM_NAME + *PageProtectMem: 4109 + *switch: Orientation + { + *case: PORTRAIT + { + *PrintableArea: PAIR(12000, 19200) + *PrintableOrigin: PAIR(400, 400) + *CursorOrigin: PAIR(400, 400) + } + *case: LANDSCAPE_CC270 + { + *PrintableArea: PAIR(12000, 19200) + *PrintableOrigin: PAIR(400, 600) + *CursorOrigin: PAIR(400, 18000) + } + } + } +} + +*%****************************************************************************** +*% PageOrientation +*%****************************************************************************** +*Feature: Orientation +{ + *rcNameID: =ORIENTATION_DISPLAY + *DefaultOption: PORTRAIT + + *Option: PORTRAIT + { + *rcNameID: =PORTRAIT_DISPLAY + } + + *Option: LANDSCAPE_CC270 + { + *rcNameID: =LANDSCAPE_DISPLAY + } +} + +*%****************************************************************************** +*% Resolution +*%****************************************************************************** +*Feature: Resolution +{ + *rcNameID: =RESOLUTION_DISPLAY + *DefaultOption: DPI600 + + *Option: DPI600 + { + *Name: "600 x 600 " =DOTS_PER_INCH + *DPI: PAIR(600, 600) + *TextDPI: PAIR(600, 600) + *SpotDiameter: 100 + *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } + *Command: CmdEndRaster { *Cmd : "<1B>*rC" } + *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } + } + + *Option: DPI1200 + { + *Name: "1200 x 1200 " =DOTS_PER_INCH + *DPI: PAIR(1200, 1200) + *TextDPI: PAIR(1200, 1200) + *SpotDiameter: 100 + *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" } + *Command: CmdEndRaster { *Cmd : "<1B>*rC" } + *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" } + } +} + +*%****************************************************************************** +*% Input Bin +*%****************************************************************************** +*Feature: InputBin +{ + *rcNameID: =PAPER_SOURCE_DISPLAY + *DefaultOption: UPPER + *ConcealFromUI?: TRUE + + *Option: UPPER + { + *rcNameID: =UPPER_TRAY_DISPLAY + } +} + + +*%****************************************************************************** +*% Printer Memory +*%****************************************************************************** +*Feature: Memory +{ + *rcNameID: =PRINTER_MEMORY_DISPLAY + *DefaultOption: 32768KB + *Option: 16384KB + { + *Name: "16MB" + *MemoryConfigKB: PAIR(16384, 13950) + } + *Option: 32768KB + { + *Name: "32MB" + *MemoryConfigKB: PAIR(32768, 28350) + } +} + +*%****************************************************************************** +*% Cursor Commands +*%****************************************************************************** +*Command: CmdCR { *Cmd : "<0D>" } +*Command: CmdLF { *Cmd : "<0A>" } +*Command: CmdFF { *Cmd : "<0C>" } + + diff --git a/print/XpsRasFilter/install/xpsrassmpl.inf b/print/XpsRasFilter/install/xpsrassmpl.inf new file mode 100644 index 00000000..0683802a --- /dev/null +++ b/print/XpsRasFilter/install/xpsrassmpl.inf @@ -0,0 +1,87 @@ +; +; Copyright (c) 2005 Microsoft Corporation +; +; All rights reserved. +; +; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +; PARTICULAR PURPOSE. +; +; File Name: +; +; xpsrassmpl.inf +; +; Abstract: +; +; Xps Rasterization Service WDK sample driver install file +; +[Version] +Signature="$Windows NT$" +Provider=%MS% +ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} +Class=Printer +DriverVer=10/17/2008,6.1.6930.0 + +[Manufacturer] +%Microsoft%=Microsoft,NTx86.6.1,NTia64.6.1,NTamd64.6.1 + + +[Microsoft.NTx86.6.1] +"XPSRas WDK Sample Driver" = INSTALL_FILTER + +[Microsoft.NTia64.6.1] +"XPSRas WDK Sample Driver" = INSTALL_FILTER + +[Microsoft.NTamd64.6.1] +"XPSRas WDK Sample Driver" = INSTALL_FILTER + +[INSTALL_FILTER] +CopyFiles=XPSRasSample +DriverFile=mxdwdrv.dll +ConfigFile=UniDrvUI.dll +HelpFile=UniDrv.HLP +DataFile=xpsrassmpl.GPD +CoreDriverSections="{D20EA372-DD35-4950-9ED8-A6335AFE79F0},UNIDRV.OEM", "{D20EA372-DD35-4950-9ED8-A6335AFE79F5},XPSDRV.OEM,XPSGPD.OEM" + +[PrinterPackageInstallation.x86] +PackageAware=TRUE +CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5} + +[PrinterPackageInstallation.amd64] +PackageAware=TRUE +CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5} + +[PrinterPackageInstallation.ia64] +PackageAware=TRUE +CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5} + +[DestinationDirs] +DefaultDestDir=66000 + +[XPSRasSample] +xpsrassmpl.gpd +xpsrassmpl-pipelineconfig.xml +xpsrasfilter.dll + +[SourceDisksNames.x86] +1 = %Location%,, +2 = %Location%,,,x86 + +[SourceDisksNames.ia64] +1 = %Location%,, +2 = %Location%,,,ia64 + +[SourceDisksNames.amd64] +1 = %Location%,, +2 = %Location%,,,amd64 + +[SourceDisksFiles] +xpsrassmpl.gpd = 1 +xpsrassmpl-pipelineconfig.xml = 1 +xpsrasfilter.dll = 2 + +[Strings] +Location="XPSRas WDK Sample Driver" +MS="Microsoft" +Microsoft="Microsoft"
\ No newline at end of file diff --git a/print/XpsRasFilter/src/BitmapHandler.cpp b/print/XpsRasFilter/src/BitmapHandler.cpp new file mode 100644 index 00000000..d887ddab --- /dev/null +++ b/print/XpsRasFilter/src/BitmapHandler.cpp @@ -0,0 +1,361 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// BitmapHandler.cpp +// +// Abstract: +// +// Abstract class that encapsulates the processing done to each +// individual band bitmap, as well as the concrete implemention +// that streams the bands as Tiffs to the output stream. +// + +#include "precomp.h" +#include "WppTrace.h" +#include "Exception.h" +#include "filtertypes.h" +#include "UnknownBase.h" +#include "xpsrasfilter.h" +#include "OMConvertor.h" +#include "rasinterface.h" +#include "BitmapHandler.h" + +#include "BitmapHandler.tmh" + +namespace xpsrasfilter +{ + +// +//Routine Name: +// +// TiffStreamBitmapHandler::CreateTiffStreamBitmapHandler +// +//Routine Description: +// +// Static factory method that creates an instance of +// TiffStreamBitmapHandler. +// +//Arguments: +// +// pStream - Filter output stream (IPrintWriteStream) +// +//Return Value: +// +// TiffStreamBitmapHandler_t (smart ptr) +// The new TiffStreamBitmapHandler. +// +TiffStreamBitmapHandler_t +TiffStreamBitmapHandler::CreateTiffStreamBitmapHandler( + const IPrintWriteStream_t &pStream + ) +{ + IWICImagingFactory_t pWICFactory; + + // + // Create an instance of a WIC Imaging Factory + // + THROW_ON_FAILED_HRESULT( + ::CoCreateInstance( + CLSID_WICImagingFactory, + NULL, + CLSCTX_INPROC_SERVER, + __uuidof(IWICImagingFactory), + reinterpret_cast<LPVOID*>(&pWICFactory) + ) + ); + + // + // Construct the TiffStreamBitmapHandler and return it + // + TiffStreamBitmapHandler_t toReturn( + new TiffStreamBitmapHandler( + pWICFactory, + pStream + ) + ); + + return toReturn; +} + +// +//Routine Name: +// +// TiffStreamBitmapHandler::TiffStreamBitmapHandler +// +//Routine Description: +// +// Construct the bitmap handler with the WIC factory +// and filter output stream. +// +//Arguments: +// +// pWICFactory - Windows Imaging Components object factory +// pStream - Output stream +// pHG - Encoder cache HGLOBAL +// +TiffStreamBitmapHandler::TiffStreamBitmapHandler( + const IWICImagingFactory_t &pWICFactory, + const IPrintWriteStream_t &pStream + ) : m_pWICFactory(pWICFactory), + m_pWriter(pStream), + m_nextTiffStart(0), + m_numTiffs(0), + m_tiffStarts(0) +{ +} + +// +//Routine Name: +// +// TiffStreamBitmapHandler::ProcessBitmap +// +//Routine Description: +// +// Encode the bitmap as a TIFF and stream out of the filter. +// +//Arguments: +// +// bitmap - bitmap of a single band, to stream +// +void +TiffStreamBitmapHandler::ProcessBitmap( + const IWICBitmap_t &bitmap + ) +{ + + // + // Create an empty HGLOBAL to hold the encode cache + // + SafeHGlobal_t pHG( + new SafeHGlobal(GMEM_SHARE | GMEM_MOVEABLE, 0) + ); + + // + // Create a stream to the encode buffer so that WIC can + // encode the TIFF in-memory + // + IStream_t pIStream; + + THROW_ON_FAILED_HRESULT( + ::CreateStreamOnHGlobal( + *pHG, + FALSE, // Do NOT Free the HGLOBAL on Release of the stream + &pIStream + ) + ); + + // + // Create a WIC TIFF Encoder on the stream + // + IWICBitmapEncoder_t pWICEncoder; + THROW_ON_FAILED_HRESULT( + m_pWICFactory->CreateEncoder(GUID_ContainerFormatTiff, NULL, &pWICEncoder) + ); + THROW_ON_FAILED_HRESULT( + pWICEncoder->Initialize(pIStream, WICBitmapEncoderNoCache) + ); + + // + // Create a new frame for the band and configure it + // + IWICBitmapFrameEncode_t pWICFrame; + IPropertyBag2_t pFramePropertyBag; + + THROW_ON_FAILED_HRESULT( + pWICEncoder->CreateNewFrame(&pWICFrame, &pFramePropertyBag) + ); + + { + // + // Write the compression method to the frame's property bag + // + PROPBAG2 option = { 0 }; + option.pstrName = L"TiffCompressionMethod"; + + VARIANT varValue; + VariantInit(&varValue); + varValue.vt = VT_UI1; + varValue.bVal = WICTiffCompressionLZW; + + THROW_ON_FAILED_HRESULT( + pFramePropertyBag->Write( + 1, // number of properties being set + &option, + &varValue + ) + ); + } + + THROW_ON_FAILED_HRESULT( + pWICFrame->Initialize(pFramePropertyBag) + ); + + // + // Set the frame's size + // + UINT bitmapWidth, bitmapHeight; + THROW_ON_FAILED_HRESULT( + bitmap->GetSize(&bitmapWidth, &bitmapHeight) + ); + THROW_ON_FAILED_HRESULT( + pWICFrame->SetSize(bitmapWidth, bitmapHeight) + ); + + // + // Set the frame's resolution + // + DOUBLE xDPI, yDPI; + THROW_ON_FAILED_HRESULT( + bitmap->GetResolution(&xDPI, &yDPI) + ); + THROW_ON_FAILED_HRESULT( + pWICFrame->SetResolution(xDPI, yDPI) + ); + + // + // Set the frame's pixel format + // + WICPixelFormatGUID format; + THROW_ON_FAILED_HRESULT( + bitmap->GetPixelFormat(&format) + ); + THROW_ON_FAILED_HRESULT( + pWICFrame->SetPixelFormat(&format) + ); + + // + // Write the bitmap data to the frame + // + WICRect rect = {0, 0, 0, 0}; + rect.Width = bitmapWidth; + rect.Height = bitmapHeight; + THROW_ON_FAILED_HRESULT( + pWICFrame->WriteSource(bitmap, &rect) + ); + + // + // Commit the frame and encoder + // + THROW_ON_FAILED_HRESULT( + pWICFrame->Commit() + ); + THROW_ON_FAILED_HRESULT( + pWICEncoder->Commit() + ); + + // + // Get the size of the TIFF from the stream position + // + ULARGE_INTEGER tiffSize; + LARGE_INTEGER zero; + zero.QuadPart = 0; + + THROW_ON_FAILED_HRESULT( + pIStream->Seek(zero, SEEK_CUR, &tiffSize) + ); + + ULONG cb; + + THROW_ON_FAILED_HRESULT( + ::ULongLongToULong(tiffSize.QuadPart, &cb) + ); + + // + // Update the list of Tiff locations so that it can be written to + // the end of the Tiff stream. + // + m_tiffStarts.push_back(m_nextTiffStart); + m_nextTiffStart += tiffSize.QuadPart; + m_numTiffs++; + + { + // + // Get a pointer to the HGLOBAL memory + // + HGlobalLock_t lock = pHG->Lock(); + BYTE *pCache = lock->GetAddress(); + + // + // Write the encoded Tiff to the output stream + // + ULONG written; + + THROW_ON_FAILED_HRESULT( + m_pWriter->WriteBytes(pCache, cb, &written) + ); + } +} + +// +//Routine Name: +// +// TiffStreamBitmapHandler::WriteFooter +// +//Routine Description: +// +// Write the footer to the stream, making it easier +// to decode the individual TIFFs later. The footer +// looks like this: +// +// |<--8 bytes--->| +// +// +--------------+ +// | Tiff 1 start | +// +--------------+ +// | Tiff 2 start | +// +--------------+ +// | ... | +// +--------------+ +// | Tiff N start | +// +--------------+ +// | N | +// +--------------+ +// +void +TiffStreamBitmapHandler::WriteFooter() +{ + ULONG written; + + // + // Write the vector of Tiff starts to the stream, if any Tiffs + // have been written to the stream. + // + if (m_numTiffs > 0) + { + ULONG toWrite; + + THROW_ON_FAILED_HRESULT( + SizeTToULong( + sizeof(ULONGLONG) * m_tiffStarts.size(), + &toWrite + ) + ); + + THROW_ON_FAILED_HRESULT( + m_pWriter->WriteBytes( + reinterpret_cast<BYTE *>(&m_tiffStarts[0]), + toWrite, + &written + ) + ); + } + + // + // Write the number of Tiffs to the stream + // + THROW_ON_FAILED_HRESULT( + m_pWriter->WriteBytes( + reinterpret_cast<BYTE *>(&m_numTiffs), + sizeof(m_numTiffs), + &written + ) + ); +} + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/BitmapHandler.h b/print/XpsRasFilter/src/BitmapHandler.h new file mode 100644 index 00000000..3f78dc30 --- /dev/null +++ b/print/XpsRasFilter/src/BitmapHandler.h @@ -0,0 +1,64 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// BitmapHandler.h +// +// Abstract: +// +// Abstract class that encapsulates the processing done to each +// individual band bitmap, as well as the concrete implemention +// that streams the bands as Tiffs to the output stream. +// + +#pragma once + +namespace xpsrasfilter +{ + +class TiffStreamBitmapHandler +{ +public: + + static + TiffStreamBitmapHandler_t + CreateTiffStreamBitmapHandler( + const IPrintWriteStream_t &pStream + ); + + void + ProcessBitmap( + const IWICBitmap_t &bitmap + ); + + void + WriteFooter(); + +private: + IWICImagingFactory_t m_pWICFactory; + IPrintWriteStream_t m_pWriter; // output stream + + // + // Members to keep track of where each Tiff + // starts in the output stream + // + ULONGLONG m_nextTiffStart; + ULONGLONG m_numTiffs; + std::vector<ULONGLONG> m_tiffStarts; + + // + // Constructor is private; use CreateTiffStreamBitmapHandler + // to create instances + // + TiffStreamBitmapHandler( + const IWICImagingFactory_t &pWICFactory, + const IPrintWriteStream_t &pStream + ); +}; + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/Exception.cpp b/print/XpsRasFilter/src/Exception.cpp new file mode 100644 index 00000000..141c1ac3 --- /dev/null +++ b/print/XpsRasFilter/src/Exception.cpp @@ -0,0 +1,43 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// Exception.cpp +// +// Abstract: +// +// Exception routine definitions. +// + +#include "precomp.h" +#include "WppTrace.h" +#include "Exception.h" + +#include "Exception.tmh" + +namespace xpsrasfilter +{ + +void ThrowHRException( + HRESULT hr, + char const *fileName, + int lineNum + ) +{ + DoTraceMessage( + XPSRASFILTER_TRACE_ERROR, + L"Throwing HRESULT Exception from %s:%d (HRESULT=%!HRESULT!)", + fileName, + lineNum, + hr + ); + + throw hr_error(hr); +} + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/Exception.h b/print/XpsRasFilter/src/Exception.h new file mode 100644 index 00000000..887bfbc4 --- /dev/null +++ b/print/XpsRasFilter/src/Exception.h @@ -0,0 +1,86 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// Exception.h +// +// Abstract: +// +// Exception macro and class declarations. +// + +#pragma once + +// +// Macro to convert HRESULT into an exception throw +// +#ifndef THROW_ON_FAILED_HRESULT +#define THROW_ON_FAILED_HRESULT(func_) \ +{ \ + HRESULT hr_ = func_; \ + if (FAILED(hr_)) { xpsrasfilter::ThrowHRException(hr_, __FILE__, __LINE__); } \ +} +#endif // THROW_ON_FAILED_HRESULT + +#ifndef THROW_LAST_ERROR +#define THROW_LAST_ERROR() \ +{ \ + HRESULT errhr_ = HRESULT_FROM_WIN32(::GetLastError()); \ + THROW_ON_FAILED_HRESULT(errhr_); \ +} +#endif // THROW_LAST_ERROR + +// +// Macro to catch various exceptions, including +// HRESULT-turned-exceptions. +// +// Because we have defined USE_NATIVE_EH=1, the +// catch(...) block will not catch structural +// exceptions. +// +#ifndef CATCH_VARIOUS +#define CATCH_VARIOUS(hr_) \ + catch(std::bad_alloc const& ) \ + { \ + hr_ = E_OUTOFMEMORY; \ + } \ + catch(xpsrasfilter::hr_error const& e) \ + { \ + hr_ = e.hr; \ + } \ + catch(std::exception const& ) \ + { \ + hr_ = E_FAIL; \ + } \ + catch(...) \ + { \ + hr_ = E_UNEXPECTED; \ + } +#endif // CATCH_VARIOUS + +namespace xpsrasfilter +{ + +// +// HRESULT exception +// +struct hr_error +{ + HRESULT hr; + + hr_error(HRESULT hr_in) : hr(hr_in) + { } +}; + +void ThrowHRException( + HRESULT hr, + char const *fileName, + int lineNum + ); + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/OMConvertor.cpp b/print/XpsRasFilter/src/OMConvertor.cpp new file mode 100644 index 00000000..2cd478c2 --- /dev/null +++ b/print/XpsRasFilter/src/OMConvertor.cpp @@ -0,0 +1,774 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// omconvertor.cpp +// +// Abstract: +// +// Object model conversion routines. This class provides routines +// to convert from filter pipeline objects into Xps Object Model +// objects. +// + +#include "precomp.h" +#include "WppTrace.h" +#include "Exception.h" +#include "filtertypes.h" +#include "UnknownBase.h" +#include "OMConvertor.h" + +#include "OMConvertor.tmh" + +namespace xpsrasfilter +{ + +// +//Routine Name: +// +// CreateXpsOMPageFromIFixedPage +// +//Routine Description: +// +// This is the main method called by the filter. It +// proceeds to call the remaining Create* methods +// to convert from the print pipeline Object Model +// to the Xps Object Model. +// +// Takes an IFixedPage (print pipeline Object Model) +// and converts it to an IXpsOMPage (Xps Object Model). +// +//Arguments: +// +// pPageIn - IFixedPage to convert +// pOMFactory - Xps Object Model Object Factory +// pOpcFactory - Opc Object Factory +// +//Return Value: +// +// IXpsOMPage_t (smart pointer) +// Result IXpsOMPage +// +IXpsOMPage_t +CreateXpsOMPageFromIFixedPage( + const IFixedPage_t &pPageIn, + const IXpsOMObjectFactory_t &pOMFactory, + const IOpcFactory_t &pOpcFactory + ) +{ + // + // Get additional page parameters (uri and stream) + // + IOpcPartUri_t pPartUri; + IStream_t pPartStream; + + pPartStream = GetStreamFromPart( + static_cast<IPartBase_t>(pPageIn) + ); + pPartUri = CreateOpcPartUriFromPart( + static_cast<IPartBase_t>(pPageIn), + pOpcFactory + ); + + // + // Call Xps Object Model to create the page resource + // + IXpsOMPage_t pPageOut; + + THROW_ON_FAILED_HRESULT( + pOMFactory->CreatePageFromStream( + pPartStream, + pPartUri, + CollectPageResources(pPageIn, pOMFactory, pOpcFactory), + FALSE, // Do not reuse objects + &pPageOut + ) + ); + + return pPageOut; +} + +// +//Routine Name: +// +// CreateImageFromIPartImage +// +//Routine Description: +// +// Takes an IPartImage (print pipeline Object Model) +// and converts it to an IXpsOMImageResource (Xps Object Model). +// +//Arguments: +// +// pImageIn - IPartImage to convert +// pOMFactory - Xps Object Model Object Factory +// pOpcFactory - Opc Object Factory +// +//Return Value: +// +// IXpsOMImageResource_t (smart pointer) +// Result IXpsOMImageResource +// +IXpsOMImageResource_t +CreateImageFromIPartImage( + const IPartImage_t &pImageIn, + const IXpsOMObjectFactory_t &pOMFactory, + const IOpcFactory_t &pOpcFactory + ) +{ + // + // Get IPartBase parameters (stream and uri) + // + IStream_t pPartStream; + IOpcPartUri_t pPartUri; + + pPartStream = GetStreamFromPart( + static_cast<IPartBase_t>(pImageIn) + ); + pPartUri = CreateOpcPartUriFromPart( + static_cast<IPartBase_t>(pImageIn), + pOpcFactory + ); + + // + // Get the image type and convert it to the corresponding enum + // + BSTR_t strContentType; + XPS_IMAGE_TYPE type = XPS_IMAGE_TYPE_WDP; + + THROW_ON_FAILED_HRESULT( + pImageIn->GetImageProperties(&strContentType) + ); + + if (0 == _wcsicmp(strContentType, L"image/jpeg")) + { + type = XPS_IMAGE_TYPE_JPEG; + } + else if (0 == _wcsicmp(strContentType, L"image/png")) + { + type = XPS_IMAGE_TYPE_PNG; + } + else if (0 == _wcsicmp(strContentType, L"image/tiff")) + { + type = XPS_IMAGE_TYPE_TIFF; + } + else if (0 == _wcsicmp(strContentType, L"image/vnd.ms-photo")) + { + type = XPS_IMAGE_TYPE_WDP; + } + else + { + // + // unknown content type + // + THROW_ON_FAILED_HRESULT(E_INVALIDARG); + } + + // + // Call Xps Object Model to create the image resource + // + IXpsOMImageResource_t pImageOut; + + THROW_ON_FAILED_HRESULT( + pOMFactory->CreateImageResource( + pPartStream, + type, + pPartUri, + &pImageOut + ) + ); + + return pImageOut; +} + +// +//Routine Name: +// +// CreateProfileFromIPartColorProfile +// +//Routine Description: +// +// Takes an IPartColorProfile (print pipeline Object Model) +// and converts it to an IXpsOMColorProfileResource (Xps Object Model). +// +//Arguments: +// +// pProfileIn - IPartColorProfile to convert +// pOMFactory - Xps Object Model Object Factory +// pOpcFactory - Opc Object Factory +// +//Return Value: +// +// IXpsOMColorProfileResource_t (smart pointer) +// Result IXpsOMColorProfileResource +// +IXpsOMColorProfileResource_t +CreateProfileFromIPartColorProfile( + const IPartColorProfile_t &pProfileIn, + const IXpsOMObjectFactory_t &pOMFactory, + const IOpcFactory_t &pOpcFactory + ) +{ + // + // Get IPartBase parameters (stream and uri) + // + IStream_t pPartStream; + IOpcPartUri_t pPartUri; + + pPartStream = GetStreamFromPart( + static_cast<IPartBase_t>(pProfileIn) + ); + pPartUri = CreateOpcPartUriFromPart( + static_cast<IPartBase_t>(pProfileIn), + pOpcFactory + ); + + // + // Call Xps Object Model to create the color profile resource + // + IXpsOMColorProfileResource_t pProfileOut; + + THROW_ON_FAILED_HRESULT( + pOMFactory->CreateColorProfileResource( + pPartStream, + pPartUri, + &pProfileOut + ) + ); + + return pProfileOut; +} + +// +//Routine Name: +// +// CreateDictionaryFromIPartResourceDictionary +// +//Routine Description: +// +// Takes an IPartResourceDictionary (print pipeline Object Model) +// and converts it to an IXpsOMRemoteDictionaryResource (Xps Object Model). +// +//Arguments: +// +// pDictionaryIn - IPartResourceDictionary to convert +// pOMFactory - Xps Object Model Object Factory +// pOpcFactory - Opc Object Factory +// pResources - The resources of the fixed page +// +//Return Value: +// +// IXpsOMRemoteDictionaryResource_t (smart pointer) +// Result IXpsOMRemoteDictionaryResource +// +IXpsOMRemoteDictionaryResource_t +CreateDictionaryFromIPartResourceDictionary( + const IPartResourceDictionary_t &pDictionaryIn, + const IXpsOMObjectFactory_t &pOMFactory, + const IOpcFactory_t &pOpcFactory, + const IXpsOMPartResources_t &pResources + ) +{ + // + // Get IPartBase parameters (stream and uri) + // + IStream_t pPartStream; + IOpcPartUri_t pPartUri; + + pPartStream = GetStreamFromPart( + static_cast<IPartBase_t>(pDictionaryIn) + ); + pPartUri = CreateOpcPartUriFromPart( + static_cast<IPartBase_t>(pDictionaryIn), + pOpcFactory + ); + + // + // Call Xps Object Model to create the remote dictionary resource + // + IXpsOMRemoteDictionaryResource_t pDictionaryOut; + + THROW_ON_FAILED_HRESULT( + pOMFactory->CreateRemoteDictionaryResourceFromStream( + pPartStream, + pPartUri, + pResources, + &pDictionaryOut) + ); + + return pDictionaryOut; +} + +// +//Routine Name: +// +// CreateFontFromIPartFont +// +//Routine Description: +// +// Takes an IPartFont (print pipeline Object Model) +// and converts it to an IXpsOMFontResource (Xps Object Model). +// +//Arguments: +// +// pFontIn - IPartFont to convert +// pFactory - Xps Object Model Object Factory +// pOpcFactory - Opc Object Factory +// +//Return Value: +// +// IXpsOMFontResource_t (smart pointer) +// Result IXpsOMFontResource +// +IXpsOMFontResource_t +CreateFontFromIPartFont( + const IPartFont_t &pFontIn, + const IXpsOMObjectFactory_t &pOMFactory, + const IOpcFactory_t &pOpcFactory + ) +{ + // + // Get IPartBase parameters (stream and uri) + // + IStream_t pPartStream; + IOpcPartUri_t pPartUri; + + pPartStream = GetStreamFromPart( + static_cast<IPartBase_t>(pFontIn) + ); + pPartUri = CreateOpcPartUriFromPart( + static_cast<IPartBase_t>(pFontIn), + pOpcFactory + ); + + // + // Get the font restriction + // + EXpsFontRestriction eFontRestriction = Xps_Restricted_Font_Installable; + + { + IPartFont2_t pFont2In; + + if (SUCCEEDED(pFontIn->QueryInterface(__uuidof(IPartFont2), reinterpret_cast<void **>(&pFont2In)))) + { + pFont2In->GetFontRestriction(&eFontRestriction); + } + } + + // + // Get the font obfuscation + // + EXpsFontOptions eFontOptions; + + { + BSTR_t contentType; + + THROW_ON_FAILED_HRESULT( + pFontIn->GetFontProperties(&contentType, &eFontOptions) + ); + } + + // + // It is necessary to combine the obfuscation and restriction + // attributes from the print pipeline into the one parameter that + // the Xps Object Model consumes. + // + + XPS_FONT_EMBEDDING omEmbedding; + + if (eFontOptions == Font_Normal) + { + omEmbedding = XPS_FONT_EMBEDDING_NORMAL; + } + else if (eFontOptions == Font_Obfusticate && + (eFontRestriction & + (Xps_Restricted_Font_PreviewPrint | + Xps_Restricted_Font_NoEmbedding))) + { + // + // If the font is obfuscated, and either the PreviewPrint or + // NoEmbedding restriction flags are set, then create a + // Restricted font + // + omEmbedding = XPS_FONT_EMBEDDING_RESTRICTED; + } + else + { + omEmbedding = XPS_FONT_EMBEDDING_OBFUSCATED; + } + + // + // Call Xps Object Model to create the font resource + // + IXpsOMFontResource_t pFontOut; + + THROW_ON_FAILED_HRESULT( + pOMFactory->CreateFontResource( + pPartStream, + omEmbedding, + pPartUri, + FALSE, // fonts received from the pipeline are already de-obfuscated + &pFontOut + ) + ); + + return pFontOut; +} + +// +//Routine Name: +// +// CollectPageResources +// +//Routine Description: +// +// Iterates over all of the resources related to +// a fixed page and adds them to a resource +// collection. +// +//Arguments: +// +// pPage - The page to query for resources +// pOMFactory - Xps Object Model Object Factory +// pOpcFactory - Opc Object Factory +// +//Return Value: +// +// IXpsOMPartResources_t (smart pointer) +// The resource collection of all of the resources of the page +// +IXpsOMPartResources_t +CollectPageResources( + const IFixedPage_t &pPage, + const IXpsOMObjectFactory_t &pOMFactory, + const IOpcFactory_t &pOpcFactory + ) +{ + IXpsOMPartResources_t pResources; + + IXpsOMFontResourceCollection_t pFonts; + IXpsOMImageResourceCollection_t pImages; + IXpsOMColorProfileResourceCollection_t pProfiles; + IXpsOMRemoteDictionaryResourceCollection_t pDictionaries; + + // + // collection of resource dictionaries saved for later processing. + // + ResourceDictionaryList_t dictionaryList; + + // + // Create the resource collection and get all of the + // resource-specific sub-collections. + // + THROW_ON_FAILED_HRESULT( + pOMFactory->CreatePartResources(&pResources) + ); + THROW_ON_FAILED_HRESULT( + pResources->GetFontResources(&pFonts) + ); + THROW_ON_FAILED_HRESULT( + pResources->GetImageResources(&pImages) + ); + THROW_ON_FAILED_HRESULT( + pResources->GetColorProfileResources(&pProfiles) + ); + THROW_ON_FAILED_HRESULT( + pResources->GetRemoteDictionaryResources(&pDictionaries) + ); + // + // Get the XpsPartIterator and iterate through all of the parts + // related to this fixed page. + // + IXpsPartIterator_t itPart; + + THROW_ON_FAILED_HRESULT( + pPage->GetXpsPartIterator(&itPart) + ); + + for (; !itPart->IsDone(); itPart->Next()) + { + BSTR_t uri; + IUnknown_t pUnkPart; + + THROW_ON_FAILED_HRESULT( + itPart->Current(&uri, &pUnkPart) + ); + + IPartFont_t pFontPart; + IPartImage_t pImagePart; + IPartColorProfile_t pProfilePart; + IPartResourceDictionary_t pDictionaryPart; + + if (SUCCEEDED(pUnkPart.QueryInterface(&pFontPart))) + { + // + // Convert the font part to Xps Object Model and add it to the + // font resource collection + // + THROW_ON_FAILED_HRESULT( + pFonts->Append( + CreateFontFromIPartFont( + pFontPart, + pOMFactory, + pOpcFactory + ) + ) + ); + } + else if (SUCCEEDED(pUnkPart.QueryInterface(&pImagePart))) + { + // + // Convert the image part to Xps Object Model and add it to the + // image resource collection + // + THROW_ON_FAILED_HRESULT( + pImages->Append( + CreateImageFromIPartImage( + pImagePart, + pOMFactory, + pOpcFactory + ) + ) + ); + } + else if (SUCCEEDED(pUnkPart.QueryInterface(&pProfilePart))) + { + // + // Convert the color profile part to Xps Object Model and add it + // to the color profile resource collection + // + THROW_ON_FAILED_HRESULT( + pProfiles->Append( + CreateProfileFromIPartColorProfile( + pProfilePart, + pOMFactory, + pOpcFactory + ) + ) + ); + } + else if (SUCCEEDED(pUnkPart.QueryInterface(&pDictionaryPart))) + { + // + // In order to process the remote resource dictionary, all of + // its linked resources must be present in pResources. To ensure + // this, we delay the conversion of the remote resource + // dictionaries until all of the other resources have been converted. + // + dictionaryList.push_back(pDictionaryPart); + } + else + { + // + // Any other page resources are ignored + // + } + } + + for (ResourceDictionaryList_t::const_iterator it = dictionaryList.begin(); + it != dictionaryList.end(); + ++it) + { + // + // Convert the remote dictionary to Xps Object Model and add it + // to the remote dictionary collection + // + THROW_ON_FAILED_HRESULT( + pDictionaries->Append( + CreateDictionaryFromIPartResourceDictionary( + *it, + pOMFactory, + pOpcFactory, + pResources + ) + ) + ); + } + + return pResources; +} + +// +//Routine Name: +// +// GetStreamFromPart +// +//Routine Description: +// +// Gets the IStream from this part. +// +//Arguments: +// +// pPart - An Xps Part +// +//Return Value: +// +// IStream_t (smart pointer) +// The stream of the part's content +// +IStream_t +GetStreamFromPart( + const IPartBase_t &pPart + ) +{ + // + // Get the IPrintReadStream for the part from the pipeline Object Model + // + IPrintReadStream_t pStream; + THROW_ON_FAILED_HRESULT( + pPart->GetStream(&pStream) + ); + + return CreateIStreamFromIPrintReadStream(pStream); +} + +// +//Routine Name: +// +// CreateIStreamFromIPrintReadStream +// +//Routine Description: +// +// Creates an IStream from an IPrintReadStream. +// +//Arguments: +// +// pReadStream - A Print Pipeline IPrintReadStream +// +//Return Value: +// +// IStream_t (smart pointer) +// A stream with the same content as the argument stream. +// +IStream_t +CreateIStreamFromIPrintReadStream( + const IPrintReadStream_t &pReadStream + ) +{ + // + // Get the size of the stream + // + ULONGLONG tmpPos; + size_t partSize; + + THROW_ON_FAILED_HRESULT( + pReadStream->Seek(0, SEEK_END, &tmpPos) + ); + + // + // GlobalAlloc can only allocate size_t bytes, so + // throw if the part is larger than that + // + THROW_ON_FAILED_HRESULT( + ULongLongToSizeT(tmpPos, &partSize) + ); + + THROW_ON_FAILED_HRESULT( + pReadStream->Seek(0, SEEK_SET, &tmpPos) + ); + + // + // Allocate an HGLOBAL for the part cache + // + SafeHGlobal_t pHBuf( + new SafeHGlobal(GMEM_FIXED, partSize) + ); + + // + // Read the part into the cache + // + { + // + // Lock the HGLOBAL and get the address of the buffer + // from the RAII lock object + // + HGlobalLock_t lock = pHBuf->Lock(); + BYTE *pBuffer = lock->GetAddress(); + + // + // Allow the number of bytes to read to be clipped to max ULONG + // and then spin on fEOF until the stream is exhausted + // + ULONG numToRead; + + if (FAILED(SizeTToULong(partSize, &numToRead))) + { + numToRead = MAXUINT; + } + + BOOL fEOF; + ULONG numRead; + size_t pos = 0; + + // + // Iterate until all bytes from the stream + // have been read into the buffer + // + do + { + THROW_ON_FAILED_HRESULT( + pReadStream->ReadBytes(pBuffer + pos, numToRead, &numRead, &fEOF) + ); + + pos += numRead; + } while (!fEOF && numRead); + } + + // + // Create an IStream from the part cache + // + IStream_t pIStream = pHBuf->ConvertToIStream(); + + LARGE_INTEGER zero = {0}; + THROW_ON_FAILED_HRESULT( + pIStream->Seek(zero, SEEK_SET, NULL) + ); + + return pIStream; +} + +// +//Routine Name: +// +// CreateOpcPartUriFromPart +// +//Routine Description: +// +// Gets the Opc Uri from the Xps Part. +// +//Arguments: +// +// pPart - An Xps Part +// pFactory - Opc Factory +// +//Return Value: +// +// IOpcPartUri_t (smart pointer) +// The Uri of the part +// +IOpcPartUri_t +CreateOpcPartUriFromPart( + const IPartBase_t &pPart, + const IOpcFactory_t &pFactory + ) +{ + BSTR_t strPartUri; + + THROW_ON_FAILED_HRESULT( + pPart->GetUri(&strPartUri) + ); + + IOpcPartUri_t pPartUri; + THROW_ON_FAILED_HRESULT( + pFactory->CreatePartUri(strPartUri, &pPartUri) + ); + return pPartUri; +} + +} // namespace xpsrasfilter + diff --git a/print/XpsRasFilter/src/OMConvertor.h b/print/XpsRasFilter/src/OMConvertor.h new file mode 100644 index 00000000..7257da3b --- /dev/null +++ b/print/XpsRasFilter/src/OMConvertor.h @@ -0,0 +1,90 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// omconvertor.h +// +// Abstract: +// +// Object model conversion routines. +// + +#pragma once + +namespace xpsrasfilter +{ + +// +// Top-level Create Page routine +// +IXpsOMPage_t +CreateXpsOMPageFromIFixedPage( + const IFixedPage_t &pPageIn, + const IXpsOMObjectFactory_t &pFactory, + const IOpcFactory_t &pOpcFactory + ); + +// +// Individual Part conversion routines +// +IXpsOMImageResource_t +CreateImageFromIPartImage( + const IPartImage_t &pImageIn, + const IXpsOMObjectFactory_t &pFactory, + const IOpcFactory_t &pOpcFactory + ); + +IXpsOMColorProfileResource_t +CreateProfileFromIPartColorProfile( + const IPartColorProfile_t &pProfileIn, + const IXpsOMObjectFactory_t &pFactory, + const IOpcFactory_t &pOpcFactory + ); + +IXpsOMRemoteDictionaryResource_t +CreateDictionaryFromIPartResourceDictionary( + const IPartResourceDictionary_t &pDictionaryIn, + const IXpsOMObjectFactory_t &pFactory, + const IOpcFactory_t &pOpcFactory, + const IXpsOMPartResources_t &pResources + ); + +IXpsOMFontResource_t +CreateFontFromIPartFont( + const IPartFont_t &pFontIn, + const IXpsOMObjectFactory_t &pFactory, + const IOpcFactory_t &pOpcFactory + ); + +// +// Utility Routines +// +IStream_t +GetStreamFromPart( + const IPartBase_t &pPart + ); + +IOpcPartUri_t +CreateOpcPartUriFromPart( + const IPartBase_t &pPart, + const IOpcFactory_t &pOpcFactory + ); + +IXpsOMPartResources_t +CollectPageResources( + const IFixedPage_t &pPage, + const IXpsOMObjectFactory_t &pFactory, + const IOpcFactory_t &pOpcFactory + ); + +IStream_t +CreateIStreamFromIPrintReadStream( + const IPrintReadStream_t &pReadStream + ); + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/PThandler.cpp b/print/XpsRasFilter/src/PThandler.cpp new file mode 100644 index 00000000..6b158032 --- /dev/null +++ b/print/XpsRasFilter/src/PThandler.cpp @@ -0,0 +1,781 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// PThandler.cpp +// +// Abstract: +// +// Print Ticket Handler class definition. +// + +#include "precomp.h" +#include "WppTrace.h" +#include "Exception.h" +#include "filtertypes.h" +#include "UnknownBase.h" +#include "OMConvertor.h" +#include "rasinterface.h" +#include "xpsrasfilter.h" +#include "PTHandler.h" + +#include "PThandler.tmh" + +namespace xpsrasfilter +{ + +// +// This is an arbitrary page margin that is used to simulate +// an imageable area for scaling calculations. +// +const FLOAT g_pageMargin = 0.25f; + +// +//Routine Name: +// +// PrintTicketHandler::CreatePrintTicketHandler +// +//Routine Description: +// +// Static factory method that creates an instance of +// PrintTicketHandler. +// +//Arguments: +// +// pPropertyBag - Property Bag +// +//Return Value: +// +// PrintTicketHandler_t (smart ptr) +// The new PrintTicketHandler. +// +PrintTicketHandler_t +PrintTicketHandler::CreatePrintTicketHandler( + const IPrintPipelinePropertyBag_t &pPropertyBag + ) +{ + // + // Create MSXML DOM document + // + IXMLDOMDocument2_t pDOMDoc; + + THROW_ON_FAILED_HRESULT( + ::CoCreateInstance( + __uuidof(DOMDocument60), + NULL, + CLSCTX_INPROC_SERVER, + __uuidof(IXMLDOMDocument2), + reinterpret_cast<LPVOID*>(&pDOMDoc) + ) + ); + + // + // Get the default user Print Ticket Stream Factory + // + Variant_t varUserPrintTicket; + THROW_ON_FAILED_HRESULT( + pPropertyBag->GetProperty( + XPS_FP_USER_PRINT_TICKET, + &varUserPrintTicket + ) + ); + IUnknown_t pUnk = varUserPrintTicket.punkVal; + + IPrintReadStreamFactory_t pStreamFactory; + + THROW_ON_FAILED_HRESULT( + pUnk.QueryInterface(&pStreamFactory) + ); + + // + // Get the default user Print Ticket stream + // and wrap it in an IStream + // + + IPrintReadStream_t pUserPrintTicketStream; + + THROW_ON_FAILED_HRESULT( + pStreamFactory->GetStream(&pUserPrintTicketStream) + ); + + IStream_t pUserPrintTicket = + CreateIStreamFromIPrintReadStream(pUserPrintTicketStream); + + // + // Get the Printer Name + // + Variant_t varPrinterName; + THROW_ON_FAILED_HRESULT( + pPropertyBag->GetProperty( + XPS_FP_PRINTER_NAME, + &varPrinterName + ) + ); + + BSTR_t pPrinterName(varPrinterName.bstrVal); + + // + // Get the User Security Token + // Avoid CComVariant if getting the XPS_FP_USER_TOKEN property. + // Please refer to http://go.microsoft.com/fwlink/?LinkID=255534 for detailed information. + // + SafeVariant varUserSecurityToken; + THROW_ON_FAILED_HRESULT( + pPropertyBag->GetProperty( + XPS_FP_USER_TOKEN, + &varUserSecurityToken + ) + ); + + // + // Open the Print Ticket Provider + // + SafeHPTProvider_t pHProvider( + new SafeHPTProvider( + pPrinterName, + varUserSecurityToken.byref + ) + ); + + PrintTicketHandler_t toReturn( + new PrintTicketHandler( + pDOMDoc, + pHProvider, + pUserPrintTicket + ) + ); + + return toReturn; +} + +// +//Routine Name: +// +// PrintTicketHandler::PrintTicketHandler +// +//Routine Description: +// +// Constructor for the Print Ticket Handler. +// +//Arguments: +// +// pDoc - initialized MSXML DOM document +// pHProvider - handle to the Print Ticket Provider +// +PrintTicketHandler::PrintTicketHandler( + const IXMLDOMDocument2_t &pDoc, + SafeHPTProvider_t pHProvider, + const IStream_t &pUserPrintTicket + ) : m_pDOMDoc(pDoc), + m_pHProvider(pHProvider), + m_pDefaultUserPrintTicket(pUserPrintTicket) +{ +} + +// +//Routine Name: +// +// PrintTicketHandler::ProcessPrintTicket +// +//Routine Description: +// +// Gets the print ticket from the part, merges with +// the base ticket, and returns the result. +// +//Arguments: +// +// pBasePrintTicket - Base Print Ticket +// pDeltaPrintTicketPart - Delta Print Pipeline Print Ticket Part +// scope - Scope of the merged Print Ticket +// +//Return Value: +// +// IStream_t (smart pointer) +// Merged stream +// +IStream_t +PrintTicketHandler::ProcessPrintTicket( + const IStream_t &pBasePrintTicket, + const IPartPrintTicket_t &pDeltaPrintTicketPart, + EPrintTicketScope scope + ) +{ + IStream_t pMergedPrintTicket; + IStream_t pDeltaPrintTicket; + + pDeltaPrintTicket = GetStreamFromPart( + static_cast<IPartBase_t>(pDeltaPrintTicketPart) + ); + + // + // Before calling PTMergeAndValidatePrintTicket, both input + // Print Ticket streams MUST be at position 0. The temp Print + // Ticket stream is already at position 0, but the Base Print + // Ticket may not be. Seek it to 0 to be sure. + // + LARGE_INTEGER zero; + zero.QuadPart = 0; + THROW_ON_FAILED_HRESULT( + pBasePrintTicket->Seek(zero, SEEK_SET, NULL) + ); + + // + // Merge the delta Print Ticket with the + // base Print Ticket + // + THROW_ON_FAILED_HRESULT( + ::CreateStreamOnHGlobal( + NULL, + TRUE, // delete on release + &pMergedPrintTicket + ) + ); + + m_pHProvider->PTMergeAndValidatePrintTicket( + pBasePrintTicket, + pDeltaPrintTicket, + scope, + pMergedPrintTicket + ); + + return pMergedPrintTicket; +} + +// +//Routine Name: +// +// PrintTicketHandler::ProcessPart +// +//Routine Description: +// +// Merges the Fixed Document Sequence Print Ticket with +// the default user Print Ticket and caches the result. +// +//Arguments: +// +// pFDS - Fixed Document Sequence part +// +void +PrintTicketHandler::ProcessPart( + const IFixedDocumentSequence_t &pFDS + ) +{ + IPartPrintTicket_t pPrintTicket; + + HRESULT hr = pFDS->GetPrintTicket(&pPrintTicket); + + // + // E_ELEMENT_NOT_FOUND means that this Fixed Document Sequence + // does not have a Print Ticket. Propagate the Default User + // Print Ticket. + // All other failed HRESULTs should be thrown. + // + if (hr == E_ELEMENT_NOT_FOUND) + { + m_pJobPrintTicket = m_pDefaultUserPrintTicket; + return; + } + + THROW_ON_FAILED_HRESULT(hr); + + m_pDocumentPrintTicket = NULL; + m_pPagePrintTicket = NULL; + + m_pJobPrintTicket = ProcessPrintTicket( + m_pDefaultUserPrintTicket, + pPrintTicket, + kPTJobScope + ); +} + +// +//Routine Name: +// +// PrintTicketHandler::ProcessPart +// +//Routine Description: +// +// Merges the Fixed Document Print Ticket with the +// Fixed Document Sequence Print Ticket and caches +// the result. The tickets are merged at the Document +// scope, so the result contains no job-level features. +// +//Arguments: +// +// pFD - Fixed Document part +// +void +PrintTicketHandler::ProcessPart( + const IFixedDocument_t &pFD + ) +{ + IPartPrintTicket_t pPrintTicket; + + HRESULT hr = pFD->GetPrintTicket(&pPrintTicket); + + // + // E_ELEMENT_NOT_FOUND means that this Fixed Document + // does not have a Print Ticket. Propagate the Job + // Print Ticket. + // All other failed HRESULTs should be thrown. + // + if (hr == E_ELEMENT_NOT_FOUND) + { + m_pDocumentPrintTicket = m_pJobPrintTicket; + return; + } + + THROW_ON_FAILED_HRESULT(hr); + + m_pPagePrintTicket = NULL; + + m_pDocumentPrintTicket = ProcessPrintTicket( + m_pJobPrintTicket, + pPrintTicket, + kPTDocumentScope + ); +} + +// +//Routine Name: +// +// PrintTicketHandler::ProcessPart +// +//Routine Description: +// +// Merges the Fixed Page Print Ticket with the +// Fixed Document Print Ticket and caches the result. +// The tickets are merged at the Page scope, so the +// result contains no job-level or document-level features. +// +//Arguments: +// +// pFP - Fixed Page part +// +void +PrintTicketHandler::ProcessPart( + const IFixedPage_t &pFP + ) +{ + IPartPrintTicket_t pPrintTicket; + + HRESULT hr = pFP->GetPrintTicket(&pPrintTicket); + + // + // E_ELEMENT_NOT_FOUND means that this Fixed Page + // does not have a Print Ticket. Propagate the Document + // Print Ticket. + // All other failed HRESULTs should be thrown. + // + if (hr == E_ELEMENT_NOT_FOUND) + { + m_pPagePrintTicket = m_pDocumentPrintTicket; + return; + } + + THROW_ON_FAILED_HRESULT(hr); + + m_pPagePrintTicket = ProcessPrintTicket( + m_pDocumentPrintTicket, + pPrintTicket, + kPTPageScope + ); +} + +// +//Routine Name: +// +// PrintTicketHandler::GetMergedPrintTicketParams +// +//Routine Description: +// +// Queries a set of parameters from the merged print ticket. +// +// NOTE: Relies on successful calls to all three PrintTicket +// processing methods. +// +//Return Value: +// +// ParametersFromPrintTicket +// The set of parameters queried from the merged +// Print Ticket. +// +ParametersFromPrintTicket +PrintTicketHandler::GetMergedPrintTicketParams() +{ + DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Getting Print Ticket parameters"); + + if (!m_pPagePrintTicket) + { + DoTraceMessage(XPSRASFILTER_TRACE_ERROR, L"GetMergedPrintTicketParams called before ProcessPagePrintTicket"); + THROW_ON_FAILED_HRESULT(E_FAIL); + } + + ParametersFromPrintTicket params; + + // + // Seek the Page-level Print Ticket to 0 + // + LARGE_INTEGER zero; + zero.QuadPart = 0; + THROW_ON_FAILED_HRESULT( + m_pPagePrintTicket->Seek(zero, SEEK_SET, NULL) + ); + + // + // Load the print ticket stream into a DOM document + // + // NOTE: We are only looking for features at the Page scope for this sample, + // so we only extract features from the effective page-level PrintTicket. + // + Variant_t varStream(m_pPagePrintTicket); + VARIANT_BOOL success; + + THROW_ON_FAILED_HRESULT( + m_pDOMDoc->load(varStream, &success) + ); + if (!success) + { + WPP_LOG_ON_FAILED_HRESULT(E_FAIL); + THROW_ON_FAILED_HRESULT(E_FAIL); + } + + // + // Set the DOM Selection namespace to simplify queries + // + BSTR_t ns(L"xmlns:psf='http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework'"); + Variant_t nsProp(ns); + THROW_ON_FAILED_HRESULT( + m_pDOMDoc->setProperty(L"SelectionNamespaces", nsProp) + ); + + // + // Query the print ticket for parameters of interest + // + params.destDPI = QueryDPI(); + params.scaling = QueryScaling(); + params.physicalPageSize = QueryPhysicalPageSize(); + + // + // We simulate imageable area by assuming a constant margin of + // around the entire page + // + params.imageableArea.x = g_pageMargin * xpsDPI; + params.imageableArea.y = g_pageMargin * xpsDPI; + params.imageableArea.height = params.physicalPageSize.height + - 2 * g_pageMargin * xpsDPI; + params.imageableArea.width = params.physicalPageSize.width + - 2 * g_pageMargin * xpsDPI; + + return params; +} + +// +//Routine Name: +// +// PrintTicketHandler::QueryDPI +// +//Routine Description: +// +// Queries the DPI from the Print Ticket using an XPath query. +// +//Return Value: +// +// FLOAT +// DPI from the Print Ticket. +// +FLOAT +PrintTicketHandler::QueryDPI() +{ + // + // Default DPI: 96 DPI + // + FLOAT dpi = 96.0; + + // + // Perform the page resolution query on the print ticket + // + IXMLDOMNodeList_t pNodes; + + // + // The following XPath query is fairly straightforward, except for the + // predicate attached to Feature. This is necessary to match both the + // keyword AND the namespace of the "name" of the Feature as in: + // + // <psf:Feature name="psk:PageResolution"> + // + // In order to match the keyword, we match the substring after the colon: + // + // [substring-after(@name,':')='PageResolution'] + // + // We also need to ensure that the namespace refers to the correct + // printschemakeywords namespace. Thus we get: + // + // [name(namespace::*[.=PRINTSCHEMAKEYWORDNS])=substring-before(@name,':')] + // + // where PRINTSCHEMAKEYWORDNS is: + // + // http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords + // + BSTR_t query(L"psf:PrintTicket/psf:Feature[substring-after(@name,':')='PageResolution']" + L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" + L"/*/*/psf:Value"); + + THROW_ON_FAILED_HRESULT( + m_pDOMDoc->selectNodes(query, &pNodes) + ); + + if (pNodes) + { + // + // The Print Ticket may have both X and Y resolutions defined, but + // the Xps Rasterization Service only accepts a single resolution. + // We query for both X and Y resolutions and take the larger of the + // two as the destination DPI. The resultant raster data could then + // be scaled down in the other dimension to achieve the non-square + // pixels. + // + + LONG numResolutions; + + THROW_ON_FAILED_HRESULT( + pNodes->get_length(&numResolutions) + ); + + if (numResolutions != 0 && + numResolutions != 1 && + numResolutions != 2) + { + // + // We expect 0, 1, or 2 resolutions to be set in the Print Ticket. + // Throw if this is not the case. + // + THROW_ON_FAILED_HRESULT(E_UNEXPECTED); + } + + LONG maxResolution = 0; + + for (INT i = 0; i < numResolutions; i++) + { + IXMLDOMNode_t pCurrentNode; + + THROW_ON_FAILED_HRESULT( + pNodes->get_item(i, &pCurrentNode) + ); + + BSTR_t strResolution; + + THROW_ON_FAILED_HRESULT( + pCurrentNode->get_text(&strResolution) + ); + + LONG resolution; + + THROW_ON_FAILED_HRESULT( + ::VarI4FromStr( + strResolution, + LOCALE_USER_DEFAULT, + 0, // no custom flags + &resolution + ) + ); + + if (resolution > maxResolution) + { + maxResolution = resolution; + } + } + + dpi = static_cast<FLOAT>(maxResolution); + } + + DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Got DPI: %f", dpi); + + return dpi; +} + +// +//Routine Name: +// +// PrintTicketHandler::QueryPhysicalPageSize +// +//Routine Description: +// +// Queries the physical page size from the +// Print Ticket using an XPath query. +// +//Return Value: +// +// XPS_SIZE +// Physical page size from the Print Ticket (in XPS units). +// +XPS_SIZE +PrintTicketHandler::QueryPhysicalPageSize() +{ + // + // Default page size: 8.5" x 11" at Xps DPI + // + XPS_SIZE pageSize = {11.0f * xpsDPI, + 8.5f * xpsDPI}; + + { + // + // Perform the page width query on the print ticket + // + IXMLDOMNode_t pNode; + + // + // See the comment in PrintTicketHandler::QueryDPI() for details + // about this XPath query. + // + BSTR_t query(L"psf:PrintTicket/psf:Feature[substring-after(@name,':')='PageMediaSize']" + L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" + L"/*/psf:ScoredProperty[substring-after(@name,':')='MediaSizeWidth']" + L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" + L"/psf:Value"); + + THROW_ON_FAILED_HRESULT( + m_pDOMDoc->selectSingleNode(query, &pNode) + ); + + if (pNode) + { + BSTR_t strWidth; + THROW_ON_FAILED_HRESULT( + pNode->get_text(&strWidth) + ); + + LONG width; + THROW_ON_FAILED_HRESULT( + ::VarI4FromStr( + strWidth, + LOCALE_USER_DEFAULT, + 0, // no custom flags + &width + ) + ); + + // + // the page dimensions are in microns; convert to Xps units + // + pageSize.width = MicronsToXpsUnits(width); + } + } + + { + // + // Perform the page height query on the print ticket + // + IXMLDOMNode_t pNode; + + // + // See the comment in PrintTicketHandler::QueryDPI() for details + // about this XPath query. + // + BSTR_t query(L"psf:PrintTicket/psf:Feature[substring-after(@name,':')='PageMediaSize']" + L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" + L"/*/psf:ScoredProperty[substring-after(@name,':')='MediaSizeHeight']" + L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" + L"/psf:Value"); + + THROW_ON_FAILED_HRESULT( + m_pDOMDoc->selectSingleNode(query, &pNode) + ); + + if (pNode) + { + BSTR_t strHeight; + THROW_ON_FAILED_HRESULT( + pNode->get_text(&strHeight) + ); + + LONG height; + THROW_ON_FAILED_HRESULT( + ::VarI4FromStr( + strHeight, + LOCALE_USER_DEFAULT, + 0, // no custom flags + &height + ) + ); + + // + // the page dimensions are in microns; convert to Xps unit + // + pageSize.height = MicronsToXpsUnits(height); + } + } + + { + // + // Perform the landscape query on the print ticket + // + IXMLDOMNode_t pNode; + + // + // See the comment in PrintTicketHandler::QueryDPI() for details + // about this XPath query. + // + BSTR_t query(L"psf:PrintTicket/psf:Feature[substring-after(@name,':')='PageOrientation']" + L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]" + L"/psf:Option[substring-after(@name,':')='Landscape']" + L"[name(namespace::*[.='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords'])=substring-before(@name,':')]"); + + THROW_ON_FAILED_HRESULT( + m_pDOMDoc->selectSingleNode(query, &pNode) + ); + + if (pNode) + { + // + // landscape. swap height and width. + // + FLOAT tmp; + + tmp = pageSize.height; + pageSize.height = pageSize.width; + pageSize.width = tmp; + } + + DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Physical Page Size: %f x %f", pageSize.width, pageSize.height); + } + + return pageSize; +} + +// +//Routine Name: +// +// PrintTicketHandler::QueryScaling +// +//Routine Description: +// +// Queries the desired type of scaling from the +// Print Ticket using an XPath query. +// +//Return Value: +// +// PrintTicketScaling +// Scaling type from the Print Ticket. +// +PrintTicketScaling +PrintTicketHandler::QueryScaling() +{ + // + // Default Scaling: FitApplicationBleedSizeToPageImageableSize + // + PrintTicketScaling scaling = SCALE_BLEEDTOIMAGEABLE; + + // + // We do not query for media scaling. Rather, we always return + // the equivalent of FitApplicationBleedSizeToPageImageableSize + // + return scaling; +} + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/PThandler.h b/print/XpsRasFilter/src/PThandler.h new file mode 100644 index 00000000..103e5d78 --- /dev/null +++ b/print/XpsRasFilter/src/PThandler.h @@ -0,0 +1,112 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// PThandler.h +// +// Abstract: +// +// Print Ticket Handler class declaration. +// + +#pragma once + +namespace xpsrasfilter +{ + +class PrintTicketHandler +{ +public: + static + PrintTicketHandler_t + CreatePrintTicketHandler( + const IPrintPipelinePropertyBag_t &pPropertyBag + ); + + void + ProcessPart( + const IFixedDocumentSequence_t &pFDS + ); + + void + ProcessPart( + const IFixedDocument_t &pFD + ); + + void + ProcessPart( + const IFixedPage_t &pFP + ); + + ParametersFromPrintTicket + GetMergedPrintTicketParams(); + +private: + // + // Constructor is private; use CreatePrintTicketHandler + // to create instances. + // + PrintTicketHandler( + const IXMLDOMDocument2_t &pDoc, + SafeHPTProvider_t pHProvider, + const IStream_t &pUserPrintTicket + ); + + IStream_t + ProcessPrintTicket( + const IStream_t &pBasePrintTicket, + const IPartPrintTicket_t &pDeltaPrintTicketPart, + EPrintTicketScope scope + ); + + // + // Inline function to convert from microns to Xps Units + // + inline + FLOAT + MicronsToXpsUnits( + long dimensionInMicrons + ) + { + const FLOAT micronsPerInch = 25400.0f; // 2.54 cm/in --> 25400 um/in + + return ((static_cast<FLOAT>(dimensionInMicrons) / micronsPerInch) * xpsDPI); + } + + // + // Routines to query parameters from the DOM document + // + FLOAT + QueryDPI(); + + XPS_SIZE + QueryPhysicalPageSize(); + + PrintTicketScaling + QueryScaling(); + + // + // MSXML DOM document + // + IXMLDOMDocument2_t m_pDOMDoc; + + // + // Handle to the Print Ticket Provider + // + SafeHPTProvider_t m_pHProvider; + + // + // Cached Print Tickets + // + IStream_t m_pDefaultUserPrintTicket; + IStream_t m_pJobPrintTicket; + IStream_t m_pDocumentPrintTicket; + IStream_t m_pPagePrintTicket; +}; + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/UnknownBase.h b/print/XpsRasFilter/src/UnknownBase.h new file mode 100644 index 00000000..5ecd2487 --- /dev/null +++ b/print/XpsRasFilter/src/UnknownBase.h @@ -0,0 +1,158 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// UnknownBase.h +// +// Abstract: +// +// IUnknown implementation common to filter components derived from +// IUnknown. +// + +#pragma once + +namespace xpsrasfilter +{ + +template <class Interface> +class UnknownBase : public Interface +{ +public: + UnknownBase() : m_cRef(1) { } + virtual ~UnknownBase() { }; + + // + //Routine Name: + // + // UnknownBase::QueryInterface + // + //Routine Description: + // + // Implements IUnknown QueryInterface. + // + //Arguments: + // + // riid - id of the interface + // ppv - void pointer to the requested interface + // + //Return Value: + // + // HRESULT + // S_OK - On success + // E_NOINTERFACE - Invalid interface + // + _Must_inspect_result_ + HRESULT STDMETHODCALLTYPE + QueryInterface( + _In_ REFIID riid, + _Outptr_ PVOID *ppv + ) + { + HRESULT hr = S_OK; + + if (ppv == NULL) + { + WPP_LOG_ON_FAILED_HRESULT(E_POINTER); + + return E_POINTER; + } + + if (riid == IID_IUnknown) + { + *ppv = static_cast<IUnknown *>(this); + } + else if (riid == __uuidof(Interface)) + { + *ppv = static_cast<Interface *>(this); + } + else + { + *ppv = NULL; + WPP_LOG_ON_FAILED_HRESULT( + hr = E_NOINTERFACE + ); + } + + if (SUCCEEDED(hr)) + { + AddRef(); + } + + return hr; + } + + // + //Routine Name: + // + // UnknownBase::AddRef + // + //Routine Description: + // + // Implements IUnknown reference count increment + // on the current interface. + // + //Arguments: + // + // None + // + //Return Value: + // + // ULONG + // New reference count + // + ULONG STDMETHODCALLTYPE + AddRef() + { + return ::InterlockedIncrement(&m_cRef); + } + + // + //Routine Name: + // + // UnknownBase::Release + // + //Routine Description: + // + // Implements IUnknown reference count decrement + // on the current interface. + // + //Arguments: + // + // None + // + //Return Value: + // + // ULONG + // New reference count + // + //Note: + // + // The drv_at annotation tells Prefast to consider this object's memory + // freed after Release has been called. + // + _At_(this, __drv_freesMem(object)) + ULONG STDMETHODCALLTYPE + Release() + { + ULONG cRef = ::InterlockedDecrement(&m_cRef); + + if (0 == cRef) + { + delete this; + } + + return cRef; + } + +private: + volatile ULONG m_cRef; // interface reference count +}; + +} // namespace xpsrasfilter + diff --git a/print/XpsRasFilter/src/WppTrace.cpp b/print/XpsRasFilter/src/WppTrace.cpp new file mode 100644 index 00000000..b788c461 --- /dev/null +++ b/print/XpsRasFilter/src/WppTrace.cpp @@ -0,0 +1,41 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// WppTrace.h +// +// Abstract: +// +// WPP tracing definitions. +// + +#include "precomp.h" +#include "WppTrace.h" + +#include "WppTrace.tmh" + +namespace xpsrasfilter +{ + +void TraceFailedHRESULT( + HRESULT hr, + char const *fileName, + int lineNum, + wchar_t const *extraText + ) +{ + DoTraceMessage(XPSRASFILTER_TRACE_ERROR, + "Failed HRESULT (%!HRESULT!) at %s:%d (%S)", + hr, + fileName, + lineNum, + extraText + ); +} + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/WppTrace.h b/print/XpsRasFilter/src/WppTrace.h new file mode 100644 index 00000000..4f33db3b --- /dev/null +++ b/print/XpsRasFilter/src/WppTrace.h @@ -0,0 +1,58 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// WppTrace.h +// +// Abstract: +// +// WPP tracing definitions. +// + +#pragma once + +#define WPP_CONTROL_GUIDS WPP_DEFINE_CONTROL_GUID( \ + XpsRasFilter, \ + (EB4C6075, 0B67, 4a79, A0A3, 7CD9DF881194), \ + WPP_DEFINE_BIT(XPSRASFILTER_TRACE_ERROR) \ + WPP_DEFINE_BIT(XPSRASFILTER_TRACE_WARNING) \ + WPP_DEFINE_BIT(XPSRASFILTER_TRACE_INFO) \ + WPP_DEFINE_BIT(XPSRASFILTER_TRACE_VERBOSE) \ + ) + +#define WPP_LOG_ON_FAILED_HRESULT_WITH_TEXT(func_,text_) \ + { \ + HRESULT hr_ = func_; \ + if (FAILED(hr_)) \ + { \ + xpsrasfilter::TraceFailedHRESULT( \ + hr_, \ + __FILE__, \ + __LINE__, \ + text_ \ + ); \ + } \ + } + +#define WPP_LOG_ON_FAILED_HRESULT(func_) \ + { \ + WPP_LOG_ON_FAILED_HRESULT_WITH_TEXT(func_, L"") \ + } + +namespace xpsrasfilter +{ + +void +TraceFailedHRESULT( + HRESULT hr, + char const *fileName, + int lineNum, + wchar_t const *extraText + ); + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/dllentry.cpp b/print/XpsRasFilter/src/dllentry.cpp new file mode 100644 index 00000000..8e19ae16 --- /dev/null +++ b/print/XpsRasFilter/src/dllentry.cpp @@ -0,0 +1,326 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// dllentry.cpp +// +// Abstract: +// +// Xps Rasterization Service filter DLL entry points. +// + +#include "precomp.h" +#include "WppTrace.h" +#include "Exception.h" +#include "filtertypes.h" +#include "UnknownBase.h" +#include "xpsrasfilter.h" + +#include "dllentry.tmh" + +namespace xpsrasfilter +{ + +// +// Class Factory returned by DllGetClassObject() +// +class __declspec( uuid("CFF7BE69-E62D-403b-BE4F-48EC73F5DA1A") ) XPSRasFilterFactory : public UnknownBase<IClassFactory> +{ +public: + XPSRasFilterFactory() : + m_serverLocks(0) + { + ::InterlockedIncrement(&XPSRasFilter::ms_numObjects); + } + + ~XPSRasFilterFactory() + { + ::InterlockedDecrement(&XPSRasFilter::ms_numObjects); + } + + // + //Routine Name: + // + // XPSRasFilterFactory::CreateInstance + // + //Routine Description: + // + // Returns an instance of XPSRasFilter. + // + //Arguments: + // + // pUnkOuter - Outer class (must be NULL) + // riid - Requested interface (IPrintPipelineFilter) + // ppvObject - Pointer to the requested interface + // + //Return Value: + // + // HRESULT + // S_OK - On success + // Otherwise - Failure + // + HRESULT + STDMETHODCALLTYPE + CreateInstance( + IUnknown *pUnkOuter, + REFIID riid, + void **ppvObject + ) + { + HRESULT hr = S_OK; + + if (pUnkOuter != NULL) + { + WPP_LOG_ON_FAILED_HRESULT(CLASS_E_NOAGGREGATION); + + return CLASS_E_NOAGGREGATION; + } + + if (ppvObject == NULL) + { + WPP_LOG_ON_FAILED_HRESULT(E_POINTER); + + return E_POINTER; + } + + *ppvObject = NULL; + + xpsrasfilter::XPSRasFilter *pFilter = NULL; + + // + // XpsRasFilter::XpsRasFilter() can throw, as can new + // + try + { + DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"Instantiating filter"); + pFilter = new xpsrasfilter::XPSRasFilter(); + } + CATCH_VARIOUS(hr) + + if (SUCCEEDED(hr)) + { + WPP_LOG_ON_FAILED_HRESULT( + hr = pFilter->QueryInterface(riid, ppvObject) + ); + + pFilter->Release(); + } + + return hr; + } + + // + //Routine Name: + // + // XPSRasFilterFactory::LockServer + // + //Routine Description: + // + // Allows clients to lock the filter factory in + // memory. + // + //Arguments: + // + // fLock - TRUE - lock; FALSE - unlock + // + //Return Value: + // + // HRESULT + // S_OK - On success + // + HRESULT + STDMETHODCALLTYPE + LockServer( + BOOL fLock + ) + { + LONG result; + + if (fLock) // lock + { + result = ::InterlockedIncrement(&m_serverLocks); + + if (result == 1) + { + // + // This was the first 'lock' call; increment the + // global numObjects + // + ::InterlockedIncrement(&XPSRasFilter::ms_numObjects); + } + } + else // unlock + { + result = ::InterlockedDecrement(&m_serverLocks); + + if (result == 0) + { + // + // All locks have been unlocked; decrement the + // global numObjects + // + ::InterlockedDecrement(&XPSRasFilter::ms_numObjects); + } + } + + return S_OK; + } + +private: + volatile LONG m_serverLocks; +}; + +} // namespace xpsrasfilter + +// +//Routine Name: +// +// DllGetClassObject +// +//Routine Description: +// +// Returns an instance of XPSRasFilterFactory. +// +//Arguments: +// +// rclsid - Requested class (XPSRasFilter) +// riid - Requested interface (IClassFactory) +// ppv - Pointer to the requested interface +// +//Return Value: +// +// HRESULT +// S_OK - On success +// Otherwise - Failure +// +STDAPI +DllGetClassObject( + _In_ REFCLSID rclsid, + _In_ REFIID riid, + _Outptr_ LPVOID *ppv + ) +{ + HRESULT hr = S_OK; + + if (ppv == NULL) + { + WPP_LOG_ON_FAILED_HRESULT(E_POINTER); + + return E_POINTER; + } + + *ppv = NULL; + + if (rclsid != __uuidof(xpsrasfilter::XPSRasFilterFactory)) + { + WPP_LOG_ON_FAILED_HRESULT(CLASS_E_CLASSNOTAVAILABLE); + + return CLASS_E_CLASSNOTAVAILABLE; + } + + DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"Instantiating class factory"); + + xpsrasfilter::XPSRasFilterFactory *pFactory = NULL; + pFactory = new(std::nothrow) xpsrasfilter::XPSRasFilterFactory(); + + if (pFactory == NULL) + { + WPP_LOG_ON_FAILED_HRESULT(E_OUTOFMEMORY); + + hr = E_OUTOFMEMORY; + } + + if (SUCCEEDED(hr)) + { + WPP_LOG_ON_FAILED_HRESULT( + hr = pFactory->QueryInterface(riid, ppv) + ); + + pFactory->Release(); + } + + return hr; +} + +// +//Routine Name: +// +// DllCanUnloadNow +// +//Routine Description: +// +// Checks whether the DLL can be unloaded. That is, +// whether there are any instances of XPSRasFilter. +// +//Arguments: +// +// None +// +//Return Value: +// +// HRESULT +// S_OK - Can unload. +// Otherwise - Cannot unload. +// +STDAPI +DllCanUnloadNow() +{ + return (0 == xpsrasfilter::XPSRasFilter::ms_numObjects) ? S_OK : S_FALSE; +} + +// +//Routine Name: +// +// DllMain +// +//Routine Description: +// +// Initializes WPP tracing when the DLL is loaded +// and cleans up WPP tracing when the DLL is unloaded. +// +//Arguments: +// +// None +// +//Return Value: +// +// HRESULT +// S_OK - On success. +// Otherwise - Otherwise. +// +extern "C" +BOOL +WINAPI +DllMain( + _In_ HINSTANCE hinstDLL, + _In_ DWORD fdwReason, + _In_opt_ LPVOID /*lpvReserved*/ + ) +{ + switch(fdwReason) + { + case DLL_PROCESS_ATTACH: + + ::DisableThreadLibraryCalls(hinstDLL); + + WPP_INIT_TRACING(L"XpsRasFilter"); + DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"DLL_PROCESS_ATTACH"); + + break; + + case DLL_PROCESS_DETACH: + + DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"DLL_PROCESS_DETACH"); + WPP_CLEANUP(); + + break; + } + + return TRUE; +} + diff --git a/print/XpsRasFilter/src/filtertypes.h b/print/XpsRasFilter/src/filtertypes.h new file mode 100644 index 00000000..6b5c35e6 --- /dev/null +++ b/print/XpsRasFilter/src/filtertypes.h @@ -0,0 +1,497 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// filtertypes.h +// +// Abstract: +// +// Smart pointer types. Shared structures and enums. +// + +#pragma once + +// +// XpsDrv Print Pipeline types +// +typedef CComPtr<IXpsDocument> IXpsDocument_t; +typedef CComPtr<IFixedDocumentSequence> IFixedDocumentSequence_t; +typedef CComPtr<IFixedDocument> IFixedDocument_t; +typedef CComPtr<IFixedPage> IFixedPage_t; +typedef CComPtr<IPrintReadStreamFactory> IPrintReadStreamFactory_t; +typedef CComPtr<IPrintReadStream> IPrintReadStream_t; +typedef CComPtr<IPrintWriteStream> IPrintWriteStream_t; +typedef CComPtr<IInterFilterCommunicator> IInterFilterCommunicator_t; +typedef CComPtr<IPrintPipelinePropertyBag> IPrintPipelinePropertyBag_t; +typedef CComPtr<IPrintPipelineManagerControl> IPrintPipelineManagerControl_t; +typedef CComPtr<IXpsDocumentProvider> IXpsDocumentProvider_t; +typedef CComPtr<IXpsDocumentConsumer> IXpsDocumentConsumer_t; +typedef CComPtr<IXpsPartIterator> IXpsPartIterator_t; +typedef CComPtr<IPartBase> IPartBase_t; +typedef CComPtr<IPartFont2> IPartFont2_t; +typedef CComPtr<IPartFont> IPartFont_t; +typedef CComPtr<IPartImage> IPartImage_t; +typedef CComPtr<IPartColorProfile> IPartColorProfile_t; +typedef CComPtr<IPartResourceDictionary> IPartResourceDictionary_t; +typedef std::vector<CAdapt<IPartResourceDictionary_t>> ResourceDictionaryList_t; +typedef CComPtr<IPartPrintTicket> IPartPrintTicket_t; + +// +// Xps Object Model types +// +typedef CComPtr<IXpsOMObjectFactory> IXpsOMObjectFactory_t; +typedef CComPtr<IXpsOMPartResources> IXpsOMPartResources_t; +typedef CComPtr<IXpsOMFontResourceCollection> IXpsOMFontResourceCollection_t; +typedef CComPtr<IXpsOMImageResourceCollection> IXpsOMImageResourceCollection_t; +typedef CComPtr<IXpsOMColorProfileResourceCollection> IXpsOMColorProfileResourceCollection_t; +typedef CComPtr<IXpsOMRemoteDictionaryResourceCollection> IXpsOMRemoteDictionaryResourceCollection_t; +typedef CComPtr<IXpsOMFontResource> IXpsOMFontResource_t; +typedef CComPtr<IXpsOMImageResource> IXpsOMImageResource_t; +typedef CComPtr<IXpsOMColorProfileResource> IXpsOMColorProfileResource_t; +typedef CComPtr<IXpsOMRemoteDictionaryResource> IXpsOMRemoteDictionaryResource_t; +typedef CComPtr<IXpsOMPage> IXpsOMPage_t; + +// +// Opc Types +// +typedef CComPtr<IOpcFactory> IOpcFactory_t; +typedef CComPtr<IOpcPartUri> IOpcPartUri_t; + +// +// Common types +// +typedef CComPtr<IStream> IStream_t; +typedef CComPtr<IUnknown> IUnknown_t; +typedef CComBSTR BSTR_t; +typedef CComVariant Variant_t; +typedef CComPtr<IPropertyBag2> IPropertyBag2_t; + +// +// WIC types +// +typedef CComPtr<IWICImagingFactory> IWICImagingFactory_t; +typedef CComPtr<IWICBitmap> IWICBitmap_t; +typedef CComPtr<IWICStream> IWICStream_t; +typedef CComPtr<IWICBitmapEncoder> IWICBitmapEncoder_t; +typedef CComPtr<IWICBitmapFrameEncode> IWICBitmapFrameEncode_t; + +// +// Xps Rasterization Service types +// +typedef CComPtr<IXpsRasterizationFactory> IXpsRasterizationFactory_t; +typedef CComPtr<IXpsRasterizer> IXpsRasterizer_t; + +// +// MSXML DOM types +// +typedef CComPtr<IXMLDOMDocument2> IXMLDOMDocument2_t; +typedef CComPtr<IXMLDOMNode> IXMLDOMNode_t; +typedef CComPtr<IXMLDOMNodeList> IXMLDOMNodeList_t; + +namespace xpsrasfilter +{ + +// +// Supported types of print ticket scaling +// +enum PrintTicketScaling +{ + SCALE_NONE, + SCALE_BLEEDTOIMAGEABLE, + SCALE_CONTENTTOIMAGEABLE, + SCALE_MEDIASIZETOIMAGEABLE, + SCALE_MEDIASIZETOMEDIASIZE +}; + +// +// Parameters that can be read from the Print Ticket +// to feed into rasterization calculations. +// +struct ParametersFromPrintTicket +{ + XPS_SIZE physicalPageSize; // in XPS units + PrintTicketScaling scaling; // scaling type + FLOAT destDPI; // target rasterization dpi + XPS_RECT imageableArea; // in XPS units +}; + +// +// Parameters read from the FixedPage +// to feed into rasterization calculations. +// +struct ParametersFromFixedPage +{ + XPS_SIZE fixedPageSize; // in XPS units + XPS_RECT bleedBoxRect; // in XPS units + XPS_RECT contentBoxRect; // in XPS units +}; + +// +// Forward Declarations +// +class RasterizationInterface; +class PrintTicketHandler; +class TiffStreamBitmapHandler; +class FilterLiveness; + +} // namespace xpsrasfilter + +// +// This class handles setting and clearing the security +// context, based on a token. This token is retrieved from +// the filter pipeline, and we do not want to free it. +// +class ScopeImpersonation +{ +public: + ScopeImpersonation( + HANDLE token + ) + { + if ( + !SetThreadToken( + NULL, // set the current thread's token + token + ) + ) + { + THROW_LAST_ERROR(); + } + } + + ~ScopeImpersonation() + { + if ( + !SetThreadToken( + NULL, // set the current thread's token + NULL // revert to default security context + ) + ) + { + // + // We couldn't revert the security context. The filter pipeline + // manager will clean up the thread when operation is complete, + // when it is determined that the security context was not + // reverted. Since there are no security implications with + // running this filter in an elevated context, we can log the + // error and continue to run. + // + DWORD error = ::GetLastError(); + + WPP_LOG_ON_FAILED_HRESULT_WITH_TEXT( + HRESULT_FROM_WIN32(error), + L"Failed to revert thread security context." + ); + } + } + +private: + ScopeImpersonation(ScopeImpersonation const&); + ScopeImpersonation& operator=(ScopeImpersonation const&); +}; + +// +// RAII object to make HGLOBAL locks exception-safe. This requires +// unlocking during unwind. +// +class HGlobalLock +{ +public: + HGlobalLock( + HGLOBAL hG + ) : + m_hGlobal(hG) + { + m_pAddress = static_cast<BYTE *>( + ::GlobalLock(m_hGlobal) + ); + + if (!m_pAddress) + { + THROW_LAST_ERROR(); + } + } + + ~HGlobalLock() + { + if (!::GlobalUnlock(m_hGlobal)) + { + WPP_LOG_ON_FAILED_HRESULT( + HRESULT_FROM_WIN32(::GetLastError()) + ); + } + } + + BYTE* + GetAddress() + { + return m_pAddress; + } +private: + HGLOBAL m_hGlobal; + BYTE *m_pAddress; + + HGlobalLock(HGlobalLock const&); + HGlobalLock& operator=(HGlobalLock const&); + +}; + +typedef std::auto_ptr<HGlobalLock> HGlobalLock_t; + +// +// Safe handle to make HGLOBAL exception-safe. This requires both +// freeing and unlocking during unwind. +// +class SafeHGlobal +{ +public: + + SafeHGlobal( + UINT flags, + SIZE_T size + ) + { + m_hGlobal = ::GlobalAlloc(flags, size); + + if (!m_hGlobal) + { + THROW_ON_FAILED_HRESULT(E_OUTOFMEMORY); + } + } + + virtual + ~SafeHGlobal() + { + if (m_hGlobal) + { + // + // Free the HGLOBAL + // + ::GlobalFree(m_hGlobal); + } + } + + operator HGLOBAL() + { + return m_hGlobal; + } + + // + // Passes ownership of the HGLOBAL from this safe handle + // to a new IStream. + // + IStream_t + ConvertToIStream() + { + IStream_t pStream; + + THROW_ON_FAILED_HRESULT( + ::CreateStreamOnHGlobal( + m_hGlobal, + TRUE, // Free the HGLOBAL on Release of the stream + &pStream + ) + ); + + m_hGlobal = NULL; + + return pStream; + } + + HGlobalLock_t + Lock() + { + HGlobalLock_t toReturn( + new HGlobalLock(m_hGlobal) + ); + return toReturn; + } + +private: + + HGLOBAL m_hGlobal; + + SafeHGlobal(SafeHGlobal const&); + SafeHGlobal& operator=(SafeHGlobal const&); + +}; + +// +// Safe handle to make HPTPROVIDER exception safe. This +// requires closing the provider during unwind. +// +class SafeHPTProvider +{ +public: + SafeHPTProvider( + const wchar_t *printerName, + HANDLE userSecurityToken + ) : + m_token(userSecurityToken) + { + // + // We impersonate the user while we call PTQuerySchemaVersionSupport + // and PTOpenProviderEx. + // + ScopeImpersonation impersonate(m_token); + + DWORD maxVersion, + tempVersion; + + THROW_ON_FAILED_HRESULT( + ::PTQuerySchemaVersionSupport( + printerName, + &maxVersion + ) + ); + + THROW_ON_FAILED_HRESULT( + ::PTOpenProviderEx( + printerName, + maxVersion, // maximum version + maxVersion, // preferred version + &m_hProvider, + &tempVersion // version used by the provider + ) + ); + } + + virtual + ~SafeHPTProvider() + { + WPP_LOG_ON_FAILED_HRESULT( + ::PTCloseProvider(m_hProvider) + ); + } + + void + PTMergeAndValidatePrintTicket( + const IStream_t &pBasePrintTicket, + const IStream_t &pDeltaPrintTicket, + EPrintTicketScope scope, + _Inout_ IStream_t &pMergedPrintTicket + ) + { + // + // We impersonate the user while we call PTMergeAndValidatePrintTicket. + // + ScopeImpersonation impersonate(m_token); + + BSTR_t error; + + HRESULT hr = ::PTMergeAndValidatePrintTicket( + m_hProvider, + pBasePrintTicket, + pDeltaPrintTicket, + scope, + pMergedPrintTicket, + &error + ); + + WPP_LOG_ON_FAILED_HRESULT_WITH_TEXT( + hr, + error + ); + + THROW_ON_FAILED_HRESULT(hr); + } + +private: + + HPTPROVIDER m_hProvider; + HANDLE m_token; + + SafeHPTProvider(SafeHPTProvider const&); + SafeHPTProvider& operator=(SafeHPTProvider const&); +}; + +// +// CoInitialize/CoUninitialize RAII object +// +// This object ensures that COM is initialized for the duration +// of the XpsRasFilter's lifetime, and then uninitialized after +// all of the COM objects, regardless of how the filter exits +// +class SafeCoInit +{ +public: + SafeCoInit() : + m_doCoUninitialize(FALSE) + { + // + // Initialize COM + // + HRESULT hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); + + if (FAILED(hr) && + hr != RPC_E_CHANGED_MODE) + { + // + // RPC_E_CHANGED_MODE indicates that we attempted to change the + // threading model. It is safe to ignore since we do not *require* + // multi-threading. Throw on any other errors. + // + + THROW_ON_FAILED_HRESULT(hr); + } + else if (SUCCEEDED(hr)) + { + // + // It is important that we only call CoUninitialize() if we + // succeeded in setting the threading model. + // + + m_doCoUninitialize = TRUE; + } + } + + ~SafeCoInit() + { + if (m_doCoUninitialize) + { + ::CoUninitialize(); + } + } +private: + SafeCoInit(SafeCoInit const&); + SafeCoInit& operator=(SafeCoInit const&); + + BOOL m_doCoUninitialize; +}; + +// +// RAII object to make VARIANT exception-safe. This requires +// VariantClear during unwind. +// +class SafeVariant : public VARIANT +{ +public: + SafeVariant() + { + ::VariantInit(this); + } + + ~SafeVariant() + { + ::VariantClear(this); + } +private: + SafeVariant(SafeVariant const&); + SafeVariant& operator=(SafeVariant const&); +}; + +// +// Internal Types +// +typedef std::auto_ptr<xpsrasfilter::RasterizationInterface> RasterizationInterface_t; +typedef std::auto_ptr<xpsrasfilter::PrintTicketHandler> PrintTicketHandler_t; +typedef std::auto_ptr<xpsrasfilter::TiffStreamBitmapHandler> TiffStreamBitmapHandler_t; +typedef std::auto_ptr<SafeHGlobal> SafeHGlobal_t; +typedef std::auto_ptr<SafeHPTProvider> SafeHPTProvider_t; +typedef CComPtr<xpsrasfilter::FilterLiveness> FilterLiveness_t; + diff --git a/print/XpsRasFilter/src/precomp.h b/print/XpsRasFilter/src/precomp.h new file mode 100644 index 00000000..97e8f4ee --- /dev/null +++ b/print/XpsRasFilter/src/precomp.h @@ -0,0 +1,86 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// precomp.h +// +// Abstract: +// +// Precompiled header for the Xps Rasterization Service sample filter. +// + +#pragma once + +// +// Define this as a usermode driver for analysis purposes +// +#include <DriverSpecs.h> +__user_driver + +// +// Standard Annotation Language include +// +#include <sal.h> + +// +// Windows includes +// +#include <windows.h> + +// Standard includes +#include <cstring> +#include <intsafe.h> +#include <new> + +// STL +#include <vector> + +// +// COM includes +// +#include <objbase.h> +#include <oleauto.h> + +// +// Filter pipeline includes +// +#include <winspool.h> +#include <filterpipeline.h> +#include <filterpipelineutil.h> +#include <prntvpt.h> + +// +// ATL +// +#include <atlbase.h> + +// +// WIC +// +#include <wincodec.h> + +// +// MSXML +// +#include <msxml6.h> + +// +// OPC Layer +// +#include <msopc.h> + +// +// Xps Object Model +// +#include <XpsObjectModel.h> + +// +// Xps Rasterization Service +// +#include <xpsrassvc.h> + diff --git a/print/XpsRasFilter/src/precompsrc.cpp b/print/XpsRasFilter/src/precompsrc.cpp new file mode 100644 index 00000000..5944cf51 --- /dev/null +++ b/print/XpsRasFilter/src/precompsrc.cpp @@ -0,0 +1 @@ +#include "precomp.h"
\ No newline at end of file diff --git a/print/XpsRasFilter/src/rasinterface.cpp b/print/XpsRasFilter/src/rasinterface.cpp new file mode 100644 index 00000000..adbf73e4 --- /dev/null +++ b/print/XpsRasFilter/src/rasinterface.cpp @@ -0,0 +1,412 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// rasinterface.cpp +// +// Abstract: +// +// Class to wrap rasterization-related calculations, interactions with +// the Xps Rasterization Service, Xps Rasterization Service Callback, +// and eventual raster output (i.e. TIFF encoding) +// + +#include "precomp.h" +#include "WppTrace.h" +#include "Exception.h" +#include "filtertypes.h" +#include "UnknownBase.h" +#include "xpsrasfilter.h" +#include "OMConvertor.h" +#include "rasinterface.h" +#include "BitmapHandler.h" + +#include "rasinterface.tmh" + +namespace xpsrasfilter +{ + +// +//Routine Name: +// +// RasterizationInterface::CreateRasterizationInterface +// +//Routine Description: +// +// Static factory method that creates an instance of +// RasterizationInterface. +// +//Arguments: +// +// pPropertyBag - Property Bag +// pStream - Filter output stream (IPrintWriteStream) +// +//Return Value: +// +// RasterizationInterface_t (smart ptr) +// The new RasterizationInterface. +// +RasterizationInterface_t +RasterizationInterface::CreateRasterizationInterface( + const IPrintPipelinePropertyBag_t &pPropertyBag, + const IPrintWriteStream_t &pStream + ) +{ + Variant_t varRasFactory; + IXpsRasterizationFactory_t pXPSRasFactory; + + // + // Get the Xps Rasterization Service factory. Since XpsRasterService.dll + // is specified as an OptionalFilterServiceProvider in the filter pipeline + // configuration file, the factory may not be available in the property bag + // (e.g. when running on Windows Vista, Windows XP, etc). In this case, + // this call will fail and the filter could fail, as we do here, or could + // default to some other behavior. + // + THROW_ON_FAILED_HRESULT( + pPropertyBag->GetProperty( + L"MS_IXpsRasterizationFactory", + &varRasFactory + ) + ); + + IUnknown_t pUnk(varRasFactory.punkVal); + + THROW_ON_FAILED_HRESULT( + pUnk.QueryInterface(&pXPSRasFactory) + ); + + // + // Prepare the rasterization/encode/stream interface + // + TiffStreamBitmapHandler_t pBitmapHandler( + TiffStreamBitmapHandler::CreateTiffStreamBitmapHandler(pStream) + ); + + RasterizationInterface_t pReturnInterface( + new RasterizationInterface( + pXPSRasFactory, + pBitmapHandler + ) + ); + + return pReturnInterface; +} + +// +//Routine Name: +// +// RasterizationInterface::RasterizationInterface +// +//Routine Description: +// +// Construct the Rasterization Interface with the +// IXpsRasterizationFactory interface and bitmap +// handler. +// +//Arguments: +// +// pRasFactory - Xps Rasterization Service object factory +// pBitmapHandler - Class to handle band bitmaps +// +RasterizationInterface::RasterizationInterface( + const IXpsRasterizationFactory_t &pRasFactory, + TiffStreamBitmapHandler_t pBitmapHandler + ) : m_pXPSRasFactory(pRasFactory), + m_pBitmapHandler(pBitmapHandler) +{ +} + +// +//Routine Name: +// +// RasterizationInterface::FinishRasterization +// +//Routine Description: +// +// Tell the Rasterization Interface that the last +// page has been rasterized. +// +//Arguments: +// +// None +// +void +RasterizationInterface::FinishRasterization() +{ + m_pBitmapHandler->WriteFooter(); +} + + +// +//Routine Name: +// +// RasterizationInterface::RasterizeAndStreamPage +// +//Routine Description: +// +// Given an IXpsOMPage and a set of Print Ticket +// parameters, this method invokes the Xps Rasterization +// Service for each band of the page, and outputs the +// resultant raster data. +// +//Arguments: +// +// pPage - page to rasterize +// printTicketparams - raw parameters from the print ticket(s) +// +void +RasterizationInterface::RasterizePage( + const IXpsOMPage_t &pPage, + const ParametersFromPrintTicket &printTicketParams, + const FilterLiveness_t &pLiveness + ) +{ + // + // Calculate rasterization parameters + // + ParametersFromFixedPage fixedPageParams; + THROW_ON_FAILED_HRESULT( + pPage->GetPageDimensions(&fixedPageParams.fixedPageSize) + ); + THROW_ON_FAILED_HRESULT( + pPage->GetBleedBox(&fixedPageParams.bleedBoxRect) + ); + THROW_ON_FAILED_HRESULT( + pPage->GetContentBox(&fixedPageParams.contentBoxRect) + ); + + RasterizationParameters rastParams( + printTicketParams, + fixedPageParams + ); + + // + // Create the Rasterizer + // + IXpsRasterizer_t rasterizer; + THROW_ON_FAILED_HRESULT( + m_pXPSRasFactory->CreateRasterizer( + pPage, + rastParams.rasterizationDPI, + XPSRAS_RENDERING_MODE_ANTIALIASED, + XPSRAS_RENDERING_MODE_ANTIALIASED, + &rasterizer + ) + ); + + // + // Set the minimal line width to 1 pixel + // + THROW_ON_FAILED_HRESULT( + rasterizer->SetMinimalLineWidth(1) + ); + + // + // Loop over bands + // + INT bandOriginY = 0; + + while (pLiveness->IsAlive() && + bandOriginY < rastParams.rasterHeight) + { + DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Rasterizing Band"); + + IWICBitmap_t bitmap; + + // + // Calculate the height of this band + // + INT bandHeight = rastParams.bandHeight; + if (bandOriginY + rastParams.bandHeight >= rastParams.rasterHeight) + { + bandHeight = rastParams.rasterHeight - bandOriginY; + } + + // + // Rasterize this band + // + { + HRESULT hr = rasterizer->RasterizeRect( + rastParams.originX, + bandOriginY + rastParams.originY, + rastParams.rasterWidth, + bandHeight, + static_cast<IXpsRasterizerNotificationCallback *>(pLiveness), + &bitmap + ); + + // + // Do not throw if we have cancelled rasterization + // + if (hr == HRESULT_FROM_WIN32(ERROR_PRINT_CANCELLED)) + { + DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Rasterization Cancelled"); + return; + } + + THROW_ON_FAILED_HRESULT(hr); + } + + bandOriginY += bandHeight; + + // + // The resolution of the bitmap defaults to the + // rasterization DPI, which includes the scaling factor. + // We want the output bitmap to reflect the destination DPI. + // + THROW_ON_FAILED_HRESULT( + bitmap->SetResolution( + printTicketParams.destDPI, + printTicketParams.destDPI + ) + ); + + // + // Encode the raster data as TIFF and stream out + // + m_pBitmapHandler->ProcessBitmap(bitmap); + } +} + +// +//Routine Name: +// +// RasterizationParameters::RasterizationParameters +// +//Routine Description: +// +// Given a set of fixed page parameters and a set of Print Ticket +// parameters, this constructor calculates the parameters necessary to +// invoke the Xps Rasterization Service. +// +//Arguments: +// +// printTicketparams - raw parameters from the print ticket(s) +// fixedPageParams - raw parameters from the fixed page +// +RasterizationParameters::RasterizationParameters( + const ParametersFromPrintTicket &printTicketParams, + const ParametersFromFixedPage &fixedPageParams + ) +{ + // + // Rasterize the entire physical page at the desired resolution. The fixed page + // is scaled and traslated to place it correctly witin the physical page. + // + rasterHeight = static_cast<INT>( + printTicketParams.physicalPageSize.height + * (printTicketParams.destDPI / xpsDPI) + + 0.5 + ); + rasterWidth = static_cast<INT>( + printTicketParams.physicalPageSize.width + * (printTicketParams.destDPI / xpsDPI) + + 0.5 + ); + + // + // Determine the source rectangle for the scale operation + // + XPS_RECT srcRect = {0,0,0,0}; + + switch(printTicketParams.scaling) + { + case SCALE_BLEEDTOIMAGEABLE: + + srcRect = fixedPageParams.bleedBoxRect; + + break; + default: + DoTraceMessage(XPSRASFILTER_TRACE_ERROR, L"Unknown scaling type"); + THROW_ON_FAILED_HRESULT(E_UNEXPECTED); + break; + } + + // + // Determine the destination rectangle for the scale operation + // + XPS_RECT destRect = {0,0,0,0}; + + switch(printTicketParams.scaling) + { + case SCALE_BLEEDTOIMAGEABLE: + + destRect = printTicketParams.imageableArea; + + break; + default: + DoTraceMessage(XPSRASFILTER_TRACE_ERROR, L"Unknown scaling type"); + THROW_ON_FAILED_HRESULT(E_UNEXPECTED); + break; + } + + + // + // Because we want to fit the fixed page into a physical page of + // potentially different aspect ratio, it is necessary to calculate + // the scaling factor assuming either the height or width constrains + // the operation; the rasterization dpi is then the smaller of the two. + // + // + // The basic calculation for scaling factor is: + // + // Scaling Factor = (Destination Dimension / Source Dimension) + // + // Multiplying by desired Destination DPI we get the DPI at which to + // rasterize the source content in order to get the desired size + // + // Rasterization DPI = Scaling Factor * Desired Destination DPI + // + { + FLOAT heightScalingFactor = destRect.height / srcRect.height; + FLOAT widthScalingFactor = destRect.width / srcRect.width; + + FLOAT heightRastDPI = heightScalingFactor * printTicketParams.destDPI; + FLOAT widthRastDPI = widthScalingFactor * printTicketParams.destDPI; + + rasterizationDPI = min(heightRastDPI, widthRastDPI); + } + + // + // To determine the rasterization origin, subtract the translation + // due to the destination rectangle (e.g. imageable area) from the + // translation due to the choice of scale (e.g. bleed box origin) + // + { + FLOAT srcOffsetX = srcRect.x * rasterizationDPI / xpsDPI; + FLOAT srcOffsetY = srcRect.y * rasterizationDPI / xpsDPI; + + FLOAT destOffsetX = destRect.x * printTicketParams.destDPI / xpsDPI; + FLOAT destOffsetY = destRect.y * printTicketParams.destDPI / xpsDPI; + + originX = static_cast<INT>(srcOffsetX - destOffsetX - 0.5); + originY = static_cast<INT>(srcOffsetY - destOffsetY - 0.5); + } + + // + // The height of each band is determined by the maximum band size (in bytes) + // divided by 4 bytes per pixel to get the total pixels, and then divided by + // the width of the raster data. This results in a band bitmap that is close + // to the target band size. + // + bandHeight = (RasterizationInterface::ms_targetBandSize / 4) / rasterWidth; + + if (bandHeight == 0) + { + // + // The physical page is too wide to rasterize at this + // maximum band size and dpi. Throw. + // + THROW_ON_FAILED_HRESULT( + E_OUTOFMEMORY + ); + } +} + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/rasinterface.h b/print/XpsRasFilter/src/rasinterface.h new file mode 100644 index 00000000..3fae74cf --- /dev/null +++ b/print/XpsRasFilter/src/rasinterface.h @@ -0,0 +1,107 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// rasinterface.h +// +// Abstract: +// +// Class to wrap rasterization-related calculations, interactions with +// the Xps Rasterization Service, Xps Rasterization Service Callback, +// and eventual raster output (i.e. TIFF encoding) +// + +#pragma once + +namespace xpsrasfilter +{ + +class RasterizationInterface +{ +public: + static + RasterizationInterface_t + CreateRasterizationInterface( + const IPrintPipelinePropertyBag_t &pPropertyBag, + const IPrintWriteStream_t &pStream + ); + + RasterizationInterface(); + + void + RasterizePage( + const IXpsOMPage_t &pPage, + const ParametersFromPrintTicket &printTicketParams, + const FilterLiveness_t &pLiveness + ); + + void + CancelRasterization(); + + void + FinishRasterization(); + + // + // Target band size; 16MB + // + const static LONG ms_targetBandSize = 1024 * 1024 * 16; + +private: + + // + // Constructor is private; use CreateRasterizationInterface + // to create instances + // + RasterizationInterface( + const IXpsRasterizationFactory_t &pRasFactory, + TiffStreamBitmapHandler_t pBitmapHandler + ); + + // + // prevent copy semantics + // + RasterizationInterface(const RasterizationInterface&); + RasterizationInterface& operator=(const RasterizationInterface&); + + // + // Internal data members + // + + // + // Xps Rasterization Service Factory + // + IXpsRasterizationFactory_t m_pXPSRasFactory; + + // + // Bitmap Handler + // + TiffStreamBitmapHandler_t m_pBitmapHandler; +}; + +// +// Parameters that determine how a page is rasterized, in the +// units that the Rasterization Service expects +// +struct RasterizationParameters +{ + FLOAT rasterizationDPI; // dpi (scaling factor) + INT rasterHeight; // total size of raster + INT rasterWidth; + INT originX; // origin of the rasterization (translation) + INT originY; + INT bandHeight; // height of individual bands + + RasterizationParameters( + const ParametersFromPrintTicket &printTicketParams, + const ParametersFromFixedPage &fixedPageParams + ); +}; + +const FLOAT xpsDPI = 96.0f; + +} // namespace xpsrasfilter diff --git a/print/XpsRasFilter/src/xpsrasfilter.cpp b/print/XpsRasFilter/src/xpsrasfilter.cpp new file mode 100644 index 00000000..1199a540 --- /dev/null +++ b/print/XpsRasFilter/src/xpsrasfilter.cpp @@ -0,0 +1,396 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// xpsrasfilter.cpp +// +// Abstract: +// +// Xps Rasterization Service filter implementation. +// + +#include "precomp.h" +#include "WppTrace.h" +#include "Exception.h" +#include "filtertypes.h" +#include "UnknownBase.h" +#include "OMConvertor.h" +#include "rasinterface.h" +#include "BitmapHandler.h" +#include "PThandler.h" +#include "xpsrasfilter.h" + +#include "xpsrasfilter.tmh" + +namespace xpsrasfilter +{ + +long XPSRasFilter::ms_numObjects = 0; // Initialize static object count + +// +//Routine Name: +// +// XPSRasFilter::XPSRasFilter +// +//Routine Description: +// +// Xps Rasterization Service sample filter default constructor. +// +//Arguments: +// +// None +// +//Return Value: +// +// None +// +XPSRasFilter::XPSRasFilter() +{ + // + // Take ownership with no AddRef + // + m_pLiveness.Attach(new FilterLiveness()); + + ::InterlockedIncrement(&ms_numObjects); +} + +// +//Routine Name: +// +// XPSRasFilter::~XPSRasFilter +// +//Routine Description: +// +// Xps Rasterization Service sample filter destructor. +// +//Arguments: +// +// None +// +//Return Value: +// +// None +// +XPSRasFilter::~XPSRasFilter() +{ + ::InterlockedDecrement(&ms_numObjects); +} + +// +//Routine Name: +// +// XPSRasFilter::InitializeFilter +// +//Routine Description: +// +// Exception boundary wrapper for IPrintPipelineFilter initialization. +// +//Arguments: +// +// pICommunicator - interface to interfilter communicator +// pIPropertyBag - interface to pipeline property bag +// pIPipelineControl - interface to pipeline control methods +// +//Return Value: +// +// ULONG +// New reference count +// +_Must_inspect_result_ +HRESULT STDMETHODCALLTYPE +XPSRasFilter::InitializeFilter( + _In_ IInterFilterCommunicator *pICommunicator, + _In_ IPrintPipelinePropertyBag *pIPropertyBag, + _In_ IPrintPipelineManagerControl *pIPipelineControl + ) +{ + DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"Initializing Filter"); + + if (pICommunicator == NULL || + pIPropertyBag == NULL || + pIPipelineControl == NULL) + { + WPP_LOG_ON_FAILED_HRESULT(E_POINTER); + + return E_POINTER; + } + + HRESULT hr = S_OK; + + try + { + InitializeFilter_throws( + pICommunicator, + pIPropertyBag + ); + } + CATCH_VARIOUS(hr); + + return hr; +} + +// +//Routine Name: +// +// XPSRasFilter::InitializeFilter_throws +// +//Routine Description: +// +// Implements IPrintPipelineFilter initialization. Gets +// all necessary communication interfaces. +// +//Arguments: +// +// pICommunicator - interface to interfilter communicator +// pIPropertyBag - interface to pipeline property bag +// +VOID +XPSRasFilter::InitializeFilter_throws( + const IInterFilterCommunicator_t &pICommunicator, + const IPrintPipelinePropertyBag_t &pIPropertyBag + ) +{ + // + // Get the pipeline communication interfaces + // + THROW_ON_FAILED_HRESULT( + pICommunicator->RequestReader(reinterpret_cast<void**>(&m_pReader)) + ); + THROW_ON_FAILED_HRESULT( + pICommunicator->RequestWriter(reinterpret_cast<void**>(&m_pWriter)) + ); + + { + // + // Check to ensure that the provided interfaces are as expected. + // That is, that the GUIDs were correctly listed in the + // pipeline configuration file + // + IXpsDocumentProvider_t pReaderCheck; + IPrintWriteStream_t pWriterCheck; + + THROW_ON_FAILED_HRESULT( + m_pReader.QueryInterface(&pReaderCheck) + ); + THROW_ON_FAILED_HRESULT( + m_pWriter.QueryInterface(&pWriterCheck) + ); + } + + // + // Save a pointer to the Property Bag for further + // initialization, later. + // + m_pIPropertyBag = pIPropertyBag; +} + +// +//Routine Name: +// +// XPSRasFilter::ShutdownOperation +// +//Routine Description: +// +// Called asynchronously by the pipeline manager +// to shutdown filter operation. +// +//Arguments: +// +// None +// +//Return Value: +// +// HRESULT +// S_OK - On success +// +_Must_inspect_result_ +HRESULT +XPSRasFilter::ShutdownOperation() +{ + DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"Shutting Down Operation"); + + m_pLiveness->Cancel(); + + return S_OK; +} + +// +//Routine Name: +// +// XPSRasFilter::StartOperation +// +//Routine Description: +// +// Called by the pipeline manager to start processing +// a document. Exception boundary for page processing. +// +//Arguments: +// +// None +// +//Return Value: +// +// HRESULT +// S_OK - On success +// Otherwise - Failure +// +_Must_inspect_result_ +HRESULT +XPSRasFilter::StartOperation() +{ + HRESULT hr = S_OK; + + DoTraceMessage(XPSRASFILTER_TRACE_INFO, L"Starting Operation"); + + // + // Process the Xps Package + // + try { + StartOperation_throws(); + } + CATCH_VARIOUS(hr); + + m_pWriter->Close(); + + return hr; +} + +// +//Routine Name: +// +// XPSRasFilter::StartOperation_throws +// +//Routine Description: +// +// Iterates over the 'trunk' parts of the document +// and calls appropriate processing methods. +// +//Arguments: +// +// None +// +void +XPSRasFilter::StartOperation_throws() +{ + // + // CoInitialize/CoUninitialize RAII object. + // COM is inititalized for the lifetime of this method. + // + SafeCoInit coInit; + + IXpsOMObjectFactory_t pOMFactory; + + // + // Create Xps Object Model Object Factory instance + // + THROW_ON_FAILED_HRESULT( + ::CoCreateInstance( + __uuidof(XpsOMObjectFactory), + NULL, + CLSCTX_INPROC_SERVER, + __uuidof(IXpsOMObjectFactory), + reinterpret_cast<LPVOID*>(&pOMFactory) + ) + ); + + IOpcFactory_t pOpcFactory; + + // + // Create Opc Object Factory instance + // + THROW_ON_FAILED_HRESULT( + ::CoCreateInstance( + __uuidof(OpcFactory), + NULL, + CLSCTX_INPROC_SERVER, + __uuidof(IOpcFactory), + reinterpret_cast<LPVOID*>(&pOpcFactory) + ) + ); + + // + // Create the rasterization interface + // + RasterizationInterface_t pRasInterface = + RasterizationInterface::CreateRasterizationInterface( + m_pIPropertyBag, + m_pWriter + ); + + // + // Create the Print Ticket Handler + // + PrintTicketHandler_t pPrintTicketHandler = + PrintTicketHandler::CreatePrintTicketHandler( + m_pIPropertyBag + ); + + IUnknown_t pUnk; + + // + // Get first part + // + THROW_ON_FAILED_HRESULT(m_pReader->GetXpsPart(&pUnk)); + + while (m_pLiveness->IsAlive() && + pUnk != NULL) + { + IXpsDocument_t pDoc; + IFixedDocumentSequence_t pFDS; + IFixedDocument_t pFD; + IFixedPage_t pFP; + + if (SUCCEEDED(pUnk.QueryInterface(&pFP))) + { + DoTraceMessage(XPSRASFILTER_TRACE_VERBOSE, L"Handling a Page"); + + pPrintTicketHandler->ProcessPart(pFP); + + ParametersFromPrintTicket printTicketParams = + pPrintTicketHandler->GetMergedPrintTicketParams(); + + pRasInterface->RasterizePage( + CreateXpsOMPageFromIFixedPage(pFP, pOMFactory, pOpcFactory), + printTicketParams, + m_pLiveness + ); + } + else if (SUCCEEDED(pUnk.QueryInterface(&pFD))) + { + pPrintTicketHandler->ProcessPart(pFD); + } + else if (SUCCEEDED(pUnk.QueryInterface(&pFDS))) + { + pPrintTicketHandler->ProcessPart(pFDS); + } + else if (SUCCEEDED(pUnk.QueryInterface(&pDoc))) + { + // + // Do nothing with the XML Document part + // + } + else + { + // + // Any other document 'trunk' parts are ignored. + // + } + + pUnk.Release(); + + // + // Get Next Part + // + THROW_ON_FAILED_HRESULT(m_pReader->GetXpsPart(&pUnk)); + } + + pRasInterface->FinishRasterization(); +} + +} // namespace xpsrasfilter + diff --git a/print/XpsRasFilter/src/xpsrasfilter.def b/print/XpsRasFilter/src/xpsrasfilter.def new file mode 100644 index 00000000..a3dac1cc --- /dev/null +++ b/print/XpsRasFilter/src/xpsrasfilter.def @@ -0,0 +1,22 @@ +; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +; PARTICULAR PURPOSE. +; +; Copyright (c) Microsoft Corporation. All rights reserved +; +; File Name: +; +; xpsrasfilter.def +; +; Abstract: +; +; Defines DLL exports for xpsrasfilter.dll +; + +LIBRARY "xpsrasfilter.dll" + +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + diff --git a/print/XpsRasFilter/src/xpsrasfilter.h b/print/XpsRasFilter/src/xpsrasfilter.h new file mode 100644 index 00000000..2ad3a4f9 --- /dev/null +++ b/print/XpsRasFilter/src/xpsrasfilter.h @@ -0,0 +1,141 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// xpsrasfilter.h +// +// Abstract: +// +// Xps Rasterization Service sample filter definition. The +// XPSRasFilter provides the interface to the filter pipeline manager. +// + +#pragma once + +namespace xpsrasfilter +{ + +// +// Class to maintain the shared state of operation between multiple components +// of the filter. Also provides the callback for the Xps Rasterization Service. +// +class FilterLiveness : public UnknownBase<IXpsRasterizerNotificationCallback> +{ +public: + + FilterLiveness() : + m_isAlive(TRUE) + {} + + virtual + ~FilterLiveness() {} + + BOOL + IsAlive() + { + return m_isAlive; + } + + void + Cancel() + { + // + // May be called from a different thread + // + m_isAlive = FALSE; + } + + // + // IXpsRasterizerNotificationCallback Method + // + virtual _Must_inspect_result_ + HRESULT STDMETHODCALLTYPE + Continue() + { + return (m_isAlive) ? (S_OK) : (HRESULT_FROM_WIN32(ERROR_PRINT_CANCELLED)); + } + +private: + volatile BOOL m_isAlive; + + // + // prevent copy semantics + // + FilterLiveness(const FilterLiveness&); + FilterLiveness& operator=(const FilterLiveness&); +}; + +class XPSRasFilter : public UnknownBase<IPrintPipelineFilter> +{ + +public: + + static LONG ms_numObjects; // Number of instances of XPSRasFilter + + XPSRasFilter(); + + virtual + ~XPSRasFilter(); + + // + // IPrintPipelineFilter Methods + // + virtual _Must_inspect_result_ + HRESULT STDMETHODCALLTYPE + InitializeFilter( + _In_ IInterFilterCommunicator *pICommunicator, + _In_ IPrintPipelinePropertyBag *pIPropertyBag, + _In_ IPrintPipelineManagerControl *pIPipelineControl + ); + + virtual _Must_inspect_result_ + HRESULT STDMETHODCALLTYPE + ShutdownOperation(); + + virtual _Must_inspect_result_ + HRESULT STDMETHODCALLTYPE + StartOperation(); + +private: + // + // prevent copy semantics + // + XPSRasFilter(const XPSRasFilter&); + XPSRasFilter& operator=(const XPSRasFilter&); + + // + // Xps package part reader + // + IXpsDocumentProvider_t m_pReader; + IPrintWriteStream_t m_pWriter; + + // + // Pipeline Property Bag + // + IPrintPipelinePropertyBag_t m_pIPropertyBag; + + // + // IPrintPipelineFilter Methods (throwing) + // + VOID + StartOperation_throws(); + + VOID + InitializeFilter_throws( + const IInterFilterCommunicator_t &pICommunicator, + const IPrintPipelinePropertyBag_t &pIPropertyBag + ); + + // + // Keeps track of whether the operation has been cancelled + // + FilterLiveness_t m_pLiveness; +}; + +} // namespace xpsrasfilter + diff --git a/print/XpsRasFilter/src/xpsrasfilter.rc b/print/XpsRasFilter/src/xpsrasfilter.rc new file mode 100644 index 00000000..d7f2fc40 --- /dev/null +++ b/print/XpsRasFilter/src/xpsrasfilter.rc @@ -0,0 +1,28 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// xpsrasfilter.rc +// +// Abstract: +// +// Xps Rasterization Service filter resource file. +// + +#include <windows.h> +#include <ntverp.h> + +#define VER_FILETYPE VFT_DLL +#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILEDESCRIPTION_STR "XPS Rasterization Service WDK Sample Filter" +#define VER_INTERNALNAME_STR "xpsrasfilter.dll" +#define VER_ORIGINALFILENAME_STR "xpsrasfilter.dll" +#define VER_FILEVERSION 0, 3, VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE + +#include "common.ver" + diff --git a/print/XpsRasFilter/src/xpsrasfilter.vcxproj b/print/XpsRasFilter/src/xpsrasfilter.vcxproj new file mode 100644 index 00000000..48f9b603 --- /dev/null +++ b/print/XpsRasFilter/src/xpsrasfilter.vcxproj @@ -0,0 +1,349 @@ +<?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="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{41965435-F4B0-495B-B669-2291F27F56B5}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <SampleGuid>{47DD7292-F334-4FEC-B539-B5D84A74585B}</SampleGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <OutDir>$(IntDir)</OutDir> + </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </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')" /> + </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')" /> + </ImportGroup> + <ItemGroup Label="WrappedTaskItems"> + <ClCompile Include="dllentry.cpp"> + <WppEnabled>true</WppEnabled> + <WppFileExtensions>.cpp.cxx.h.hxx.inl</WppFileExtensions> + <WppPreserveExtensions>.h.hxx.inl</WppPreserveExtensions> + <WppModuleName>XpsRasFilter</WppModuleName> + <WppDllMacro>true</WppDllMacro> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="xpsrasfilter.cpp"> + <WppEnabled>true</WppEnabled> + <WppFileExtensions>.cpp.cxx.h.hxx.inl</WppFileExtensions> + <WppPreserveExtensions>.h.hxx.inl</WppPreserveExtensions> + <WppModuleName>XpsRasFilter</WppModuleName> + <WppDllMacro>true</WppDllMacro> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="omconvertor.cpp"> + <WppEnabled>true</WppEnabled> + <WppFileExtensions>.cpp.cxx.h.hxx.inl</WppFileExtensions> + <WppPreserveExtensions>.h.hxx.inl</WppPreserveExtensions> + <WppModuleName>XpsRasFilter</WppModuleName> + <WppDllMacro>true</WppDllMacro> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="Exception.cpp"> + <WppEnabled>true</WppEnabled> + <WppFileExtensions>.cpp.cxx.h.hxx.inl</WppFileExtensions> + <WppPreserveExtensions>.h.hxx.inl</WppPreserveExtensions> + <WppModuleName>XpsRasFilter</WppModuleName> + <WppDllMacro>true</WppDllMacro> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="WppTrace.cpp"> + <WppEnabled>true</WppEnabled> + <WppFileExtensions>.cpp.cxx.h.hxx.inl</WppFileExtensions> + <WppPreserveExtensions>.h.hxx.inl</WppPreserveExtensions> + <WppModuleName>XpsRasFilter</WppModuleName> + <WppDllMacro>true</WppDllMacro> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="rasinterface.cpp"> + <WppEnabled>true</WppEnabled> + <WppFileExtensions>.cpp.cxx.h.hxx.inl</WppFileExtensions> + <WppPreserveExtensions>.h.hxx.inl</WppPreserveExtensions> + <WppModuleName>XpsRasFilter</WppModuleName> + <WppDllMacro>true</WppDllMacro> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="PThandler.cpp"> + <WppEnabled>true</WppEnabled> + <WppFileExtensions>.cpp.cxx.h.hxx.inl</WppFileExtensions> + <WppPreserveExtensions>.h.hxx.inl</WppPreserveExtensions> + <WppModuleName>XpsRasFilter</WppModuleName> + <WppDllMacro>true</WppDllMacro> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="BitmapHandler.cpp"> + <WppEnabled>true</WppEnabled> + <WppFileExtensions>.cpp.cxx.h.hxx.inl</WppFileExtensions> + <WppPreserveExtensions>.h.hxx.inl</WppPreserveExtensions> + <WppModuleName>XpsRasFilter</WppModuleName> + <WppDllMacro>true</WppDllMacro> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <OtherWpp Include="xpsrasfilter.rc"> + <WppEnabled>true</WppEnabled> + <WppFileExtensions>.cpp.cxx.h.hxx.inl</WppFileExtensions> + <WppPreserveExtensions>.h.hxx.inl</WppPreserveExtensions> + <WppModuleName>XpsRasFilter</WppModuleName> + <WppDllMacro>true</WppDllMacro> + </OtherWpp> + </ItemGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>xpsrasfilter</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>xpsrasfilter</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>xpsrasfilter</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>xpsrasfilter</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Link> + <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> + <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Link> + <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> + <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Link> + <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> + <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Link> + <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> + <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ResourceCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ResourceCompile> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </Midl> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);uuid.lib;prntvpt.lib;Kernel32.lib;winspool.lib;ole32.lib;oleaut32.lib;Advapi32.lib</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ResourceCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ResourceCompile> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </Midl> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);uuid.lib;prntvpt.lib;Kernel32.lib;winspool.lib;ole32.lib;oleaut32.lib;Advapi32.lib</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ResourceCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ResourceCompile> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </Midl> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);uuid.lib;prntvpt.lib;Kernel32.lib;winspool.lib;ole32.lib;oleaut32.lib;Advapi32.lib</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ResourceCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ResourceCompile> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> + </Midl> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);uuid.lib;prntvpt.lib;Kernel32.lib;winspool.lib;ole32.lib;oleaut32.lib;Advapi32.lib</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <UseOfAtl>Dynamic</UseOfAtl> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <UseOfAtl>Dynamic</UseOfAtl> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <UseOfAtl>Dynamic</UseOfAtl> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <UseOfAtl>Dynamic</UseOfAtl> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <ExceptionHandling>Sync</ExceptionHandling> + <TreatWarningAsError>true</TreatWarningAsError> + <WarningLevel>Level4</WarningLevel> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <ExceptionHandling>Sync</ExceptionHandling> + <TreatWarningAsError>true</TreatWarningAsError> + <WarningLevel>Level4</WarningLevel> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <ExceptionHandling>Sync</ExceptionHandling> + <TreatWarningAsError>true</TreatWarningAsError> + <WarningLevel>Level4</WarningLevel> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <ExceptionHandling>Sync</ExceptionHandling> + <TreatWarningAsError>true</TreatWarningAsError> + <WarningLevel>Level4</WarningLevel> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Link> + <ModuleDefinitionFile>xpsrasfilter.def</ModuleDefinitionFile> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Link> + <ModuleDefinitionFile>xpsrasfilter.def</ModuleDefinitionFile> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Link> + <ModuleDefinitionFile>xpsrasfilter.def</ModuleDefinitionFile> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Link> + <ModuleDefinitionFile>xpsrasfilter.def</ModuleDefinitionFile> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="precompsrc.cpp"> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Create</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ResourceCompile Include="xpsrasfilter.rc" /> + </ItemGroup> + <ItemGroup> + <Inf Exclude="@(Inf)" Include="*.inf" /> + <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> + </ItemGroup> + <ItemGroup> + <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> + <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> + <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> + </ItemGroup> + <ItemGroup> + <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project>
\ No newline at end of file diff --git a/print/XpsRasFilter/src/xpsrasfilter.vcxproj.Filters b/print/XpsRasFilter/src/xpsrasfilter.vcxproj.Filters new file mode 100644 index 00000000..fdfc8758 --- /dev/null +++ b/print/XpsRasFilter/src/xpsrasfilter.vcxproj.Filters @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> + <UniqueIdentifier>{10F00C97-F803-43B8-994A-022AE3AA52E4}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + <UniqueIdentifier>{0422AF40-0146-47B2-BF48-C80A11C4F7F2}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> + <UniqueIdentifier>{1F07CF73-346E-4FF4-80B6-BC92C1A72B62}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="BitmapHandler.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="dllentry.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="Exception.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="omconvertor.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="precompsrc.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="PThandler.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="rasinterface.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="WppTrace.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="xpsrasfilter.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <None Include="xpsrasfilter.def"> + <Filter>Source Files</Filter> + </None> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="xpsrasfilter.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/print/cpsuisam/CPSUIDAT.C b/print/cpsuisam/CPSUIDAT.C new file mode 100644 index 00000000..c3854001 --- /dev/null +++ b/print/cpsuisam/CPSUIDAT.C @@ -0,0 +1,1331 @@ +/*++ + +Copyright (c) 1990-2003 Microsoft Corporation +All Rights Reserved + + +Module Name: + + cpsuidat.c + + +Abstract: + + This module contains all the predefined data + + +--*/ + + +#include "precomp.h" +#pragma hdrstop + +#define DBG_CPSUIFILENAME DbgTVPage + + + +#define DBG_TVTESTCB 0x00000001 +#define DBG_PUSHDLGPROC 0x00000002 + +DEFINE_DBGVAR(0); + +#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) + + +HINSTANCE hInstApp = NULL; + +TCHAR TitleName[] = TEXT("Common Property Sheet UI Sample"); +TCHAR ClassName[] = TEXT("CPSUISampleClass"); +TCHAR MenuName[] = TEXT("CPSUISampleMenu"); +TCHAR OptItemName[] = TEXT("CPSUI TreeView Sample"); +TCHAR szWinSpool[] = TEXT("WinSpool.Drv"); +CHAR szDocPropSheets[] = "DocumentPropertySheets"; + +BOOL UpdatePermission = TRUE; +BOOL UseStdAbout = TRUE; + + +INT_PTR +CALLBACK +PushButtonProc( + HWND hDlg, + UINT Msg, + WPARAM wParam, + LPARAM lParam + ); + +CPSUICALLBACK +TVTestCallBack( + _In_ PCPSUICBPARAM pCPSUICBParam + ); + + +OPTPARAM NoYesOP[] = { + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + (LPTSTR)IDS_CPSUI_NO, // pData + IDI_CPSUI_NO, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + (LPTSTR)IDS_CPSUI_YES, // pData + IDI_CPSUI_YES, // IconID + 1 // lParam + } +}; + +EXTCHKBOX ECB_EP_ECB = { + + sizeof(EXTCHKBOX), + 0, + TEXT("Include Icon"), + (LPTSTR)IDS_CPSUI_SLASH_SEP, + TEXT("Icon"), + IDI_CPSUI_GRAPHIC }; + + +OPTPARAM ECB_EP_OP[] = { + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("None"), // pData + IDI_CPSUI_EMPTY, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("Extended CheckBox"), // pData + IDI_CPSUI_EMPTY, // IconID + 1 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("Extended Push"), // pData + IDI_CPSUI_EMPTY, // IconID + 0 // lParam + } +}; + + +OPTTYPE ECB_EP_OT = { + + sizeof(OPTTYPE), // cbSize + TVOT_3STATES, // Type + 0, // Flags OPTTF_xxxx + 3, // Count + 0, // BegCtrlID + ECB_EP_OP, // pOptParam + 0 // Style, OTS_xxxx + }; + +OPTTYPE NoYesOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_2STATES, // Type + 0, // Flags OPTTF_xxxx + 2, // Count + 0, // BegCtrlID + NoYesOP, // pOptParam + 0 // Style, OTS_xxxx + }; + +OPTPARAM TVOT3StatesOP[] = { + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("States 1"), // pData + IDI_CPSUI_PORTRAIT, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("States 2"), // pData + IDI_CPSUI_LANDSCAPE, // IconID + 1 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("States 3"), // pData + IDI_CPSUI_ROT_LAND, // IconID + 0 // lParam + } +}; + +OPTTYPE TVOT2StatesOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_2STATES, // Type + 0, // Flags OPTTF_xxxx + 2, // Count + 0, // BegCtrlID + TVOT3StatesOP, // pOptParam + 0 // Style, OTS_xxxx + }; + +OPTTYPE TVOT3StatesOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_3STATES, // Type + 0, // Flags OPTTF_xxxx + 3, // Count + 0, // BegCtrlID + TVOT3StatesOP, // pOptParam + 0 // Style, OTS_xxxx + }; + +OPTPARAM MinRangeOP[] = { + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT(""), // pData (postfix) + IDI_CPSUI_EMPTY, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + NULL, // pData (help line) + (DWORD)MIN_INT, // IconID + MAX_INT // lParam + } +}; + +OPTTYPE MinRangeOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_UDARROW, // Type + 0, // Flags OPTTF_xxxx + 2, // Count + 0, // BegCtrlID + MinRangeOP, // pOptParam + 0 // Style, OTS_xxxx + }; + +OPTPARAM MaxRangeOP[] = { + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT(""), // pData (postfix) + IDI_CPSUI_EMPTY, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + NULL, // pData (help line) + (DWORD)MIN_INT, // IconID + MAX_INT // lParam + } +}; + +OPTTYPE MaxRangeOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_UDARROW, // Type + 0, // Flags OPTTF_xxxx + 2, // Count + 0, // BegCtrlID + MaxRangeOP, // pOptParam + 0 // Style, OTS_xxxx + }; + + +OPTPARAM MinMaxRangeOP[] = { + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("%"), // pData (postfix) + IDI_CPSUI_SCALING, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + NULL, // pData (help line) + (DWORD)MIN_INT, // IconID + MAX_INT // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + NULL, // pData (help line) + 2, // IconID + 50 // lParam + } +}; + +OPTTYPE TVOTUDArrowOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_UDARROW, // Type + 0, // Flags OPTTF_xxxx + 2, // Count + 0, // BegCtrlID + MinMaxRangeOP, // pOptParam + 0 // Style, OTS_xxxx + }; + +OPTTYPE TVOTTrackBarOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_TRACKBAR, // Type + 0, // Flags OPTTF_xxxx + 3, // Count + 0, // BegCtrlID + MinMaxRangeOP, // pOptParam + 0 // Style, OTS_xxxx + }; + +OPTTYPE TVOTScrollBarOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_SCROLLBAR, // Type + 0, // Flags OPTTF_xxxx + 3, // Count + 0, // BegCtrlID + MinMaxRangeOP, // pOptParam + 0 // Style, OTS_xxxx + }; + +OPTPARAM TVOTLBCBOP[] = { + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + (LPTSTR)IDS_CPSUI_NOTINSTALLED, // pData + IDI_CPSUI_SEL_NONE, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT(" 1 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT(" 2 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT(" 4 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT(" 6 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT(" 8 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("10 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("12 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("14 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("16 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("18 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("20 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("24 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("32 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("48 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("64 MB"), // pData + IDI_CPSUI_MEM, // IconID + 0 // lParam + }, +}; + + +OPTTYPE TVOTListBoxOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_LISTBOX, // Type + 0, // Flags OPTTF_xxxx + COUNT_ARRAY(TVOTLBCBOP), // Count + 0, // BegCtrlID + TVOTLBCBOP, // pOptParam + 0 // Style, OTS_xxxx + }; + + +OPTTYPE TVOTComboBoxOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_COMBOBOX, // Type + 0, // Flags OPTTF_xxxx + COUNT_ARRAY(TVOTLBCBOP), // Count + 0, // BegCtrlID + TVOTLBCBOP, // pOptParam + 0 // Style, OTS_xxxx + }; + +TCHAR TVOTEditBoxBuf[128] = TEXT("Confidential"); + +OPTPARAM TVOTEditBoxOP[] = { + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("*Mark*"), // pData + IDI_CPSUI_WATERMARK, // IconID + 0 // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("Type in WaterMark text"), // pData + COUNT_ARRAY(TVOTEditBoxBuf), // IconID + 0 // lParam + } +}; + + +OPTTYPE TVOTEditBoxOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_EDITBOX, // Type + 0, // Flags OPTTF_xxxx + 2, // Count + 0, // BegCtrlID + TVOTEditBoxOP, // pOptParam + 0 // Style, OTS_xxxx + }; + +OPTPARAM TVOTChkBoxOP[] = { + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + CHKBOXS_FALSE_TRUE, // style + TEXT("Let's do it!"), // pData + IDI_CPSUI_TELEPHONE, // IconID + 0 // lParam + } +}; + + + +OPTTYPE TVOTChkBoxOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_CHKBOX, // Type + 0, // Flags OPTTF_xxxx + 1, // Count + 0, // BegCtrlID + TVOTChkBoxOP, // pOptParam + 0 // Style, OTS_xxxx + }; + + +OPTPARAM ChkBoxTypeOP[] = { + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("CHKBOXS_FALSE_TRUE"), // pData + IDI_CPSUI_EMPTY, // IconID + CHKBOXS_FALSE_TRUE // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("CHKBOXS_NO_YES"), // pData + IDI_CPSUI_EMPTY, // IconID + CHKBOXS_NO_YES // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("CHKBOXS_OFF_ON"), // pData + IDI_CPSUI_EMPTY, // IconID + CHKBOXS_OFF_ON // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("CHKBOXS_FALSE_PDATA"), // pData + IDI_CPSUI_EMPTY, // IconID + CHKBOXS_FALSE_PDATA // lParam + }, + + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("CHKBOXS_NO_PDATA"), // pData + IDI_CPSUI_EMPTY, // IconID + CHKBOXS_NO_PDATA // lParam + }, + + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("CHKBOXS_OFF_PDATA"), // pData + IDI_CPSUI_EMPTY, // IconID + CHKBOXS_OFF_PDATA // lParam + }, + + { + sizeof(OPTPARAM), // cbSize + 0, // OPTPF_xxx + 0, // style + TEXT("CHKBOXS_NONE_PDATA"), // pData + IDI_CPSUI_EMPTY, // IconID + CHKBOXS_NONE_PDATA // lParam + } +}; + + +OPTTYPE ChkBoxTypeOT = { + + sizeof(OPTTYPE), // cbSize + TVOT_LISTBOX, // Type + 0, // Flags OPTTF_xxxx + COUNT_ARRAY(ChkBoxTypeOP), // Count + 0, // BegCtrlID + ChkBoxTypeOP, // pOptParam + 0 // Style, OTS_xxxx + }; + +EXTCHKBOX TV_ECB = { + + sizeof(EXTCHKBOX), + ECBF_OVERLAY_WARNING_ICON, + TEXT("Extended CheckBox Test"), + (LPTSTR)IDS_CPSUI_SLASH_SEP, + TEXT("Got Checked!!!"), + IDI_APPLE }; + +EXTPUSH TV_EP = { + + sizeof(EXTPUSH), + 0, + TEXT("Extended Push Test"), + NULL, //DLGPROC + IDI_APPLE, + 0 }; + + + +OPTITEM TVTestOptItems[] = { + + { sizeof(OPTITEM), LEVEL_0, 0, OPTIF_NONE, 0, + (LPTSTR)TEXT("TreeView Test"), IDI_CPSUI_QUESTION, NULL, + NULL, 0, DMPUB_TVTEST }, + + { sizeof(OPTITEM), LEVEL_1, 0, OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("CPSUI Options"), 0, NULL, + NULL, 0, DMPUB_TVOPT }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Extended Type"), 0, &ECB_EP_ECB, + &ECB_EP_OT, 0, DMPUB_TVOPT_ECB_EP }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Disabled Extended"), 0, NULL, + &NoYesOT, 0, DMPUB_EXT_DISABLED }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Overlay 'Warning' Icon"), 0, NULL, + &NoYesOT, 0, DMPUB_EXT_OVERLAY_WARNING }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Overlay 'Stop' Icon"), 0, NULL, + &NoYesOT, 0, DMPUB_EXT_OVERLAY_STOP }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Overlay 'No' Icon"), 0, NULL, + &NoYesOT, 0, DMPUB_EXT_OVERLAY_NO }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("OptItem/OptType"), 0, NULL, + NULL, 0, DMPUB_TVOPT }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Disabled OptType"), 0, NULL, + &NoYesOT, 0, DMPUB_TVOPT_DISABLED }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Overlay 'Warning' Icon"), 0, NULL, + &NoYesOT, 0, DMPUB_TVOPT_OVERLAY_WARNING }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Overlay 'Stop' Icon"), 0, NULL, + &NoYesOT, 0, DMPUB_TVOPT_OVERLAY_STOP }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Overlay 'No' Icon"), 0, NULL, + &NoYesOT, 0, DMPUB_TVOPT_OVERLAY_NO }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("ScrollBar/TrackBar Ranges"), 0, NULL, + NULL, 0, DMPUB_TVOPT }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + TEXT("Min Range"), MIN_INT, NULL, + &MinRangeOT, 0, DMPUB_MINRANGE }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + TEXT("Max. Range"), MAX_INT, NULL, + &MaxRangeOT, 0, DMPUB_MAXRANGE }, + + { sizeof(OPTITEM), LEVEL_1, 0, OPTIF_NONE, 0, + TEXT("TVOT Test"), IDI_CPSUI_QUESTION, NULL, + NULL, 0, DMPUB_TVOPT_TEST }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, + (LPTSTR)TEXT("TVOT_2STATES"), 0, NULL, + &TVOT2StatesOT, 0, DMPUB_2STATES }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, + TEXT("TVOT_3STATES"), 0, NULL, + &TVOT3StatesOT, 0, DMPUB_3STATES }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, + TEXT("TVOT_UDARROW"), 55, NULL, + &TVOTUDArrowOT, 0, DMPUB_UDARROW }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, + TEXT("TVOT_TRACKBAR"), 100, NULL, + &TVOTTrackBarOT, 0, DMPUB_TRACKBAR }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, + TEXT("TVOT_SCROLLBAR"), 210, NULL, + &TVOTScrollBarOT, 0, DMPUB_SCROLLBAR }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, + TEXT("TVOT_LISTBOX"), 2, NULL, + &TVOTListBoxOT, 0, DMPUB_LISTBOX }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Include 16x16 Icons"), 1, NULL, + &NoYesOT, 0, DMPUB_TVOPT_ICONS }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, + TEXT("TVOT_COMBOBOX"), 4, NULL, + &TVOTComboBoxOT, 0, DMPUB_COMBOBOX }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0, + (LPTSTR)TEXT("Include 16x16 Icons"), 1, NULL, + &NoYesOT, 0, DMPUB_TVOPT_ICONS }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, + TEXT("TVOT_EDITBOX"), 0, NULL, // fill in TVOTEditBoxBuf later + &TVOTEditBoxOT, 0, DMPUB_EDITBOX }, + + { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0, + TEXT("TVOT_CHKBOX"), 0, NULL, + &TVOTChkBoxOT, 0, DMPUB_CHKBOX }, + + { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK, 0, + TEXT("CheckBox Type"), 0, NULL, + &ChkBoxTypeOT, 0, DMPUB_CHKBOX_TYPE } + +}; + + + +INT_PTR +CALLBACK +PushButtonProc( + HWND hDlg, + UINT Msg, + WPARAM wParam, + LPARAM lParam + ) +{ + +#ifndef DBG + UNREFERENCED_PARAMETER(lParam); +#endif + + switch (Msg) { + + case WM_INITDIALOG: /* message: initialize dialog box */ + + CPSUIDBG(DBG_PUSHDLGPROC, + ("PushButtonProc lParam=%s", (LPSTR)lParam)); + break; + + case WM_COMMAND: + + switch(LOWORD(wParam)) { + + case IDOK: + case IDCANCEL: + + EndDialog(hDlg, (BOOL)(LOWORD(wParam) == IDOK)); + return(TRUE); + } + } + + return(FALSE); +} + + + +INT_PTR +APIENTRY +MyAboutProc( + HWND hDlg, + UINT Msg, + WPARAM wParam, + LPARAM lParam + ) + +/*++ + +Routine Description: + + This is the about... callback which pop up appliation's own about + + +--*/ +{ + PCOMPROPSHEETUI pCPSUI = NULL; + TCHAR Buf[128] = {0}; + HRESULT hr = S_OK; + + switch (Msg) { + + case WM_INITDIALOG: /* message: initialize dialog box */ + + pCPSUI = (PCOMPROPSHEETUI)lParam; + + hr = pCPSUI ? S_OK : E_INVALIDARG; + + if (SUCCEEDED(hr)) + { + hr = StringCchPrintf(Buf, ARRAY_SIZE(Buf), TEXT("About %s"), pCPSUI->pCallerName); + } + + if (SUCCEEDED(hr)) + { + hr = SetWindowText(hDlg, Buf) ? S_OK : E_FAIL; + } + + if (SUCCEEDED(hr)) + { + hr = StringCchPrintf(Buf, ARRAY_SIZE(Buf), + TEXT("%s Version %u.%u"), + pCPSUI->pCallerName, + (UINT)HIBYTE(pCPSUI->CallerVersion), + (UINT)LOBYTE(pCPSUI->CallerVersion)); + } + + if (SUCCEEDED(hr)) + { + hr = SetDlgItemText(hDlg, IDD_ABOUT1, Buf) ? S_OK : E_FAIL; + } + + if (SUCCEEDED(hr)) + { + hr = StringCchPrintf(Buf, ARRAY_SIZE(Buf), + TEXT("%s Version %u.%u"), + pCPSUI->pOptItemName, + (UINT)HIBYTE(pCPSUI->OptItemVersion), + (UINT)LOBYTE(pCPSUI->OptItemVersion)); + } + + if (SUCCEEDED(hr)) + { + hr = SetDlgItemText(hDlg, IDD_ABOUT2, Buf) ? S_OK : E_FAIL; + } + + break; + + case WM_COMMAND: + + switch(LOWORD(wParam)) { + + case IDOK: + case IDCANCEL: + + EndDialog(hDlg, (BOOL)(LOWORD(wParam) == IDOK)); + return(TRUE); + } + } + + return (FALSE); +} + + + +POPTITEM +FindOptItem( + POPTITEM pOptItem, + UINT cOptItem, + BYTE DMPubID + ) +{ + while (cOptItem--) { + + if (pOptItem->DMPubID == DMPubID) { + + return(pOptItem); + } + + ++pOptItem; + } + + return(NULL); +} + + + +CPSUICALLBACK +TVTestCallBack( + _In_ PCPSUICBPARAM pCPSUICBParam + ) +{ + POPTITEM pCurItem = pCPSUICBParam->pCurItem; + POPTITEM pItem; + BYTE DMPubID; + LONG Sel; + LONG Action = CPSUICB_ACTION_NONE; + + + DMPubID = pCurItem->DMPubID; + Sel = pCurItem->Sel; + + switch (pCPSUICBParam->Reason) { + + case CPSUICB_REASON_OPTITEM_SETFOCUS: + + CPSUIDBG(DBG_TVTESTCB, ("Got OPTITEM_SETFOCUS CallBack now")); + + switch (DMPubID) + { + case DMPUB_MINRANGE: + { + pItem = FindOptItem(pCPSUICBParam->pOptItem, + pCPSUICBParam->cOptItem, + DMPUB_MAXRANGE); + + if (pItem) + { + pCurItem->pOptType->pOptParam[1].lParam = (LONG)pItem->Sel; + } + } + + break; + + case DMPUB_MAXRANGE: + { + pItem = FindOptItem(pCPSUICBParam->pOptItem, + pCPSUICBParam->cOptItem, + DMPUB_MINRANGE); + + if (pItem) + { + pCurItem->pOptType->pOptParam[1].IconID = (DWORD)pItem->Sel; + } + } + + break; + + } + + break; + + case CPSUICB_REASON_ABOUT: + + DialogBoxParam(hInstApp, + MAKEINTRESOURCE(DLGABOUT), + pCPSUICBParam->hDlg, + MyAboutProc, + (LPARAM)(pCPSUICBParam->pOldSel)); + + break; + + case CPSUICB_REASON_ECB_CHANGED: + + CPSUIDBG(DBG_TVTESTCB, ("Got ECB_CHANGED CallBack now")); + + switch (DMPubID) { + + case DMPUB_TVOPT_ECB_EP: + + if (pCurItem->Flags & OPTIF_ECB_CHECKED) { + + TV_EP.IconID = + TV_ECB.IconID = IDI_APPLE; + + } else { + + TV_EP.IconID = + TV_ECB.IconID = 0; + } + + Action = CPSUICB_ACTION_OPTIF_CHANGED; + break; + + default: + + break; + } + + break; + + case CPSUICB_REASON_SEL_CHANGED: + + CPSUIDBG(DBG_TVTESTCB, ("Got SEL_CHANGED CallBack now")); + + switch (DMPubID) + { + case DMPUB_CHKBOX_TYPE: + { + pItem = FindOptItem(pCPSUICBParam->pOptItem, + pCPSUICBParam->cOptItem, + DMPUB_CHKBOX); + + if (pItem) + { + pItem->pOptType->pOptParam[0].Style = (BYTE)pCurItem->Sel; + + pItem->Flags |= OPTIF_CHANGED; + Action = CPSUICB_ACTION_OPTIF_CHANGED; + } + } + break; + + case DMPUB_TVOPT_ICONS: + + pItem = pCurItem - 1; + + if (Sel) { + + pItem->pOptType->Style &= ~OTS_LBCB_NO_ICON16_IN_ITEM; + + } else { + + pItem->pOptType->Style |= OTS_LBCB_NO_ICON16_IN_ITEM; + } + + break; + + case DMPUB_EXT_OVERLAY_WARNING: + + if (Sel) { + + TV_EP.Flags |= EPF_OVERLAY_WARNING_ICON; + TV_ECB.Flags |= ECBF_OVERLAY_WARNING_ICON; + + } else { + + TV_EP.Flags &= ~EPF_OVERLAY_WARNING_ICON; + TV_ECB.Flags &= ~ECBF_OVERLAY_WARNING_ICON; + } + + break; + + case DMPUB_EXT_OVERLAY_STOP: + + if (Sel) { + + TV_EP.Flags |= EPF_OVERLAY_STOP_ICON; + TV_ECB.Flags |= ECBF_OVERLAY_STOP_ICON; + + } else { + + TV_EP.Flags &= ~EPF_OVERLAY_STOP_ICON; + TV_ECB.Flags &= ~ECBF_OVERLAY_STOP_ICON; + } + + break; + + case DMPUB_EXT_OVERLAY_NO: + + if (Sel) { + + TV_EP.Flags |= EPF_OVERLAY_NO_ICON; + TV_ECB.Flags |= ECBF_OVERLAY_NO_ICON; + + } else { + + TV_EP.Flags &= ~EPF_OVERLAY_NO_ICON; + TV_ECB.Flags &= ~ECBF_OVERLAY_NO_ICON; + } + + break; + + case DMPUB_MINRANGE: + + MinMaxRangeOP[1].IconID = (DWORD)Sel; + break; + + case DMPUB_MAXRANGE: + + MinMaxRangeOP[1].lParam = (LONG)Sel; + break; + + case DMPUB_TVOPT_OVERLAY_WARNING: + case DMPUB_TVOPT_OVERLAY_STOP: + case DMPUB_TVOPT_OVERLAY_NO: + + Action = CPSUICB_ACTION_REINIT_ITEMS; + + case DMPUB_TVOPT_ECB_EP: + + if (Sel) { + + pCurItem->Flags &= ~OPTIF_EXT_DISABLED; + + } else { + + pCurItem->Flags |= OPTIF_EXT_DISABLED; + } + + pCurItem->Flags |= OPTIF_CHANGED; + Action = CPSUICB_ACTION_OPTIF_CHANGED; + + // + // Fall through + // + + case DMPUB_TVOPT_DISABLED: + case DMPUB_EXT_DISABLED: + + pItem = FindOptItem(pCPSUICBParam->pOptItem, + pCPSUICBParam->cOptItem, + DMPUB_2STATES); + + if (pItem) { + + do { + + if ((pItem->DMPubID >= DMPUB_2STATES) && + (pItem->DMPubID <= DMPUB_CHKBOX)) { + + switch (DMPubID) { + + case DMPUB_TVOPT_OVERLAY_WARNING: + + if (Sel) { + + pItem->Flags |= OPTIF_OVERLAY_WARNING_ICON; + + } else { + + pItem->Flags &= ~OPTIF_OVERLAY_WARNING_ICON; + } + + break; + + case DMPUB_TVOPT_OVERLAY_STOP: + + if (Sel) { + + pItem->Flags |= OPTIF_OVERLAY_STOP_ICON; + + } else { + + pItem->Flags &= ~OPTIF_OVERLAY_STOP_ICON; + } + + break; + + case DMPUB_TVOPT_OVERLAY_NO: + + if (Sel) { + + pItem->Flags |= OPTIF_OVERLAY_NO_ICON; + + } else { + + pItem->Flags &= ~OPTIF_OVERLAY_NO_ICON; + } + + break; + + case DMPUB_TVOPT_DISABLED: + + if (Sel) { + + pItem->pOptType->Flags |= OPTTF_TYPE_DISABLED; + + } else { + + pItem->pOptType->Flags &= ~OPTTF_TYPE_DISABLED; + } + + break; + + case DMPUB_EXT_DISABLED: + + if (Sel) { + + pItem->Flags |= OPTIF_EXT_DISABLED; + + } else { + + pItem->Flags &= ~OPTIF_EXT_DISABLED; + } + + break; + + case DMPUB_TVOPT_ECB_EP: + + switch (Sel) { + + case 0: + + pItem->Flags |= OPTIF_EXT_HIDE; + break; + + case 1: + + pItem->Flags &= ~(OPTIF_EXT_HIDE | + OPTIF_EXT_IS_EXTPUSH); + pItem->pExtChkBox = &TV_ECB; + + break; + + case 2: + + pItem->Flags &= ~OPTIF_EXT_HIDE; + pItem->Flags |= OPTIF_EXT_IS_EXTPUSH; + pItem->pExtPush = &TV_EP; + break; + } + } + } + + pItem->Flags |= OPTIF_CHANGED; + + } while ((pItem++)->DMPubID != DMPUB_CHKBOX); + } + + break; + + default: + + break; + } + + break; + + case CPSUICB_REASON_PUSHBUTTON: + + CPSUIDBG(DBG_TVTESTCB, ("Got PUSH Button CallBack now")); + break; + + case CPSUICB_REASON_EXTPUSH: + + DialogBoxParam(hInstApp, + MAKEINTRESOURCE(EXTPUSH_DLG), + pCPSUICBParam->hDlg, + PushButtonProc, + (LPARAM)(pCPSUICBParam->pOldSel)); + break; + + default: + + break; + } + + return(Action); +} + + + +BOOL +SetupComPropSheetUI( + _In_ PCOMPROPSHEETUI pCPSUI + ) +{ + static BOOL UpdateEditBox = TRUE; + UINT i; + + + ZeroMemory(pCPSUI, sizeof(COMPROPSHEETUI)); + + pCPSUI->cbSize = sizeof(COMPROPSHEETUI); + pCPSUI->hInstCaller = hInstApp; + pCPSUI->pCallerName = (LPTSTR)TitleName; + pCPSUI->CallerVersion = 0x100; + pCPSUI->pOptItemName = (LPTSTR)OptItemName; + pCPSUI->OptItemVersion = 0x400; + pCPSUI->UserData = (ULONG_PTR)pCPSUI; + pCPSUI->pHelpFile = (LPTSTR)TEXT("CPSUISam.hlp"); + pCPSUI->pfnCallBack = TVTestCallBack; + pCPSUI->pOptItem = TVTestOptItems; + pCPSUI->cOptItem = COUNT_ARRAY(TVTestOptItems); + pCPSUI->Flags = 0; + pCPSUI->pDlgPage = CPSUI_PDLGPAGE_TREEVIWONLY; + pCPSUI->cDlgPage = 0; + + + if (UpdateEditBox) { + + // + // Fixup compiler warning for the LPSTR and LONG + // + + for (i = 0; i < COUNT_ARRAY(TVTestOptItems); i++) { + + if (TVTestOptItems[i].DMPubID == DMPUB_EDITBOX) { + + TVTestOptItems[i].pSel = (LPTSTR)TVOTEditBoxBuf; + UpdateEditBox = FALSE; + break; + } + } + } + + if (UpdatePermission) { + + pCPSUI->Flags |= CPSUIF_UPDATE_PERMISSION; + } + + if (!UseStdAbout) { + + pCPSUI->Flags |= CPSUIF_ABOUT_CALLBACK; + } + + return(TRUE); +} diff --git a/print/cpsuisam/CPSUIDAT.H b/print/cpsuisam/CPSUIDAT.H new file mode 100644 index 00000000..7043d9c2 --- /dev/null +++ b/print/cpsuisam/CPSUIDAT.H @@ -0,0 +1,73 @@ +/*++ + +Copyright (c) 1990-2003 Microsoft Corporation +All Rights Reserved + + +Module Name: + + cpsuidat.h + + +Abstract: + + This module + + +[Environment:] + + Windows 2000, Windows XP, Windows Server 2003 - Common Printer Driver UI DLL + + +--*/ + + +#define COUNT_ARRAY(a) (sizeof(a) / sizeof((a)[0])) + + +#define OPTIF_NONE 0 + +#define LEVEL_0 0 +#define LEVEL_1 1 +#define LEVEL_2 2 +#define LEVEL_3 3 +#define LEVEL_4 4 + + +#define DMPUB_TVTEST (DMPUB_USER + 1) +#define DMPUB_TVOPT (DMPUB_USER + 2) +#define DMPUB_TVOPT_ECB_EP (DMPUB_USER + 3) +#define DMPUB_TVOPT_ICONS (DMPUB_USER + 4) +#define DMPUB_TVOPT_DISABLED (DMPUB_USER + 5) +#define DMPUB_TVOPT_TEST (DMPUB_USER + 6) +#define DMPUB_2STATES (DMPUB_USER + 7) +#define DMPUB_3STATES (DMPUB_USER + 8) +#define DMPUB_UDARROW (DMPUB_USER + 9) +#define DMPUB_TRACKBAR (DMPUB_USER + 10) +#define DMPUB_SCROLLBAR (DMPUB_USER + 11) +#define DMPUB_LISTBOX (DMPUB_USER + 12) +#define DMPUB_COMBOBOX (DMPUB_USER + 13) +#define DMPUB_EDITBOX (DMPUB_USER + 14) +#define DMPUB_PUSHBUTTON (DMPUB_USER + 15) +#define DMPUB_CHKBOX (DMPUB_USER + 16) +#define DMPUB_CHKBOX_TYPE (DMPUB_USER + 17) +#define DMPUB_TVOPT_OVERLAY_WARNING (DMPUB_USER + 18) +#define DMPUB_TVOPT_OVERLAY_STOP (DMPUB_USER + 19) +#define DMPUB_TVOPT_OVERLAY_NO (DMPUB_USER + 20) +#define DMPUB_EXT_OVERLAY_WARNING (DMPUB_USER + 21) +#define DMPUB_EXT_OVERLAY_STOP (DMPUB_USER + 22) +#define DMPUB_EXT_OVERLAY_NO (DMPUB_USER + 23) +#define DMPUB_EXT_DISABLED (DMPUB_USER + 24) +#define DMPUB_MINRANGE (DMPUB_USER + 25) +#define DMPUB_MAXRANGE (DMPUB_USER + 26) + +#define MAX_INT 0x00007fff +#define MIN_INT 0xFFFF8000 + + + +BOOL +SetupComPropSheetUI +( + _In_ PCOMPROPSHEETUI pCPSUI +); diff --git a/print/cpsuisam/CPSUISAM.DEF b/print/cpsuisam/CPSUISAM.DEF new file mode 100644 index 00000000..f254e960 --- /dev/null +++ b/print/cpsuisam/CPSUISAM.DEF @@ -0,0 +1,6 @@ +; module-definition file for SurPtrUI -- used by LINK.EXE + +NAME CPSUI ; application's module name + +DESCRIPTION 'Microsoft Windows 2000/Windows XP/Windows Server 2003 Common Property Sheet UI Sample Program' + diff --git a/print/cpsuisam/CPSUISAM.DLG b/print/cpsuisam/CPSUISAM.DLG new file mode 100644 index 00000000..29112c5d --- /dev/null +++ b/print/cpsuisam/CPSUISAM.DLG @@ -0,0 +1,35 @@ +1 DLGINCLUDE "cpsuisam.h" + +PUSHBUTTON_DLG DIALOGEX 9, 18, 160, 100 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Push Button Dialog" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "The TVOT_PUSHBUTTON's Button is Pushed. Press OK to Continue...", + -1, 10, 21, 141, 37 + DEFPUSHBUTTON "OK", IDOK, 88, 78, 63, 14 +END + +DLGABOUT DIALOGEX 5, 15, 200, 90 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "About 1 Text", IDD_ABOUT1, 38, 12, 152, 20 + LTEXT "About 2 Text", IDD_ABOUT2, 38, 36, 152, 24 + DEFPUSHBUTTON "OK", IDOK, 126, 68, 59, 14 + ICON IDI_APPLE, IDD_ABOUTICON, 8, 20, 18, 20 +END + +EXTPUSH_DLG DIALOGEX 6, 18, 214, 78 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Extended Push Button DIALOG BOX" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "You just push the 'Extended Push Test' push button. To Continue press OK button...", + -1, 12, 10, 187, 30 + DEFPUSHBUTTON "OK", IDOK, 129, 54, 69, 14 +END diff --git a/print/cpsuisam/CPSUISAM.H b/print/cpsuisam/CPSUISAM.H new file mode 100644 index 00000000..bcddc730 --- /dev/null +++ b/print/cpsuisam/CPSUISAM.H @@ -0,0 +1,37 @@ +/*++ + +Copyright (c) 1990-2003 Microsoft Corporation +All Rights Reserved + + +Module Name: + + cpsuisam.h + + +Abstract: + + This module is the header file for the sample + + +[Environment:] + + +--*/ + + +#define IDM_PERMISSION 10 +#define IDM_USESTDABOUT 20 +#define IDM_DOCPROP 30 +#define IDM_TVTEST 40 +#define IDM_DOCPROP_TVTEST 50 + +#define IDI_CPSUISAMPLE 500 +#define IDI_APPLE 510 + +#define PUSHBUTTON_DLG 1000 +#define DLGABOUT 1010 +#define EXTPUSH_DLG 1020 +#define IDD_ABOUT1 201 +#define IDD_ABOUT2 202 +#define IDD_ABOUTICON 203 diff --git a/print/cpsuisam/DEBUG.C b/print/cpsuisam/DEBUG.C new file mode 100644 index 00000000..48853686 --- /dev/null +++ b/print/cpsuisam/DEBUG.C @@ -0,0 +1,114 @@ +/*++ + +Copyright (c) 1990-2003 Microsoft Corporation +All Rights Reserved + +Module Name: + + debug.c + +Abstract: + + This module contains all debugging routines + +[Environment:] + + NT Windows - Common Printer Driver UI DLL. + +[Notes:] + +Revision History: + +--*/ + +#include "precomp.h" +#pragma hdrstop + +#if DBG + +BOOL DoCPSUIWarn = TRUE; + +VOID +cdecl +CPSUIDbgPrint +( + LPCSTR pszFormat, + ... +) +/*++ + +Routine Description: + + This fucntion output the debug informat to the debugger + +Arguments: + + pszFormat - format string + + ... - variable data + +Return Value: + + VOID + +--*/ +{ + va_list vaList; + static TCHAR OutBuf[768]; +#ifdef UNICODE + static WCHAR FormatBuf[256]; +#endif + // + // We assume that UNICODE flag is turn on for the compilation, bug the + // format string passed to here is ASCII version, so we need to convert + // it to LPWSTR before the wvsprintf() + // + + va_start(vaList, pszFormat); + +#ifdef UNICODE + MultiByteToWideChar(CP_ACP, 0, pszFormat, -1, FormatBuf, COUNT_ARRAY(FormatBuf)); + StringCchVPrintf(OutBuf, COUNT_ARRAY(OutBuf), FormatBuf, vaList); +#else + StringCchVPrintf(OutBuf, COUNT_ARRAY(OutBuf), pszFormat, vaList); +#endif + va_end(vaList); + + OutputDebugString((LPTSTR)OutBuf); + OutputDebugString(TEXT("\n")); +} + +VOID +CPSUIDbgType +( + INT Type +) +/*++ + +Routine Description: + + this function output the ERROR/WARNING message + +Arguments: + + Type + +Return Value: + +--*/ +{ + static TCHAR DebugDLLName[] = TEXT("SurPtrUI"); + + if (Type < 0) + { + OutputDebugString(TEXT("ERROR) ")); + } + else if (Type > 0) + { + OutputDebugString(TEXT("WARNING: ")); + } + OutputDebugString(DebugDLLName); + OutputDebugString(TEXT("!")); +} + +#endif // DBG diff --git a/print/cpsuisam/DEBUG.H b/print/cpsuisam/DEBUG.H new file mode 100644 index 00000000..5d6b88a3 --- /dev/null +++ b/print/cpsuisam/DEBUG.H @@ -0,0 +1,66 @@ +/*++ + +Copyright (c) 1990-2003 Microsoft Corporation +All Rights Reserved + + +Module Name: + + debug.h + + +Abstract: + + This module contains all debugger definitions + + +[Environment:] + + NT Windows - Common Printer Driver UI DLL. + + +--*/ + + +#if DBG + +VOID +cdecl +CPSUIDbgPrint +( + LPCSTR pszFormat, + ... +); + +VOID +CPSUIDbgType +( + INT Type +); + +extern BOOL DoCPSUIWarn; + +#define DBGP(x) (CPSUIDbgPrint x) + +#define DEFINE_DBGVAR(x) DWORD DBG_CPSUIFILENAME=(x) + +#define CPSUIDBG(x,y) if((x)&DBG_CPSUIFILENAME){CPSUIDbgType(0);DBGP(y);} + +#define CPSUIDBGBLK(x) x; +#define CPSUIWARN(x) if(DoCPSUIWarn) { CPSUIDbgType(1);DBGP(x); } +#define CPSUIERR(x) CPSUIDbgType(-1);DBGP(x) +#define CPSUIRIP(x) CPSUIERR(x); DebugBreak() +#define CPSUIASSERT(b,x,e,i) \ + if (!(e)) { _CPSUIAssert(x,#e,__FILE__,(UINT)__LINE__,(DWORD)i,b); } + +#else // DBG + +#define CPSUIDBGBLK(x) +#define DEFINE_DBGVAR(x) +#define CPSUIDBG(x,y) +#define CPSUIWARN(x) +#define CPSUIERR(x) +#define CPSUIRIP(x) +#define CPSUIASSERT(b,x,e,i) + +#endif // DBG diff --git a/print/cpsuisam/PRECOMP.H b/print/cpsuisam/PRECOMP.H new file mode 100644 index 00000000..4e63995b --- /dev/null +++ b/print/cpsuisam/PRECOMP.H @@ -0,0 +1,17 @@ +// +// Copyright (c) 1990-2003 Microsoft Corporation +// All Rights Reserved +// + +#include <stddef.h> +#include <windows.h> +#include <winspool.h> +#include <winddiui.h> +#include <commctrl.h> +#include <commdlg.h> +#include <compstui.h> +#include <shlwapi.h> +#include <strsafe.h> +#include "debug.h" +#include "cpsuisam.h" +#include "cpsuidat.h" diff --git a/print/cpsuisam/ReadMe.md b/print/cpsuisam/ReadMe.md new file mode 100644 index 00000000..a4fddfb9 --- /dev/null +++ b/print/cpsuisam/ReadMe.md @@ -0,0 +1,13 @@ +Common Property Sheet UI Sample +=============================== + +The CPSUISAM application causes the Common Property Sheet User Interface (CPSUI) to call the Windows print spooler to create property sheet pages for the system's default printer. + +Printer interface DLLs must not perform this action and this sample shows how create property sheet pages for a printer. + +The application then creates an additional property sheet page to illustrate some of the techniques that you can use when you are using CPSUI to create a new page. + +CPSUI is a user-mode DLL that enables you to create property sheet pages that have a standard appearance. + +CPSUIAM causes CPSUI to call the Windows print spooler to create property sheet pages for the system's default printer. The application then creates an additional property sheet page to illustrate some of the techniques that you can use when you are using CPSUI to create a new page. For more information, see [Common Property Sheet User Interface](http://msdn.microsoft.com/en-us/library/windows/hardware/ff546163(v=vs.85).aspx). + diff --git a/print/cpsuisam/cpsuisam.c b/print/cpsuisam/cpsuisam.c new file mode 100644 index 00000000..d63b5844 --- /dev/null +++ b/print/cpsuisam/cpsuisam.c @@ -0,0 +1,665 @@ +/*++ + +Copyright (c) 1990-2003 Microsoft Corporation +All Rights Reserved + + +Module Name: + + cpsuisam.c + + +Abstract: + + This module contrains sample prototype for the + Windows 2000/Windows XP/Windows Server 2003 common Property + Sheet user interface + +--*/ + +#include "precomp.h" +#pragma hdrstop + +#define DBG_CPSUIFILENAME DbgCPSUISam + + + +#define DBG_WINMAINPROC 0x00000001 + +DEFINE_DBGVAR(0); + + + +#define HAS_TVTEST_PAGES 0x01 +#define HAS_DOCPROP_PAGES 0x02 + + + +extern HINSTANCE hInstApp; +extern TCHAR TitleName[]; +extern TCHAR ClassName[]; +extern TCHAR MenuName[]; +extern TCHAR szWinSpool[]; +extern CHAR szDocPropSheets[]; +extern BOOL UpdatePermission; +extern BOOL UseStdAbout; + + +HWND hWndApp = NULL; + + +typedef struct _CPSUISAMPLE +{ + HANDLE hParent; + HANDLE hCPSUI; + HANDLE hDocProp; + PFNCOMPROPSHEET pfnCPS; + COMPROPSHEETUI CPSUI; + DOCUMENTPROPERTYHEADER DPHdr; + HGLOBAL hDevMode; + HGLOBAL hDevNames; +} CPSUISAMPLE, *PCPSUISAMPLE; + +BOOL +GetDefPrinter +( + PCPSUISAMPLE pCPSUISample +) +{ + HGLOBAL hDevMode = NULL; + HGLOBAL hDevNames = NULL; + LPTSTR pszPrinterName = NULL; + DEVMODE *pDM = NULL; + DEVNAMES *pDN = NULL; + HANDLE hPrinter = NULL; + PAGESETUPDLG PSD = {0}; + BOOL Ok = FALSE; + + PSD.lStructSize = sizeof(PSD); + PSD.Flags = PSD_RETURNDEFAULT; + + if (PageSetupDlg(&PSD)) + { + hDevMode = PSD.hDevMode; + + if (NULL != hDevMode) + { + pDM = (DEVMODE *)GlobalLock(hDevMode); + if (NULL != pDM) + { + hDevNames = PSD.hDevNames; + if (hDevNames) + { + pDN = (DEVNAMES *)GlobalLock(hDevNames); + if (NULL != pDN) + { + pszPrinterName = (LPTSTR)pDN + pDN->wDeviceOffset; + if (pszPrinterName != NULL) + { + if (OpenPrinter(pszPrinterName, &hPrinter, NULL)) + { + Ok = TRUE; + } + } + } + } + } + } + + if (Ok) + { + HGLOBAL h = pCPSUISample->hDevMode; + + if (NULL != h) + { + GlobalUnlock(h); + GlobalFree(h); + } + + h = pCPSUISample->hDevNames; + + if (NULL != h) + { + GlobalUnlock(h); + GlobalFree(h); + } + + if (pCPSUISample->DPHdr.hPrinter) + { + ClosePrinter(pCPSUISample->DPHdr.hPrinter); + } + + pCPSUISample->hDevMode = PSD.hDevMode; + pCPSUISample->hDevNames = PSD.hDevNames; + + pCPSUISample->DPHdr.cbSize = sizeof(DOCUMENTPROPERTYHEADER); + pCPSUISample->DPHdr.hPrinter = hPrinter; + pCPSUISample->DPHdr.pszPrinterName = pszPrinterName; + pCPSUISample->DPHdr.pdmIn = + pCPSUISample->DPHdr.pdmOut = pDM; + pCPSUISample->DPHdr.fMode = (DM_IN_BUFFER | DM_IN_PROMPT | DM_OUT_BUFFER); + + if (!UpdatePermission) + { + pCPSUISample->DPHdr.fMode |= DM_NOPERMISSION; + } + } + else + { + hDevMode = PSD.hDevMode; + hDevNames = PSD.hDevNames; + + if (NULL != hDevMode) + { + GlobalUnlock(hDevMode); + GlobalFree(hDevMode); + } + + if (NULL != hDevNames) + { + GlobalUnlock(hDevNames); + GlobalFree(hDevNames); + } + + if (hPrinter) + { + ClosePrinter(hPrinter); + } + } + } + + return Ok; +} + + +LONG +CALLBACK +CPSUIFunc +( + _In_ PPROPSHEETUI_INFO pPSUIInfo, + LPARAM lParam +) +{ + PPROPSHEETUI_INFO_HEADER pPSUIInfoHdr; + PCPSUISAMPLE pCPSUISample; + HANDLE h; + INSERTPSUIPAGE_INFO InsPI; + + if (!pPSUIInfo) + { + return FALSE; + } + + switch (pPSUIInfo->Reason) + { + case PROPSHEETUI_REASON_INIT: + + pCPSUISample = (PCPSUISAMPLE)LocalAlloc(LPTR, sizeof(CPSUISAMPLE)); + if (NULL == pCPSUISample) + { + return(-1); + } + + pPSUIInfo->UserData = (ULONG_PTR)pCPSUISample; + pCPSUISample->hParent = pPSUIInfo->hComPropSheet; + pCPSUISample->pfnCPS = pPSUIInfo->pfnComPropSheet; + + // + // Add Document Property Sheet for current default Printer + // + + switch (pPSUIInfo->lParamInit) + { + case IDM_DOCPROP: + case IDM_DOCPROP_TVTEST: + + if (GetDefPrinter(pCPSUISample)) + { + InsPI.cbSize = sizeof(INSERTPSUIPAGE_INFO); + InsPI.Type = PSUIPAGEINSERT_DLL; + InsPI.Mode = INSPSUIPAGE_MODE_FIRST_CHILD; + InsPI.dwData1 = (ULONG_PTR)szWinSpool; + InsPI.dwData2 = (ULONG_PTR)szDocPropSheets; + InsPI.dwData3 = (ULONG_PTR)&(pCPSUISample->DPHdr); + + pCPSUISample->hDocProp = + (HANDLE)pCPSUISample->pfnCPS( pCPSUISample->hParent, + CPSFUNC_INSERT_PSUIPAGE, + (LPARAM)0, + (LPARAM)&InsPI + ); + } + break; + } + + // + // Add TreeView Page + // + + switch (pPSUIInfo->lParamInit) + { + case IDM_TVTEST: + case IDM_DOCPROP_TVTEST: + + if (SetupComPropSheetUI(&(pCPSUISample->CPSUI))) + { + InsPI.cbSize = sizeof(INSERTPSUIPAGE_INFO); + InsPI.Type = PSUIPAGEINSERT_PCOMPROPSHEETUI; + InsPI.Mode = INSPSUIPAGE_MODE_FIRST_CHILD; + InsPI.dwData1 = (ULONG_PTR)&(pCPSUISample->CPSUI); + InsPI.dwData2 = + InsPI.dwData3 = 0; + + pCPSUISample->hCPSUI = + (HANDLE)pCPSUISample->pfnCPS( pCPSUISample->hParent, + CPSFUNC_INSERT_PSUIPAGE, + (LPARAM)0, + (LPARAM)&InsPI + ); + } + break; + } + + if ( (pCPSUISample->hCPSUI) + || (pCPSUISample->hDocProp) + ) + { + return 1; + } + + break; + + case PROPSHEETUI_REASON_GET_INFO_HEADER: + + pPSUIInfoHdr = (PPROPSHEETUI_INFO_HEADER)lParam; + if (NULL != pPSUIInfoHdr) + { + pPSUIInfoHdr->pTitle = (LPTSTR)TitleName; + + switch (pPSUIInfo->lParamInit) + { + case IDM_DOCPROP: + + pPSUIInfoHdr->IconID = IDI_CPSUI_PRINTER2; + break; + + case IDM_TVTEST: + + pPSUIInfoHdr->IconID = IDI_CPSUI_OPTION2; + break; + + case IDM_DOCPROP_TVTEST: + + pPSUIInfoHdr->IconID = IDI_CPSUI_RUN_DIALOG; + break; + } + + pPSUIInfoHdr->Flags = PSUIHDRF_PROPTITLE | PSUIHDRF_NOAPPLYNOW; + pPSUIInfoHdr->hWndParent = hWndApp; + pPSUIInfoHdr->hInst = hInstApp; + + return 1; + } + + break; + + case PROPSHEETUI_REASON_SET_RESULT: + + pCPSUISample = (PCPSUISAMPLE)pPSUIInfo->UserData; + if ( (NULL != pCPSUISample) + && (pCPSUISample->hCPSUI == ((PSETRESULT_INFO)lParam)->hSetResult) + ) + { + // + // Save the result and propagate to its owner + // + pPSUIInfo->Result = ((PSETRESULT_INFO)lParam)->Result; + return 1; + } + + break; + + case PROPSHEETUI_REASON_DESTROY: + + pCPSUISample = (PCPSUISAMPLE)pPSUIInfo->UserData; + if (NULL != pCPSUISample) + { + h = pCPSUISample->hDevMode; + if (NULL != h) + { + GlobalUnlock(h); + GlobalFree(h); + } + + h = pCPSUISample->hDevNames; + if (NULL != h) + { + GlobalUnlock(h); + GlobalFree(h); + } + + if (pCPSUISample->DPHdr.hPrinter) + { + ClosePrinter(pCPSUISample->DPHdr.hPrinter); + } + + LocalFree((HLOCAL)pCPSUISample); + pPSUIInfo->UserData = 0; + } + return 1; + } + return -1; +} + +LRESULT +CALLBACK +MainWndProc +( + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam +) +/*++ + +Routine Description: + + This is the main window procedure to the testing program + + +Arguments: + + See SDK + + +Return Value: + + See SDK + +--*/ +{ + DWORD Result; + LONG Ret; + + switch (Msg) + { + case WM_INITMENUPOPUP: + + if (!HIWORD(lParam)) + { + CheckMenuItem( (HMENU)UIntToPtr((UINT)wParam), + IDM_PERMISSION, + MF_BYCOMMAND | ((UpdatePermission) ? MF_CHECKED : MF_UNCHECKED) + ); + + CheckMenuItem( (HMENU)UIntToPtr((UINT)wParam), + IDM_USESTDABOUT, + MF_BYCOMMAND | ((UseStdAbout) ? MF_CHECKED : MF_UNCHECKED) + ); + } + break; + + case WM_COMMAND: + + switch (wParam) + { + case IDM_USESTDABOUT: + + UseStdAbout = !UseStdAbout; + break; + + case IDM_PERMISSION: + + UpdatePermission = !UpdatePermission; + break; + + case IDM_DOCPROP: + case IDM_TVTEST: + case IDM_DOCPROP_TVTEST: + + Ret = CommonPropertySheetUI( hWnd, + (PFNPROPSHEETUI)CPSUIFunc, + (LPARAM)LOWORD(wParam), + &Result + ); + + CPSUIDBG( DBG_WINMAINPROC, + ("CommonPropertySheetUI()=%ld, Result=%ld", Ret, Result) + ); + + break; + + default: + + break; + } + break; + + case WM_DESTROY: + + PostQuitMessage(0); + break; + + default: + + return (DefWindowProc(hWnd, Msg, wParam, lParam)); + } + + return 0L; +} + +BOOL +InitInstance +( + HANDLE hInstance, + INT nCmdShow +) +/*++ + +Routine Description: + + Saves instance handle and creates main window + + This function is called at initialization time for every instance of + this application. This function performs initialization tasks that + cannot be shared by multiple instances. + + In this case, we save the instance handle in a static variable and + create and display the main program window. + + +Arguments: + + hInstance - Current instance identifier + + nComShow - Param for first ShowWindow() call. + + + +Return Value: + + TRUE/FALSE + + +--*/ +{ + // + // Save the instance handle in static variable, which will be used in + // many subsequence calls from this application to Windows. + // + + hInstApp = hInstance; + + // + // Create a main window for this application instance. + // + + hWndApp = CreateWindow( ClassName, + TitleName, + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + NULL, + NULL, + hInstance, + NULL + ); + if (NULL != hWndApp) + { + // + // Make the window visible; update its client area; + // and send WM_PAINT message + // + + ShowWindow(hWndApp, nCmdShow); + UpdateWindow(hWndApp); + } + + return ((hWndApp) ? TRUE : FALSE); +} + + +BOOL +InitApplication +( + HANDLE hInstance +) +/*++ + +Routine Description: + + Initializes window data and registers window class + + This function is called at initialization time only if no other + instances of the application are running. This function performs + initialization tasks that can be done once for any number of running + instances. + + In this case, we initialize a window class by filling out a data + structure of type WNDCLASS and calling the Windows RegisterClass() + function. Since all instances of this application use the same window + class, we only need to do this when the first instance is initialized. + + +Arguments: + + hInstance - current instance + + +Return Value: + + BOOLEAN + +--*/ +{ + WNDCLASS wc; + + // + // Fill in window class structure with parameters that describe the + // main window. + // + + wc.style = 0L; + wc.lpfnWndProc = MainWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_CPSUISAMPLE); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = MenuName; + wc.lpszClassName = ClassName; + + // + // Register the window class and return success/failure code. + // + return RegisterClass(&wc); +} + + +INT +APIENTRY +WinMain +( + _In_ HINSTANCE hInstance, + _In_opt_ HINSTANCE hPrevInstance, + _In_ LPSTR lpCmdLine, + _In_ INT nCmdShow +) +/*++ + +Routine Description: + + calls initialization function, processes message loop + + Windows recognizes this function by name as the initial entry point + for the program. This function calls the application initialization + routine, if no other instance of the program is running, and always + calls the instance initialization routine. It then executes a message + retrieval and dispatch loop that is the top-level control structure + for the remainder of execution. The loop is terminated when a WM_QUIT + message is received, at which time this function exits the application + instance by returning the value passed by PostQuitMessage(). + + If this function must abort before entering the message loop, it + returns the conventional value NULL. + + +Arguments: + + + +Return Value: + + Integer + + +--*/ +{ + MSG Msg; + + UNREFERENCED_PARAMETER(lpCmdLine); + + // + // Other instances of app running? + // + + if (!hPrevInstance) + { + if (!InitApplication(hInstance)) + { + // + // Initialize shared things, Exits if unable to initialize + // + return FALSE; + } + } + + // + // Perform initializations that apply to a specific instance + // + if (!InitInstance(hInstance, nCmdShow)) + { + return FALSE; + } + + // + // Acquire and dispatch messages until a WM_QUIT message is received. + // + while (GetMessage(&Msg, NULL, 0L, 0L)) + { + // + // Translates virtual key codes and Dispatches message to window + // + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } + + // + // Returns the value from PostQuitMessage + // + return((INT)Msg.wParam); +} + diff --git a/print/cpsuisam/cpsuisam.sln b/print/cpsuisam/cpsuisam.sln new file mode 100644 index 00000000..334867da --- /dev/null +++ b/print/cpsuisam/cpsuisam.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpsuisam", "cpsuisam.vcxproj", "{F7BAD220-8095-4F67-A75B-0250FCB2B670}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F7BAD220-8095-4F67-A75B-0250FCB2B670}.Debug|Win32.ActiveCfg = Debug|Win32 + {F7BAD220-8095-4F67-A75B-0250FCB2B670}.Debug|Win32.Build.0 = Debug|Win32 + {F7BAD220-8095-4F67-A75B-0250FCB2B670}.Release|Win32.ActiveCfg = Release|Win32 + {F7BAD220-8095-4F67-A75B-0250FCB2B670}.Release|Win32.Build.0 = Release|Win32 + {F7BAD220-8095-4F67-A75B-0250FCB2B670}.Debug|x64.ActiveCfg = Debug|x64 + {F7BAD220-8095-4F67-A75B-0250FCB2B670}.Debug|x64.Build.0 = Debug|x64 + {F7BAD220-8095-4F67-A75B-0250FCB2B670}.Release|x64.ActiveCfg = Release|x64 + {F7BAD220-8095-4F67-A75B-0250FCB2B670}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/print/cpsuisam/cpsuisam.vcxproj b/print/cpsuisam/cpsuisam.vcxproj new file mode 100644 index 00000000..91f302ef --- /dev/null +++ b/print/cpsuisam/cpsuisam.vcxproj @@ -0,0 +1,255 @@ +<?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="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{F7BAD220-8095-4F67-A75B-0250FCB2B670}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <SampleGuid>{67BF1D0E-F90D-414D-A13C-543092176A80}</SampleGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType /> + <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <OutDir>$(IntDir)</OutDir> + </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </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')" /> + </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')" /> + </ImportGroup> + <ItemGroup Label="WrappedTaskItems" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>cpsuisam</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>cpsuisam</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>cpsuisam</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>cpsuisam</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);comdlg32.lib;winspool.lib;comctl32.lib;shlwapi.lib;compstui.lib</AdditionalDependencies> + </Link> + <ResourceCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </ResourceCompile> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </Midl> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);comdlg32.lib;winspool.lib;comctl32.lib;shlwapi.lib;compstui.lib</AdditionalDependencies> + </Link> + <ResourceCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </ResourceCompile> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </Midl> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);comdlg32.lib;winspool.lib;comctl32.lib;shlwapi.lib;compstui.lib</AdditionalDependencies> + </Link> + <ResourceCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </ResourceCompile> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </Midl> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);comdlg32.lib;winspool.lib;comctl32.lib;shlwapi.lib;compstui.lib</AdditionalDependencies> + </Link> + <ResourceCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </ResourceCompile> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </ClCompile> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories> + </Midl> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </ClCompile> + <Midl> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </Midl> + <ResourceCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;STRICT;UNICODE;_UNICODE;cpsuisam</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="cpsuidat.c"> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="cpsuisam.c"> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="debug.c"> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Use</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ClCompile Include="precompsrc.c"> + <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile> + <PreCompiledHeader>Create</PreCompiledHeader> + <PreCompiledHeaderOutputFile>$(IntDir)\precomp.h.pch</PreCompiledHeaderOutputFile> + </ClCompile> + <ResourceCompile Include="res.rc" /> + </ItemGroup> + <ItemGroup> + <Inf Exclude="@(Inf)" Include="*.inf" /> + <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> + </ItemGroup> + <ItemGroup> + <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> + <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> + <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> + </ItemGroup> + <ItemGroup> + <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project>
\ No newline at end of file diff --git a/print/cpsuisam/cpsuisam.vcxproj.Filters b/print/cpsuisam/cpsuisam.vcxproj.Filters new file mode 100644 index 00000000..44bbac68 --- /dev/null +++ b/print/cpsuisam/cpsuisam.vcxproj.Filters @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> + <UniqueIdentifier>{50DC862B-95AC-4892-B963-876111462136}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + <UniqueIdentifier>{5A8D8E11-1C44-4DD6-8615-57E54DDD4C6C}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> + <UniqueIdentifier>{44FF2C70-58D4-464D-B774-C6C44F8E380B}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="cpsuidat.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="cpsuisam.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="debug.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="precompsrc.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="res.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/print/cpsuisam/icons/apple.ico b/print/cpsuisam/icons/apple.ico Binary files differnew file mode 100644 index 00000000..dd2f44f0 --- /dev/null +++ b/print/cpsuisam/icons/apple.ico diff --git a/print/cpsuisam/icons/cpsuisam.ico b/print/cpsuisam/icons/cpsuisam.ico Binary files differnew file mode 100644 index 00000000..33df6ef4 --- /dev/null +++ b/print/cpsuisam/icons/cpsuisam.ico diff --git a/print/cpsuisam/precompsrc.c b/print/cpsuisam/precompsrc.c new file mode 100644 index 00000000..5944cf51 --- /dev/null +++ b/print/cpsuisam/precompsrc.c @@ -0,0 +1 @@ +#include "precomp.h"
\ No newline at end of file diff --git a/print/cpsuisam/res.rc b/print/cpsuisam/res.rc new file mode 100644 index 00000000..f1e52605 --- /dev/null +++ b/print/cpsuisam/res.rc @@ -0,0 +1,51 @@ +// +// Copyright (c) 1990-2003 Microsoft Corporation +// All Rights Reserved +// + + +#include "windows.h" +#include "compstui.h" +#include "cpsuisam.h" + + + + +IDI_APPLE ICON PRELOAD icons\Apple.ico +IDI_CPSUISAMPLE ICON PRELOAD icons\cpsuisam.ico + + + +CPSUISampleMenu MENU +BEGIN + POPUP "&Test Options" + BEGIN + MENUITEM "&Default Printer Properties", IDM_DOCPROP + MENUITEM "CPSUI &TreeView Test", IDM_TVTEST + + MENUITEM SEPARATOR + + MENUITEM "&CPSUI Test All", IDM_DOCPROP_TVTEST + + MENUITEM SEPARATOR + + MENUITEM "&Permission", IDM_PERMISSION + MENUITEM "&Use Standard About" IDM_USESTDABOUT + + + END +END + + +#include "cpsuisam.dlg" + + +#include <ntverp.h> + +#define VER_FILETYPE VFT_APP +#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILEDESCRIPTION_STR "Common Property Sheet UI Sample Applet" +#define VER_INTERNALNAME_STR "cpsuisam.exe" +#define VER_ORIGINALFILENAME_STR "cpsuisam.exe" + +#include "common.ver" diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml new file mode 100644 index 00000000..f97fc473 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml @@ -0,0 +1,7 @@ +<Application x:Class="Microsoft.Samples.Printing.PrinterExtension.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + Startup="Application_Startup" + Exit="Application_Exit" + > +</Application> diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml.cs new file mode 100644 index 00000000..d37585c4 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml.cs @@ -0,0 +1,146 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// +// Abstract: +// +// This file contains the entry point to the application. + +using System; +using System.Windows; +using System.Runtime; + +using Microsoft.Samples.Printing.PrinterExtension.Types; +using Microsoft.Samples.Printing.PrinterExtension.Helpers; + +using System.Windows.Interop; + +namespace Microsoft.Samples.Printing.PrinterExtension +{ + /// <summary> + /// Interaction logic for App.xaml. + /// </summary> + public partial class App : Application + { + /// <summary> + /// This is the event handler invoked on various driver events. + /// </summary> + /// <param name="sender"></param> + /// <param name="eventArgs"></param> + private static void OnDriverEvent(object sender, PrinterExtensionEventArgs eventArgs) + { + // + // Display the print preferences window. + // + + if (eventArgs.ReasonId.Equals(PrinterExtensionReason.PrintPreferences)) + { + PrintPreferenceWindow printPreferenceWindow = new PrintPreferenceWindow(); + printPreferenceWindow.Initialize(eventArgs); + + // + // Set the caller application's window as parent/owner of the newly created printing preferences window. + // + + WindowInteropHelper wih = new WindowInteropHelper(printPreferenceWindow); + wih.Owner = eventArgs.WindowParent; + + // + // Display a modal/non-modal window based on the 'WindowModal' parameter. + // + + if (eventArgs.WindowModal) + { + printPreferenceWindow.ShowDialog(); + } + else + { + printPreferenceWindow.Show(); + + // Flash the window to draw the user's attention. This is required + // because the printer extension may be drawn behind the parent window. + // The return value of FlashWindow can be safely ignored if there is no need + // to know if the window has focus or not. + WindowHelper.FlashWindow(wih.Handle); + } + } + else if (eventArgs.ReasonId.Equals(PrinterExtensionReason.DriverEvent)) + { + // + // Handle driver events here. + // + } + } + + /// <summary> + /// Perform initialization tasks for the printer extension in this event handler. + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void Application_Startup(object sender, StartupEventArgs e) + { + // + // It is recommended that exactly one instance of the PrinterExtensionManager be created per instance of + // the printer extension. + // + + if (manager != null) + { + return; + } + manager = new PrinterExtensionManager(); + + // + // Enable events to be received on one printer driver id. + // + // Note: The order of adding the delegate to PrinterExtensionManager.OnDriverEvent + // and invoking PrinterExtensionManager::EnableEvents is important. + // Adding the delegate should be done first. + // + + manager.OnDriverEvent += OnDriverEvent; + + // + // It is recommended that an instance of a printer extension invoke PrinterExtensionManager::EnableEvents + // for exactly one printer driver id. The printer driver id could come in from a command line argument, + // thereby allowing one application binary to dynamically invoke PrinterExtensionManager::EnableEvents against + // the appropriate printer driver id. + // + + manager.EnableEvents(Guid.Parse(PrinterDriverID)); + } + + /// <summary> + /// Perform uninitialization tasks for the printer extension in this event handler. + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void Application_Exit(object sender, ExitEventArgs e) + { + manager.OnDriverEvent -= OnDriverEvent; + manager.DisableEvents(); + + manager = null; + } + + /// <summary> + /// This is the printer driver id, as defined in the printer driver manifest file. + /// Please replace this GUID with the printer driver id from your manifest file. + /// + /// It is recommended that you invoke PrinterExtensionManager::EnableEvents() on exactly + /// one printer driver id. The id could come in from a command line argument, thereby enabling + /// one application binary to work with multiple printer driver ids. + /// </summary> + private const string PrinterDriverID = "{E0691E8D-F7CC-456E-A7B5-D1FC19BA2279}"; + + /// <summary> + /// Instance of the PrinterExtensionManager. It is recommended that you have only instance + /// of the PrinterExtensionManager per application instance. + /// </summary> + private static PrinterExtensionManager manager = null; + } +} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/BidiHelper.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/BidiHelper.cs new file mode 100644 index 00000000..c975ee7c --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/BidiHelper.cs @@ -0,0 +1,154 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// +// Abstract: +// +// This file contains helper methods that provide a data-binding friendly way to access and parse bidi response data. + +using System; +using System.Collections.Generic; +using System.Windows.Media; +using System.Xml; + +namespace Microsoft.Samples.Printing.PrinterExtension.Helpers +{ + /// <summary> + /// Provide a data-binding friendly way to access and parse bidi response data. + /// </summary> + public class BidiHelper + { + /// <summary> + /// Parse the bidi response. + /// </summary> + /// <param name="bidiResponse">Bidi response XML data.</param> + public BidiHelper(string bidiResponse) + { + BidiResponseParser parser = new BidiResponseParser(bidiResponse); + InkLevelC = parser.GetInkLevel(Colors.Cyan); + InkLevelM = parser.GetInkLevel(Colors.Magenta); + InkLevelY = parser.GetInkLevel(Colors.Yellow); + InkLevelK = parser.GetInkLevel(Colors.Black); + } + + /// <summary> + /// Get the Cyan ink level. + /// </summary> + public double InkLevelC + { + get; + private set; + } + + /// <summary> + /// Get the Magenta ink level. + /// </summary> + public double InkLevelM + { + get; + private set; + } + + /// <summary> + /// Get the Yellow ink level. + /// </summary> + public double InkLevelY + { + get; + private set; + } + + /// <summary> + /// Get the Black ink level. + /// </summary> + public double InkLevelK + { + get; + private set; + } + } + + /// <summary> + /// This class parses bidi response xml data and provides wrapper methods that operate upon the xml. + /// </summary> + internal class BidiResponseParser + { + /// <summary> + /// Parse the bidi response. + /// </summary> + /// <param name="bidiResponse">Bidi response XML data.</param> + internal BidiResponseParser(string bidiResponse) + { + bidiData = new XmlDocument(); + bidiData.LoadXml(bidiResponse); + + namespaceManager = new XmlNamespaceManager(bidiData.NameTable); + namespaceManager.AddNamespace("bidi", "http://schemas.microsoft.com/windows/2005/03/printing/bidi"); + } + + /// <summary> + /// Get the ink level for a given color. + /// </summary> + /// <param name="color">Color</param> + /// <returns>Ink level percentage</returns> + internal double GetInkLevel(Color color) + { + XmlElement root = bidiData.DocumentElement; + XmlNode inkNode = root.SelectSingleNode(CreateInkXPathQuery(color), namespaceManager); + return double.Parse(inkNode.FirstChild.Value) / 100; + } + + /// <summary> + /// Create an XPath query that retrieves the ink level from a standard bidi response. + /// </summary> + /// <param name="color"></param> + /// <returns></returns> + private static string CreateInkXPathQuery(Color color) + { + string colorName = null; + + if (color.Equals(Colors.Black)) + { + colorName = "Black"; + } + else if (color.Equals(Colors.Red)) + { + colorName = "Red"; + } + else if (color.Equals(Colors.Green)) + { + colorName = "Green"; + } + else if (color.Equals(Colors.Blue)) + { + colorName = "Blue"; + } + else if (color.Equals(Colors.Cyan)) + { + colorName = "Cyan"; + } + else if (color.Equals(Colors.Magenta)) + { + colorName = "Magenta"; + } + else if (color.Equals(Colors.Yellow)) + { + colorName = "Yellow"; + } + else + { + throw new ArgumentException("Unsupported color"); + } + + return "/bidi:Get/Query/Schema[@name='\\Printer.Consumables." + colorName + "Ink" + ":Level']/BIDI_INT"; + } + + private XmlDocument bidiData; + private XmlNamespaceManager namespaceManager; + } + +} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Fabrikam_Logo.png b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Fabrikam_Logo.png Binary files differnew file mode 100644 index 00000000..196cd5f6 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Fabrikam_Logo.png diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml new file mode 100644 index 00000000..924efc21 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml @@ -0,0 +1,147 @@ +<Window x:Class="Microsoft.Samples.Printing.PrinterExtension.PrintPreferenceWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:c="clr-namespace:Microsoft.Samples.Printing.PrinterExtension" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + Title="{Binding Path=PrinterQueue.Name}" Height="405" Width="565" + ResizeMode="NoResize" + Icon="Fabrikam_Logo.png" + Closing="PrintPreferenceWindow_Closing" + > + + <Window.Resources> + <!-- Resources required to create the basic window --> + <Style x:Key="GraySingleBorder" TargetType="Border"> + <Setter Property="BorderBrush" Value="Gray" /> + </Style> + + <SolidColorBrush x:Key="InkStatusBorderBrush" Color="Black"/> + + <BitmapImage x:Key="FabrikamLogo" UriSource="Fabrikam_Logo.png" /> + + <Style x:Key="SimpleGroupBox" TargetType="GroupBox"> + <Setter Property="Margin" Value="5,5,5,5" /> + <Setter Property="Padding" Value="0,5,0,0" /> + </Style> + + <!-- + Each brush below is bound to BidiHelperSource, which provides a data-biding friendly way to + access ink levels. + --> + <LinearGradientBrush x:Key="InkBrushC" StartPoint="0, 1" EndPoint="0, 0"> + <GradientStop Color="Cyan" Offset="{Binding Path=BidiHelperSource.InkLevelC}" /> + <GradientStop Color="White" Offset="{Binding Path=BidiHelperSource.InkLevelC}" /> + </LinearGradientBrush> + <LinearGradientBrush x:Key="InkBrushM" StartPoint="0, 1" EndPoint="0, 0"> + <GradientStop Color="Magenta" Offset="{Binding Path=BidiHelperSource.InkLevelM}" /> + <GradientStop Color="White" Offset="{Binding Path=BidiHelperSource.InkLevelM}" /> + </LinearGradientBrush> + <LinearGradientBrush x:Key="InkBrushY" StartPoint="0, 1" EndPoint="0, 0"> + <GradientStop Color="Yellow" Offset="{Binding Path=BidiHelperSource.InkLevelY}" /> + <GradientStop Color="White" Offset="{Binding Path=BidiHelperSource.InkLevelY}" /> + </LinearGradientBrush> + <LinearGradientBrush x:Key="InkBrushK" StartPoint="0, 1" EndPoint="0, 0"> + <GradientStop Color="Black" Offset="{Binding Path=BidiHelperSource.InkLevelK}" /> + <GradientStop Color="White" Offset="{Binding Path=BidiHelperSource.InkLevelK}" /> + </LinearGradientBrush> + + <c:OptionConstrainedToDisplayColorConverter x:Key="OptionConstrainedToColor" /> + </Window.Resources> + + <Grid x:Name="MainGrid"> + <Grid.ColumnDefinitions> + <ColumnDefinition x:Name="LeftHalf" Width="3*"/> + <ColumnDefinition x:Name="RightHalf" Width="5*"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition x:Name="BrandingRow" Height="1*"/> + <RowDefinition x:Name="ContentRow" Height="2*"/> + <RowDefinition x:Name="StatusRow" /> + </Grid.RowDefinitions> + + <Border Style="{DynamicResource GraySingleBorder}" Grid.Row="0" Grid.ColumnSpan="2" BorderThickness="0,0,0,1"/> + <Border Style="{DynamicResource GraySingleBorder}" Grid.Row="1" Grid.Column="0" BorderThickness="0,0,0,1" /> + <Border Style="{DynamicResource GraySingleBorder}" Grid.Row="1" Grid.Column="1" BorderThickness="1,0,0,1" /> + <Border Style="{DynamicResource GraySingleBorder}" Grid.Row="2" Grid.Column="0" BorderThickness="0,0,0,0" /> + <Border Style="{DynamicResource GraySingleBorder}" Grid.Row="2" Grid.Column="1" BorderThickness="1,0,0,0" /> + + <Image Source="{StaticResource FabrikamLogo}" Grid.Row="0" Grid.Column="0" Stretch="None"/> + + <!-- + Display the name of the current print queue. + --> + <TextBlock FontFamily="Verdana" Grid.Row="0" Grid.Column="1" TextAlignment="Left" + VerticalAlignment="Center" FontSize="16" Foreground="DarkOrchid" Text="{Binding Path=PrinterQueue.Name}" /> + + <!-- + Lay out multiple GroupBoxes, with one ComboBox inside each. The number of GroupBoxes is determined by the number of features returned by + binding property: PrintSchemaHelperSource.Features. + + Each GroupBox Header displays the print schema feature's display name, bound to PrintSchemaFeatureHelper.DisplayName. + Each ComboBox's ItemSource property is bound to the list of valid options for that feature i.e. bound to PrintSchemaFeatureHelper.Options. + Additionally, the ComboBox is bound two-way to to PrintSchemaFeatureHelper.SelectedOption. Therefore, in addition to displaying the option + selected in the current print ticket, when the selected option is changed via UI selection, + a 'set' property is invoked on PrintSchemaFeatureHelper.SelectedOption. + + Each item in the ComboBox has the following structure: + It's displays the option name via a TextBlock, bound to the IPrintSchemaOption.DisplayName. + It's 'ForeGround' font color changes based on the IPrintSchemaOption.Constrained property. + + *Note*: Since this is an expensive operation to perfom, the data is retrieved asynchronously (IsAsync=true, below). + --> + <StackPanel Grid.Row="1" Grid.Column="1"> + <ItemsControl ItemsSource="{Binding Path=PrintSchemaHelperSource.Features, IsAsync=True}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <GroupBox Style="{DynamicResource SimpleGroupBox}" Header="{Binding Path=DisplayName}"> + <ComboBox ItemsSource="{Binding Path=Options}" SelectedItem="{Binding Path=SelectedOption}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" > + <TextBlock Text="{Binding Path=DisplayName}" Foreground="{Binding Converter={StaticResource OptionConstrainedToColor}, Path=Constrained}"/> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ComboBox> + </GroupBox> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + + <!-- + This modal dialog prevents the user from making changes to print preferences + when print ticket validation is in progress. This dialog is hidden when validation is not in progress. + --> + <c:ValidationModalDialog x:Name="ValidationModalDialog" Grid.Row="1" Grid.Column="1" Visibility="Hidden"/> + + <!-- + This GroupBox displays ink status. There are 4 rectangles that display ink status. The brush that paints color/level is bound to code. + --> + <GroupBox Header="{Binding Path=InkStatusTitle}" Grid.Column="0" Grid.Row="2" Margin="5,0,5,5"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="24*"/> + <RowDefinition Height="43*"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition /> + <ColumnDefinition /> + <ColumnDefinition /> + <ColumnDefinition /> + </Grid.ColumnDefinitions> + + <Rectangle Grid.Column="0" Fill="{DynamicResource InkBrushC}" Margin="2,0,2,0" Name="InkIndicatorC" Stroke="{DynamicResource InkStatusBorderBrush}" Grid.RowSpan="2"/> + <Rectangle Grid.Column="1" Fill="{DynamicResource InkBrushM}" Margin="2,0,2,0" Name="InkIndicatorM" Stroke="{DynamicResource InkStatusBorderBrush}" Grid.RowSpan="2"/> + <Rectangle Grid.Column="2" Fill="{DynamicResource InkBrushY}" Margin="2,0,2,0" Name="InkIndicatorY" Stroke="{DynamicResource InkStatusBorderBrush}" Grid.RowSpan="2"/> + <Rectangle Grid.Column="3" Fill="{DynamicResource InkBrushK}" Margin="0,0,2,0" Name="InkIndicatorK" Stroke="{DynamicResource InkStatusBorderBrush}" HorizontalAlignment="Right" Width="43" Grid.RowSpan="2"/> + </Grid> + </GroupBox> + + <UniformGrid Grid.Row="2" Grid.Column="2" Rows="1" Columns="3" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,10,10"> + <Button Content="_Ok" Name="OkButton" Margin="0,0,5,0" Click="Button_Click" /> + <Button Content="_Cancel" Name="CancelButton" Margin="5,0,5,0" Padding="10,0,10,0" Click="Button_Click" /> + <Button Content="_Verify settings" Name="VerifyButton" Margin="5,0,0,0" Click="Button_Click" /> + </UniformGrid> + </Grid> +</Window> diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml.cs new file mode 100644 index 00000000..a6266662 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml.cs @@ -0,0 +1,467 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// +// Abstract: +// +// This file contains as the interaction logic and data-binding code/sources for the WPF print preferences window. + +using System; +using System.ComponentModel; +using System.Collections.Generic; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Media; + +using System.Reflection; +using System.IO; + +using System.Xml.Linq; + +using System.Runtime.InteropServices; + +using Microsoft.Samples.Printing.PrinterExtension.Types; +using Microsoft.Samples.Printing.PrinterExtension.Helpers; + +namespace Microsoft.Samples.Printing.PrinterExtension +{ + /// <summary> + /// Interaction logic for PrintPreferenceWindow.xaml. + /// </summary> + public partial class PrintPreferenceWindow : Window, INotifyPropertyChanged + { + public PrintPreferenceWindow() + { + InitializeComponent(); + } + + /// <summary> + /// This method sets up data binding sources and performs other initialization tasks. + /// </summary> + /// <param name="eventArgs"></param> + public void Initialize(PrinterExtensionEventArgs eventArgs) + { + // + // Populate the data binding sources. + // + + DataContext = this; + + printerExtensionEventArgs = eventArgs; + PrinterQueue = eventArgs.Queue; + displayedPrintTicket = eventArgs.Ticket; + + // + // Send a bidi query requesting ink levels. + // + // Please note: As this event will fire many times, it is recommended to maintain event + // listeners for the life time of the application. Furthermore, the relationship to this + // being invoked and the calling SendBidiQuery() is not 1:1; in fact, it is *:N, where the + // listener may be called several times with bidi updates. + // + // + + PrinterQueue.OnBidiResponseReceived += OnBidiResponseReceived; + PrinterQueue.SendBidiQuery("\\Printer.consumables"); + } + + #region UI code + + /// <summary> + /// This event handler is invoked when the window is closing. It is important to Cancel or Complete the request when the window is closing. + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + void PrintPreferenceWindow_Closing(object sender, EventArgs e) + { + // Since we are a different process from the printing application we need to hand focus back when complete. + WindowHelper.SetForegroundWindow(printerExtensionEventArgs.WindowParent); + + if (!requestCompleted) + { + printerExtensionEventArgs.Request.Cancel((int)HRESULT.S_FALSE, "The user canceled the operation."); + requestCompleted = true; + } + } + + /// <summary> + /// Button click event handler. + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void Button_Click(object sender, RoutedEventArgs e) + { + Button clickedButton = (Button)sender; + + switch (clickedButton.Name) + { + case "CancelButton": + CancelRequestAndCloseWindow(); + break; + + case "OkButton": + // + // Validate the print ticket asynchronously. The event handler is invoked when the validation is completed. + // + + IPrintSchemaAsyncOperation asyncOperation = displayedPrintTicket.ValidateAsync(); + + // + // Pop up a modal dialog that prevents the user from changing selections when validation is in progress. + // Since this dialog lives as long as the parent window, it is not mandatory to unregister the delegate for the + // 'Completed' event. + // + + ValidationModalDialog.Completed += PrintTicketValidateCompleted; // This operation is idempotent. + ValidationModalDialog.StartAsyncOperation(asyncOperation); + break; + + case "VerifyButton": + // + // Force WPF Data binding to refresh the UI. This operation retrieves + // a fresh print capabilities for the print ticket based on the user selections. + // + + PropertyChanged(this, new PropertyChangedEventArgs("PrintSchemaHelperSource")); + break; + } + } + + /// <summary> + /// Close the window in a thread-safe way. + /// </summary> + private void CloseWindow() + { + this.Dispatcher.BeginInvoke(new Action(() => + { + this.Close(); + })); + } + + #endregion + + + #region Data binding sources + + /// <summary> + /// The Print queue for which this window is being displayed. + /// </summary> + public IPrinterQueue PrinterQueue { get; private set; } + + /// <summary> + /// The title for the ink status display. + /// </summary> + public string InkStatusTitle { get; private set; } + + /// <summary> + /// Retrieve a new instance of PrintSchemaHelper, based on the current print ticket being displayed. + /// PrintSchemaHelper encapsulates all the features and options required to populate the print preferences UI. + /// </summary> + public PrintSchemaHelper PrintSchemaHelperSource + { + get + { + // + // Below is the list of features that will be displayed in the print preferences window. + // The features are declared here for convenience/readability. + // + // In performant code, this array would be allocated only once per run of the application. + // + + string[] featureNames = { + "DocumentNUp", + "PageMediaSize", + "DocumentInputBin", + "PageOrientation", + "PageMediaType", + "PageBorderless", + "JobInputBin", + "PageOutputColor", + "DocumentCollate", + "DocumentDuplex" + }; + + return new PrintSchemaHelper(displayedPrintTicket, featureNames); + } + } + + /// <summary> + /// Encapsulates the information required to populate ink level. + /// </summary> + public BidiHelper BidiHelperSource { get; private set; } + + /// <summary> + /// This event is raised when a data from a binding source is modified. + /// </summary> + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + + #region Ink level display + /// <summary> + /// This is the method invoked when a bidi response is received. + /// </summary> + /// <param name="sender">IPrinterQueue object.</param> + /// <param name="e">The results of the bidi response.</param> + private void OnBidiResponseReceived(object sender, PrinterQueueEventArgs e) + { + if (e.StatusHResult != (int)HRESULT.S_OK) + { + MockInkStatus(); + return; + } + + // + // Display the ink levels from the mock data. + // + + BidiHelperSource = new BidiHelper(e.Response); + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs("BidiHelperSource")); + } + InkStatusTitle = "Ink status (Live data)"; + } + + /// <summary> + /// This method is invoked when there is an error retrieving Bidi information. + /// A mock bidi response is loaded from resource and displayed. + /// </summary> + private void MockInkStatus() + { + // + // Load mock bidi response resource. + // + + Assembly a = Assembly.GetExecutingAssembly(); + Stream xmlData = a.GetManifestResourceStream("PrinterExtensionSample.bidi_Ink_mock.xml"); + StreamReader sr = new StreamReader(xmlData); + string xmlString = sr.ReadToEnd(); + + // + // Display the ink levels from the mock data. + // + + BidiHelperSource = new BidiHelper(xmlString); + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs("BidiHelperSource")); + } + InkStatusTitle = "Ink status (Mocked data)"; + } + #endregion + + #region PrintSchema-related code + /// <summary> + /// Cancel the current printer extension event and close the current window. + /// </summary> + private void CancelRequestAndCloseWindow() + { + printerExtensionEventArgs.Request.Cancel((int)HRESULT.S_FALSE, "User canceled the operation"); + requestCompleted = true; + CloseWindow(); + } + + /// <summary> + /// Invoked when asynchronous print ticket validation is complete. + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void PrintTicketValidateCompleted(object sender, PrintSchemaAsyncOperationEventArgs e) + { + // + // Print ticket validation completed successfully i.e. print ticket selections are not constrained. + // The print ticket needs to be committed, and then window can be closed. + // + + if (e.StatusHResult == (int)HRESULT.S_PT_NO_CONFLICT) + { + this.Dispatcher.Invoke(new Action(() => + { + CommitPrintTicketAsync(e.Ticket); + })); + + } + else + { + // + // The ticket selections are constrained. + // + + this.Dispatcher.Invoke(new Action(() => + { + HandleTicketConstraints(e.Ticket); + })); + } + } + + /// <summary> + /// Invoked when there are constraints in the print ticket selections. + /// </summary> + /// <param name="validatedTicket"></param> + private void HandleTicketConstraints(IPrintSchemaTicket validatedTicket) + { + // + // Retrieved localized display strings from a resource file/ + // + string selectionConflictsFound = PrinterExtensionSample.Strings.SelectionConflictsFound; + string selectionConflictsTitle = PrinterExtensionSample.Strings.SelectionConflictsTitle; + + MessageBoxResult result = MessageBox.Show( + this, + selectionConflictsFound, + selectionConflictsTitle, + MessageBoxButton.YesNoCancel); + + if (result == MessageBoxResult.Yes) + { + CommitPrintTicketAsync(validatedTicket); + } + else + { + PropertyChanged(this, new PropertyChangedEventArgs("PrintSchemaHelperSource")); + } + } + + /// <summary> + /// Commits the input print ticket asynchronously. The completed event handler is expected to close the window. + /// </summary> + /// <param name="validatedTicket"></param> + private void CommitPrintTicketAsync(IPrintSchemaTicket validatedTicket) + { + IPrintSchemaAsyncOperation commitAsyncOperation = printerExtensionEventArgs.Ticket.CommitAsync(validatedTicket); + commitAsyncOperation.Completed += PrintTicketCommitCompleted; + commitAsyncOperation.Start(); + } + + /// <summary> + /// Invoked when the user's selections have been committed into the print ticket. + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void PrintTicketCommitCompleted(object sender, PrintSchemaAsyncOperationEventArgs e) + { + CompleteRequestAndCloseWindow(); + } + + /// <summary> + /// Complete the current printer extension request and close the current window. + /// </summary> + private void CompleteRequestAndCloseWindow() + { + // + // It is important to invoke the IPrinterExtensionRequest::Complete method from the thread the + // class instance was create on (i.e. the UI thread). + // + + this.Dispatcher.Invoke(new Action(() => + { + printerExtensionEventArgs.Request.Complete(); + })); + + requestCompleted = true; + CloseWindow(); + } + + /// <summary> + /// Demonstrates how to modify print ticket XML. This piece of code does not perform any functionality. + /// It serves to demonstrate the usage of IPrintSchemaTicket::GetReadStream()/GetWriteStream() + /// </summary> + private void ModifyPrintTicketXml() + { + // + // Load the ticket XML (as a Stream) into an XElement object. + // + + XElement ticketRootXElement = null; + using (Stream ticketReadStream = displayedPrintTicket.GetReadStream()) + { + ticketRootXElement = XElement.Load(ticketReadStream); + } + + // + // Perform any modifications on the XElement object. + // + + + // + // Write the changes back to the print ticket. + // + using (Stream ticketWriteStream = displayedPrintTicket.GetWriteStream()) + { + ticketRootXElement.Save(ticketWriteStream); + } + } + + #endregion + + /// <summary> + /// The arguments passed in for this print preferences event. + /// </summary> + private PrinterExtensionEventArgs printerExtensionEventArgs = null; + + /// <summary> + /// Reflects the currently displayed print preference options. + /// </summary> + private IPrintSchemaTicket displayedPrintTicket = null; + + /// <summary> + /// Determines if IPrinterExtensionRequest::Complete()/Cancel() has been invoked for this Window. + /// instance + /// </summary> + private bool requestCompleted = false; + } + + /// <summary> + /// This class transforms the boolean 'IPrintSchemaOption.Constrained' into a visual form. + /// </summary> + public class OptionConstrainedToDisplayColorConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (value == null) + { + return "Black"; + } + + // + // If the option is not constrained, it will be diplayed in black. + // + + PrintSchemaConstrainedSetting constrained = (PrintSchemaConstrainedSetting)value; + if (constrained == PrintSchemaConstrainedSetting.None) + { + return "Black"; + } + + // + // If the option is constrained, it will be displayed in red. + // + + return "Red"; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + /// <summary> + /// Provides a friendlier way to use HRESULT error codes. + /// </summary> + enum HRESULT : int + { + S_OK = 0x0000, + S_FALSE = 0x0001, + S_PT_NO_CONFLICT = 0x40001, + E_INVALIDARG = unchecked((int)0x80070057), + E_OUTOFMEMORY = unchecked((int)0x8007000E), + ERROR_NOT_FOUND = unchecked((int)0x80070490) + } +} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintSchemaHelper.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintSchemaHelper.cs new file mode 100644 index 00000000..e9201162 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintSchemaHelper.cs @@ -0,0 +1,190 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// +// Abstract: +// +// This file contains helper methods that provide a data-binding friendly way to access PrintSchema APIs. + +using System; +using System.Collections.Generic; +using System.Text; + +using System.Runtime.InteropServices; + +using Microsoft.Samples.Printing.PrinterExtension.Types; + +namespace Microsoft.Samples.Printing.PrinterExtension.Helpers +{ + /// <summary> + /// Contains helper methods that provide a data-binding friendly way to access PrintSchema APIs. + /// </summary> + public class PrintSchemaHelper + { + /// <summary> + /// Constructor. Warning constructing this object is expensive, and is best performed + /// asynchronously. + /// </summary> + /// <param name="ticket">The print ticket for which features/options will be retrieved</param> + /// <param name="featureNameCollection">List of features requested</param> + internal PrintSchemaHelper(IPrintSchemaTicket ticket, IEnumerable<String> featureNameCollection) + { + _ticket = ticket; + _featureNameCollection = featureNameCollection; + _capabilities = _ticket.GetCapabilities(); + } + + /// <summary> + /// Retrieve the list of features from the current print ticket. + /// </summary> + public List<PrintSchemaFeatureHelper> Features + { + get + { + _featureHelperCollection = new List<PrintSchemaFeatureHelper>(); + + // + // Retrieve the list of features supported by the driver + // + + foreach (string name in _featureNameCollection) + { + // + // If the feature is not present in the print ticket or the print capabilities, + // ignore it and continue. + // + + IPrintSchemaFeature ticketFeature = _ticket.GetFeatureByKeyName(name); + if (ticketFeature == null) + { + continue; + } + + IPrintSchemaFeature capabilitiesFeature = _capabilities.GetFeatureByKeyName(name); + if (capabilitiesFeature == null) + { + continue; + } + + // If the feature is not meant to be displayed on the UI, ignore it and continue. + if (!capabilitiesFeature.DisplayUI) + { + continue; + } + + _featureHelperCollection.Add(new PrintSchemaFeatureHelper(ticketFeature, _capabilities, capabilitiesFeature)); + } + + return _featureHelperCollection; + } + } + + /// <summary> + /// List of features requested. + /// </summary> + private IEnumerable<string> _featureNameCollection; + + /// <summary> + /// Helper objects that wrap an IPrintSchemaFeature object. + /// </summary> + private List<PrintSchemaFeatureHelper> _featureHelperCollection = null; + + /// <summary> + /// Print ticket passed into this class. + /// </summary> + private IPrintSchemaTicket _ticket = null; + + /// <summary> + /// Print capabilities object. + /// </summary> + private IPrintSchemaCapabilities _capabilities = null; + } + + /// <summary> + /// Contains helper methods that provide a data-binding friendly way to access IPrintSchemaFeature APIs. + /// + /// Note: This sample does not handle Print Ticket/Print Capabilities Options which rely on parameters to + /// be specified, such as psk:Custom , psk:CustomSquare, or psk:CustomMediaSize. If these options are + /// supported by compatible print drivers, then the printer extension should be modified to support them + /// appropriately. + /// </summary> + public class PrintSchemaFeatureHelper + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="ticketFeature">Object retrieved via a call to IPrintSchemaTicket::GetFeature/GetFeatureByKeyName</param> + /// <param name="capabilities">Print capabilities object</param> + /// <param name="capabilitiesFeature">Object retrieved via a call to IPrintSchemaCapabilities::GetFeature/GetFeatureByKeyName</param> + internal PrintSchemaFeatureHelper(IPrintSchemaFeature ticketFeature, IPrintSchemaCapabilities capabilities, IPrintSchemaFeature capabilitiesFeature) + { + // + // Populate the properties exposed by this class. + // + + DisplayName = capabilitiesFeature.DisplayName; + Options = new List<IPrintSchemaOption>(capabilities.GetOptions(ticketFeature)); + + foreach (IPrintSchemaOption option in Options) + { + if (option.Selected) + { + _selectedOption = option; + break; + } + } + + _printTicketFeature = ticketFeature; + } + + /// <summary> + /// Returns the display name for the current IPrintSchemaFeature object. + /// </summary> + public string DisplayName + { + get; + private set; + } + + /// <summary> + /// Retrieve the list of options supported for the current feature. + /// </summary> + public List<IPrintSchemaOption> Options + { + get; + private set; + } + + /// <summary> + /// A 'get' invocation on this property returns the selected option for this print ticket feature. + /// A 'set' invocation on this property sets the selected option for this print ticket feature. + /// </summary> + public IPrintSchemaOption SelectedOption + { + get + { + return _selectedOption; + } + set + { + _selectedOption = value; + _printTicketFeature.SelectedOption = _selectedOption; + } + } + + /// <summary> + /// Feature object retrieved from the print ticket. + /// </summary> + private IPrintSchemaFeature _printTicketFeature = null; + + /// <summary> + /// Selected option for the print ticket feature. + /// </summary> + private IPrintSchemaOption _selectedOption = null; + + } +} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrinterExtensionSample.csproj b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrinterExtensionSample.csproj new file mode 100644 index 00000000..bbb7f044 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrinterExtensionSample.csproj @@ -0,0 +1,219 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">x86</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{CF554A99-6889-4B86-934F-B6AADBFEFC01}</ProjectGuid> + <OutputType>WinExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>PrinterExtensionSample</RootNamespace> + <AssemblyName>PrinterExtensionSample</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <TargetFrameworkProfile> + </TargetFrameworkProfile> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <UseApplicationTrust>false</UseApplicationTrust> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8 Debug|x86' "> + <OutputPath>bin\Win8 Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <PlatformTarget>x86</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8 Release|x86' "> + <OutputPath>bin\Win8 Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <PlatformTarget>x86</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win8 Debug|x64'"> + <OutputPath>bin\x64\Win8 Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <PlatformTarget>x64</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win8 Release|x64'"> + <OutputPath>bin\x64\Win8 Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <PlatformTarget>x64</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8.1 Debug|x86' "> + <OutputPath>bin\Win8.1 Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <PlatformTarget>x86</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8.1 Release|x86' "> + <OutputPath>bin\Win8.1 Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <PlatformTarget>x86</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win8.1 Debug|x64'"> + <OutputPath>bin\x64\Win8.1 Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <PlatformTarget>x64</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win8.1 Release|x64'"> + <OutputPath>bin\x64\Win8.1 Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <PlatformTarget>x64</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Compile Include="BidiHelper.cs" /> + <Compile Include="PrintSchemaHelper.cs" /> + <Compile Include="Strings.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Strings.resx</DependentUpon> + </Compile> + <Compile Include="ValidationModalDialog.xaml.cs"> + <DependentUpon>ValidationModalDialog.xaml</DependentUpon> + </Compile> + <ApplicationDefinition Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Compile Include="WindowHelper.cs" /> + <Page Include="PrintPreferenceWindow.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + <Compile Include="PrintPreferenceWindow.xaml.cs"> + <DependentUpon>PrintPreferenceWindow.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + <Page Include="ValidationModalDialog.xaml"> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <EmbeddedResource Include="Strings.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Strings.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="app.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + <AppDesigner Include="Properties\" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Fabrikam_Logo.png" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\PrinterExtensionLibrary\PrinterExtensionLibrary.csproj"> + <Project>{d8da0c4d-f972-4546-9068-8eb256f222f7}</Project> + <Name>PrinterExtensionLibrary</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="bidi_Ink_mock.xml" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/AssemblyInfo.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..c3198284 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/AssemblyInfo.cs @@ -0,0 +1,62 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("PrinterExtensionSample")] +[assembly: AssemblyDescription("Printer Extension Sample for v4 print drivers")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("PrinterExtensionSample")] +[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file +//inside a <PropertyGroup>. For example, if you are using US english +//in your source files, set the <UICulture> to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.Designer.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.Designer.cs new file mode 100644 index 00000000..b6af3bc4 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.17325 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace PrinterExtensionSample.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrinterExtensionSample.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.resx b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.resx new file mode 100644 index 00000000..af7dbebb --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.Designer.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.Designer.cs new file mode 100644 index 00000000..c0a373ef --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.17325 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace PrinterExtensionSample.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.settings b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.settings new file mode 100644 index 00000000..033d7a5e --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.Designer.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.Designer.cs new file mode 100644 index 00000000..6ea88a35 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.Designer.cs @@ -0,0 +1,82 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.17361 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace PrinterExtensionSample { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Strings { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Strings() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrinterExtensionSample.Strings", typeof(Strings).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// <summary> + /// Looks up a localized string similar to Selection conflicts were encountered. + ///Would you like them auto-resolved?. + /// </summary> + internal static string SelectionConflictsFound { + get { + return ResourceManager.GetString("SelectionConflictsFound", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Selection conflicts. + /// </summary> + internal static string SelectionConflictsTitle { + get { + return ResourceManager.GetString("SelectionConflictsTitle", resourceCulture); + } + } + } +} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.resx b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.resx new file mode 100644 index 00000000..8f4878a4 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.resx @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="SelectionConflictsFound" xml:space="preserve"> + <value>Selection conflicts were encountered. +Would you like them auto-resolved?</value> + <comment>String to display in the message box when print ticket settings have conflicts.</comment> + </data> + <data name="SelectionConflictsTitle" xml:space="preserve"> + <value>Selection conflicts</value> + <comment>Title string on the message box that displays the selection conflicts message.</comment> + </data> +</root>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml new file mode 100644 index 00000000..c949efd4 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml @@ -0,0 +1,19 @@ +<UserControl x:Class="Microsoft.Samples.Printing.PrinterExtension.ValidationModalDialog" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> + <Grid DataContext="{Binding ElementName=root}"> + <Border Background="#60000000"> + <Border BorderBrush="Black" BorderThickness="1" Background="AliceBlue" + CornerRadius="10,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Center"> + <Border.BitmapEffect> + <DropShadowBitmapEffect Color="Black" Opacity="0.5" Direction="90" ShadowDepth="0.7" /> + </Border.BitmapEffect> + <UniformGrid Grid.Row="1" Margin="10" Rows="2" Columns="1" HorizontalAlignment="Center" VerticalAlignment="Bottom"> + <TextBlock>Validating.. please wait</TextBlock> + <Button x:Name="CancelValidationButton" Content="Cancel" Click="CancelValidationButton_Click"/> + </UniformGrid> + </Border> + </Border> + </Grid> +</UserControl> diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml.cs new file mode 100644 index 00000000..0728c84c --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml.cs @@ -0,0 +1,108 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// +// Abstract: +// +// This file contains as the interaction logic for ValidationModaldialog. +// This dialog prevents the user from making changes to print ticket settings when asynchronous +// validation is being performed. + +using System; +using System.Collections.Generic; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; + +using Microsoft.Samples.Printing.PrinterExtension.Types; + +namespace Microsoft.Samples.Printing.PrinterExtension +{ + /// <summary> + /// Interaction logic for ValidationModalDialog.xaml + /// This dialog prevents the user from changing print preferences when validation is in progress. + /// </summary> + public partial class ValidationModalDialog : UserControl + { + public ValidationModalDialog() + { + InitializeComponent(); + Visibility = Visibility.Hidden; + } + + /// <summary> + /// Starts the asynchronous operation. + /// </summary> + /// <param name="asyncOperationToStart">Async operation context.</param> + public void StartAsyncOperation(IPrintSchemaAsyncOperation asyncOperationToStart) + { + this.asyncOperationContext = asyncOperationToStart; + Visibility = Visibility.Visible; + asyncOperationToStart.Completed += asyncOperation_Completed; + asyncOperationToStart.Start(); + } + + + /// <summary> + /// This method is invoked from a different thread once asynchronous validation is completed. + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void asyncOperation_Completed(object sender, PrintSchemaAsyncOperationEventArgs e) + { + ValidationHResult = e.StatusHResult; + HideWindow(); + + if (Completed != null) + { + Completed(this, e); + } + } + + /// <summary> + /// Hides the current window. + /// </summary> + private void HideWindow() + { + this.Dispatcher.Invoke(new Action(() => + { + Visibility = Visibility.Hidden; + })); + } + + + /// <summary> + /// Result of the validation operation. + /// </summary> + public int ValidationHResult + { + get; + private set; + } + + /// <summary> + /// Invoked then the "Cancel" button is clicked. + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void CancelValidationButton_Click(object sender, RoutedEventArgs e) + { + asyncOperationContext.Cancel(); + HideWindow(); + } + + /// <summary> + /// Invoked when the asynchronous operation is completed. + /// </summary> + public event EventHandler<PrintSchemaAsyncOperationEventArgs> Completed; + + /// <summary> + /// Asynchronous operation context. + /// </summary> + private IPrintSchemaAsyncOperation asyncOperationContext; + } +} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/WindowHelper.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/WindowHelper.cs new file mode 100644 index 00000000..fe830921 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/WindowHelper.cs @@ -0,0 +1,83 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// +// Abstract: +// +// This file contains helper methods that provide a friendly way to access win32 window functions. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.Samples.Printing.PrinterExtension.Helpers +{ + class WindowHelper + { + /// <summary> + /// P/Invoke signature for Win32 function "SetForegroundWindow". + /// </summary> + /// <param name="hwnd">Handle to window</param> + [return: MarshalAs(UnmanagedType.Bool)] + [DllImport("User32", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] + public static extern bool SetForegroundWindow(IntPtr hwnd); + + /// <summary> + /// Wrapper for Win32 function "FlashWindowEx" + /// </summary> + /// <param name="hWnd">Handle of the window to flash</param> + public static bool FlashWindow(IntPtr hWnd) + { + FLASHWINFO fInfo = new FLASHWINFO(); + + fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); + fInfo.hwnd = hWnd; // Handle to window + fInfo.uCount = UInt32.MaxValue; // Number of times to flash + fInfo.dwTimeout = 0; // Use default cursor blink rate + // Flash both window caption and taskbar button, until the window is brought to the foreground. + fInfo.dwFlags = (uint)(FLASHW.ALL | FLASHW.TIMERNOFG); + + return FlashWindowEx(ref fInfo); + } + + #region private members + + /// <summary> + /// P/Invoke signature for Win32 function "FlashWindowEx". + /// </summary> + [return: MarshalAs(UnmanagedType.Bool)] + [DllImport("User32", CharSet = CharSet.Auto, SetLastError = false, ExactSpelling = true)] + private static extern bool FlashWindowEx(ref FLASHWINFO pwfi); + + [StructLayout(LayoutKind.Sequential)] + private struct FLASHWINFO + { + public UInt32 cbSize; + public IntPtr hwnd; + public UInt32 dwFlags; + public UInt32 uCount; + public UInt32 dwTimeout; + } + + /// <summary> + /// Represents the FLASH_Xxx flags + /// </summary> + [Flags] + private enum FLASHW : uint + { + /// <summary> + /// Flash both the window caption and taskbar button + /// </summary> + ALL = 3, + /// <summary> + /// Flash continuously until the window comes to the foreground. + /// </summary> + TIMERNOFG = 12 + } + + #endregion + } +} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/app.config b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/app.config new file mode 100644 index 00000000..bfc57c55 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/app.config @@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<configuration> + <appSettings> + <add key="UseSetWindowPosForTopmostWindows" value="True" /> + </appSettings> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> + </startup> +</configuration> diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/bidi_Ink_mock.xml b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/bidi_Ink_mock.xml new file mode 100644 index 00000000..b1a685f1 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/bidi_Ink_mock.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<bidi:Get xmlns:bidi="http://schemas.microsoft.com/windows/2005/03/printing/bidi"> + <Query schema="\Printer.Consumables"> + <Schema name="\Printer.Consumables.BlackInk:Color"> + <BIDI_STRING>Black</BIDI_STRING> + </Schema> + <Schema name="\Printer.Consumables.BlackInk:Installed"> + <BIDI_BOOL>true</BIDI_BOOL> + </Schema> + <Schema name="\Printer.Consumables.BlackInk:Level"> + <BIDI_INT>86</BIDI_INT> + </Schema> + <Schema name="\Printer.Consumables.BlackInk:Type"> + <BIDI_STRING>InkSupply</BIDI_STRING> + </Schema> + <Schema name="\Printer.Consumables.CyanInk:Color"> + <BIDI_STRING>Cyan</BIDI_STRING> + </Schema> + <Schema name="\Printer.Consumables.CyanInk:Installed"> + <BIDI_BOOL>true</BIDI_BOOL> + </Schema> + <Schema name="\Printer.Consumables.CyanInk:Level"> + <BIDI_INT>79</BIDI_INT> + </Schema> + <Schema name="\Printer.Consumables.CyanInk:Type"> + <BIDI_STRING>InkSupply</BIDI_STRING> + </Schema> + <Schema name="\Printer.Consumables.LightBlackInk:Color"> + <BIDI_STRING>LightBlack</BIDI_STRING> + </Schema> + <Schema name="\Printer.Consumables.LightBlackInk:Installed"> + <BIDI_BOOL>true</BIDI_BOOL> + </Schema> + <Schema name="\Printer.Consumables.LightBlackInk:Level"> + <BIDI_INT>0</BIDI_INT> + </Schema> + <Schema name="\Printer.Consumables.LightBlackInk:Type"> + <BIDI_STRING>InkSupply</BIDI_STRING> + </Schema> + <Schema name="\Printer.Consumables.MagentaInk:Color"> + <BIDI_STRING>Magenta</BIDI_STRING> + </Schema> + <Schema name="\Printer.Consumables.MagentaInk:Installed"> + <BIDI_BOOL>true</BIDI_BOOL> + </Schema> + <Schema name="\Printer.Consumables.MagentaInk:Level"> + <BIDI_INT>79</BIDI_INT> + </Schema> + <Schema name="\Printer.Consumables.MagentaInk:Type"> + <BIDI_STRING>InkSupply</BIDI_STRING> + </Schema> + <Schema name="\Printer.Consumables.PrintHead:Installed"> + <BIDI_BOOL>true</BIDI_BOOL> + </Schema> + <Schema name="\Printer.Consumables.PrintHead:Level"> + <BIDI_INT>-1</BIDI_INT> + </Schema> + <Schema name="\Printer.Consumables.PrintHead:Type"> + <BIDI_STRING>PrintHead</BIDI_STRING> + </Schema> + <Schema name="\Printer.Consumables.YellowInk:Color"> + <BIDI_STRING>Yellow</BIDI_STRING> + </Schema> + <Schema name="\Printer.Consumables.YellowInk:Installed"> + <BIDI_BOOL>true</BIDI_BOOL> + </Schema> + <Schema name="\Printer.Consumables.YellowInk:Level"> + <BIDI_INT>87</BIDI_INT> + </Schema> + <Schema name="\Printer.Consumables.YellowInk:Type"> + <BIDI_STRING>InkSupply</BIDI_STRING> + </Schema> + </Query> +</bidi:Get> diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionAdapters.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionAdapters.cs new file mode 100644 index 00000000..60277c61 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionAdapters.cs @@ -0,0 +1,2051 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// +// Abstract: +// +// This file contains Adapters that wrap the PrinterExtension COM Interop types. +// +using System; +using System.IO; +using System.Collections; +using System.Collections.Generic; +using System.Runtime; +using System.Runtime.InteropServices; +using Microsoft.Samples.Printing.PrinterExtension.Types; + +namespace Microsoft.Samples.Printing.PrinterExtension +{ + // The following three classes are constructable adapters for the root of the + // object model. The balance of the types will typically be interfaces. This + // choice was made so we can share the interface file between projects and enforce + // the same public surface from both the "Reference" and "Implementation" projects. + + #region PrinterExtension adapter classes + + /// <summary> + /// Wraps an COM pointer to IPrinterExtensionContext + /// </summary> + public class PrinterExtensionContext : IPrinterExtensionContext + { + /// <summary> + /// Wraps an opaque COM pointer to IPrinterExtensionContext and provides usable methods + /// </summary> + /// <param name="comContext">Opaque COM pointer to IPrinterExtensionContext</param> + public PrinterExtensionContext(Object comContext) + { + _context = (PrinterExtensionLib.IPrinterExtensionContext)comContext; + } + + #region IPrinterExtensionContext methods + + /// <summary> + /// Maps to COM IPrinterExtensionContext::PrinterQueue + /// </summary> + public IPrinterQueue Queue + { + get { return new PrinterQueue(_context.PrinterQueue); } + } + + /// <summary> + /// Maps to COM IPrinterExtensionContext::PrintSchemaTicket + /// </summary> + public IPrintSchemaTicket Ticket + { + get { return new PrintSchemaTicket(_context.PrintSchemaTicket); } + } + + /// <summary> + /// Maps to COM IPrinterExtensionContext::DriverProperties + /// </summary> + public IPrinterPropertyBag DriverProperties + { + get + { + try + { + return new PrinterPropertyBag(_context.DriverProperties, PrintPropertyBagType.DriverProperties); + } + catch (Exception) + { + // If the property bag is not found, instead of + // throwing an exception, return null, which is more appropriate for a property 'get' operation. + return null; + } + } + } + + /// <summary> + /// Maps to COM IPrinterExtensionContext::UserProperties + /// </summary> + public IPrinterPropertyBag UserProperties + { + get { return new PrinterPropertyBag(_context.UserProperties, PrintPropertyBagType.UserProperties); } + } + + #endregion + + #region Implementation details + + private PrinterExtensionLib.IPrinterExtensionContext _context; + + // Prevent default construction + private PrinterExtensionContext() + { + } + + #endregion + } + + /// <summary> + /// Wraps an COM pointer to IPrinterExtensionEventArgs + /// </summary> + public class PrinterExtensionEventArgs : EventArgs, IPrinterExtensionEventArgs + { + /// <summary> + /// Wraps an opaque COM pointer to IPrinterExtensionEventArgs and provides usable methods + /// </summary> + /// <param name="comContext">Opaque COM pointer to IPrinterExtensionEventArgs</param> + public PrinterExtensionEventArgs(Object eventArgs) + { + _eventArgs = (PrinterExtensionLib.IPrinterExtensionEventArgs)eventArgs; + _context = new PrinterExtensionContext(eventArgs); + } + + #region IPrinterExtensionEventArgs methods + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::BidiNotification + /// </summary> + public string BidiNotification + { + get { return _eventArgs.BidiNotification; } + } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::ReasonId + /// </summary> + public Guid ReasonId + { + get { return _eventArgs.ReasonId; } + } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::Request + /// </summary> + public IPrinterExtensionRequest Request + { + get { return new PrinterExtensionRequest(_eventArgs.Request); } + } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::SourceApplication + /// </summary> + public string SourceApplication + { + get { return _eventArgs.SourceApplication; } + } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::DetailedReasonId + /// </summary> + public Guid DetailedReasonId + { + get { return _eventArgs.DetailedReasonId; } + } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::WindowModal + /// </summary> + public bool WindowModal + { + get + { + if (_eventArgs.WindowModal != 0) + { + return true; + } + return false; + } + } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::WindowParent + /// </summary> + public IntPtr WindowParent + { + get { return _eventArgs.WindowParent; } + } + + #endregion + + #region IPrinterExtensionContext methods + + /// <summary> + /// Maps to COM IPrinterExtensionContext::PrinterQueue + /// </summary> + public IPrinterQueue Queue + { + get { return _context.Queue; } + } + + /// <summary> + /// Maps to COM IPrinterExtensionContext::PrintSchemaTicket + /// </summary> + public IPrintSchemaTicket Ticket + { + get { return _context.Ticket; } + } + + /// <summary> + /// Maps to COM IPrinterExtensionContext::DriverProperties + /// </summary> + public IPrinterPropertyBag DriverProperties + { + get { return _context.DriverProperties; } + } + + /// <summary> + /// Maps to COM IPrinterExtensionContext::UserProperties + /// </summary> + public IPrinterPropertyBag UserProperties + { + get { return _context.UserProperties; } + } + + #endregion + + #region Implementation details + + private PrinterExtensionLib.IPrinterExtensionEventArgs _eventArgs; + + /// <summary> + /// Containment - since multiple inheritance is not possible in C#. + /// </summary> + private PrinterExtensionContext _context; + + #endregion + } + + /// <summary> + /// This class provides wraps IPrinterExtensionContextCollection in a IEnumerable interface + /// </summary> + public sealed class PrinterQueuesEnumeratedEventArgs : EventArgs, IEnumerable<IPrinterExtensionContext> + { + + #region IEnumerable<IPrinterExtensionContext> methods + + public IEnumerator<IPrinterExtensionContext> GetEnumerator() + { + for (uint i = 0; i < _contextCollection.Count; i++) + { + yield return new PrinterExtensionContext(_contextCollection.GetAt(i)); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return (IEnumerator)GetEnumerator(); + } + + #endregion + + #region Implementation details + + internal PrinterQueuesEnumeratedEventArgs(PrinterExtensionLib.IPrinterExtensionContextCollection contextCollection) + { + _contextCollection = contextCollection; + } + + private PrinterExtensionLib.IPrinterExtensionContextCollection _contextCollection; + + #endregion + } + +#if WINDOWS_81_APIS + internal sealed class PrinterExtensionAsyncOperation : IPrinterExtensionAsyncOperation + { + #region IPrinterExtensionAsyncOperation methods + + public void Cancel() + { + _asyncOperation.Cancel(); + } + + #endregion + + #region Implementation methods + + internal PrinterExtensionAsyncOperation(PrinterExtensionLib.IPrinterExtensionAsyncOperation asyncOperation) + { + _asyncOperation = asyncOperation; + } + + private PrinterExtensionLib.IPrinterExtensionAsyncOperation _asyncOperation; + + #endregion + } +#endif + #endregion + + #region COM Adapter Classes + + // + // The following class provide an adapter that exposes a 'Stream' and wraps a + // COM pointer to PrinterExtensionLib.IStream + // + internal class PrinterExtensionLibIStreamAdapter : Stream, IDisposable + { + public PrinterExtensionLibIStreamAdapter(PrinterExtensionLib.IStream stream, bool canWrite = false, bool canSeek = false, bool canRead = true) + { + if (stream != null) + { + _printerExtensionIStream = stream; + } + else + { + throw new ArgumentNullException("stream"); + } + _streamValidation = new StreamValidation(canWrite, canSeek, canRead); + } + + ~PrinterExtensionLibIStreamAdapter() + { + Dispose(false); + } + + #region Overridden Stream methods + + public override int Read(byte[] buffer, int offset, int count) + { + _streamValidation.ValidateRead(buffer, offset, count); + + uint bytesRead = 0; + + // Pin the byte array so that it will not be moved by the garbage collector + byte[] tempBuffer = new byte[count]; + GCHandle gcHandle = GCHandle.Alloc(tempBuffer, GCHandleType.Pinned); + try + { + _printerExtensionIStream.RemoteRead(out tempBuffer[0], Convert.ToUInt32(count), out bytesRead); + + Array.Copy(tempBuffer, 0, buffer, offset, (int)bytesRead); // Safe to cast. Cannot be bigger than 'int count' + } + finally + { + gcHandle.Free(); + } + + return (int)bytesRead; // Safe to cast; bytesRead can never be larger than 'int count' + } + + public override void Write(byte[] buffer, int offset, int count) + { + _streamValidation.ValidateWrite(buffer, offset, count); + + uint written; + + // Pin the byte array so that it will not be moved by the garbage collector + byte[] tempBuffer = new byte[count]; + GCHandle gcHandle = GCHandle.Alloc(tempBuffer, GCHandleType.Pinned); + try + { + Array.Copy(buffer, offset, tempBuffer, 0, count); + _printerExtensionIStream.RemoteWrite(ref tempBuffer[0], Convert.ToUInt32(count), out written); + } + finally + { + gcHandle.Free(); + } + + if ((int)written < count) + { + throw new IOException(); + } + } + + public override long Seek(long offset, SeekOrigin origin) + { + _streamValidation.ValidateSeek(offset, origin); + + uint istreamSeekOrigin = 0; + + switch (origin) + { + case SeekOrigin.Begin: + istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_SET; + break; + + case SeekOrigin.Current: + istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_CUR; + break; + + case SeekOrigin.End: + istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_END; + break; + } + + PrinterExtensionLib._LARGE_INTEGER dlibMove; + PrinterExtensionLib._ULARGE_INTEGER plibNewPosition; + + dlibMove.QuadPart = offset; + + _printerExtensionIStream.RemoteSeek(dlibMove, istreamSeekOrigin, out plibNewPosition); + return Convert.ToInt64(plibNewPosition.QuadPart); + } + + public override long Length + { + get + { + _streamValidation.ValidateSeek(); + + PrinterExtensionLib.tagSTATSTG statstg; + _printerExtensionIStream.Stat(out statstg, 1 /* STATSFLAG_NONAME*/ ); + return Convert.ToInt64(statstg.cbSize.QuadPart); + } + } + public override long Position + { + get { return Seek(0, SeekOrigin.Current); } + set { Seek(value, SeekOrigin.Begin); } + } + + public override void SetLength(long value) + { + _streamValidation.ValidateSeek(); + + PrinterExtensionLib._ULARGE_INTEGER libNewSize; + libNewSize.QuadPart = Convert.ToUInt64(value); + _printerExtensionIStream.SetSize(libNewSize); + } + + public override void Flush() + { + _printerExtensionIStream.Commit(0); + } + + public override bool CanRead + { + get { return _streamValidation.CanRead; } + } + + public override bool CanWrite + { + get { return _streamValidation.CanWrite; } + } + + public override bool CanSeek + { + get { return _streamValidation.CanSeek; } + } + + #endregion + + #region IDisposable methods + + protected override void Dispose(bool disposing) + { + if (_disposed) + { + return; + } + + try + { + if (disposing) + { + _streamValidation.Dispose(); + } + + if (_printerExtensionIStream != null) + { + Marshal.ReleaseComObject(_printerExtensionIStream); + _printerExtensionIStream = null; + } + } + finally + { + base.Dispose(disposing); + } + _disposed = true; + } + + #endregion + + #region Implementation details + + // Prevent default construction + private PrinterExtensionLibIStreamAdapter() { } + + private bool _disposed = false; + private PrinterExtensionLib.IStream _printerExtensionIStream = null; + private StreamValidation _streamValidation = null; + + #endregion + } + + + // + // The following class provide an adapter that exposes a 'Stream' and wraps a + // COM pointer to the standard COM 'IStream' interface + // + internal class ComIStreamAdapter : Stream, IDisposable + { + public ComIStreamAdapter(System.Runtime.InteropServices.ComTypes.IStream stream, bool canWrite = false, bool canSeek = false, bool canRead = true) + { + if (stream != null) + { + _comIstream = stream; + } + else + { + throw new ArgumentNullException("stream"); + } + _streamValidation = new StreamValidation(canWrite, canSeek, canRead); + } + + ~ComIStreamAdapter() + { + Dispose(false); + } + + #region Overridden Stream methods + + public override int Read(byte[] buffer, int offset, int count) + { + _streamValidation.ValidateRead(buffer, offset, count); + + uint bytesRead = 0; + + // Pin the byte array so that it will not be moved by the garbage collector + byte[] tempBuffer = new byte[count]; + GCHandle gcHandle = GCHandle.Alloc(tempBuffer, GCHandleType.Pinned); + IntPtr bytesReadPtr = Marshal.AllocHGlobal(sizeof(int)); + try + { + _comIstream.Read(tempBuffer, count, bytesReadPtr); + bytesRead = (uint)Marshal.ReadInt32(bytesReadPtr); + + Array.Copy(tempBuffer, 0, buffer, offset, (int)bytesRead); // Safe to cast. Cannot be bigger than 'int count' + } + finally + { + Marshal.FreeHGlobal(bytesReadPtr); + gcHandle.Free(); + } + + return (int)bytesRead; // Safe to cast; bytesRead can never be larger than 'int count' + } + + public override void Write(byte[] buffer, int offset, int count) + { + _streamValidation.ValidateWrite(buffer, offset, count); + + uint written; + + // Pin the byte array so that it will not be moved by the garbage collector + byte[] tempBuffer = new byte[count]; + GCHandle gcHandle = GCHandle.Alloc(tempBuffer, GCHandleType.Pinned); + IntPtr writeCountPointer = Marshal.AllocHGlobal(sizeof(int)); + try + { + Array.Copy(buffer, offset, tempBuffer, 0, count); + + _comIstream.Write(tempBuffer, count, writeCountPointer); + written = (uint)Marshal.ReadInt32(writeCountPointer); // safe to cast. 'written' is always non-negative + } + finally + { + gcHandle.Free(); + Marshal.FreeHGlobal(writeCountPointer); + } + + if ((int)written < count) + { + throw new IOException(); + } + } + + public override long Seek(long offset, SeekOrigin origin) + { + _streamValidation.ValidateSeek(offset, origin); + + uint istreamSeekOrigin = 0; + + switch (origin) + { + case SeekOrigin.Begin: + istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_SET; + break; + + case SeekOrigin.Current: + istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_CUR; + break; + + case SeekOrigin.End: + istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_END; + break; + } + + IntPtr seekPositionPointer = Marshal.AllocHGlobal(sizeof(long)); + long seekPosition = 0; + try + { + _comIstream.Seek(offset, (int)istreamSeekOrigin, seekPositionPointer); + seekPosition = Marshal.ReadInt64(seekPositionPointer); + } + finally + { + Marshal.FreeHGlobal(seekPositionPointer); + } + + return seekPosition; + } + + public override long Length + { + get + { + _streamValidation.ValidateSeek(); + + System.Runtime.InteropServices.ComTypes.STATSTG statstg; + _comIstream.Stat(out statstg, 1 /* STATSFLAG_NONAME*/ ); + return statstg.cbSize; + } + } + public override long Position + { + get { return Seek(0, SeekOrigin.Current); } + set { Seek(value, SeekOrigin.Begin); } + } + + public override void SetLength(long value) + { + _streamValidation.ValidateSeek(); + _comIstream.SetSize(value); + } + + public override void Flush() + { + _comIstream.Commit(0); + } + + public override bool CanRead + { + get { return _streamValidation.CanRead; } + } + + public override bool CanWrite + { + get { return _streamValidation.CanWrite; } + } + + public override bool CanSeek + { + get { return _streamValidation.CanSeek; } + } + + #endregion + + #region IDisposable methods + + protected override void Dispose(bool disposing) + { + if (_disposed) + { + return; + } + + try + { + if (disposing) + { + _streamValidation.Dispose(); + } + + if (_comIstream != null) + { + Marshal.ReleaseComObject(_comIstream); + _comIstream = null; + } + } + finally + { + base.Dispose(disposing); + } + _disposed = true; + } + + #endregion + + #region Implementation details + + // Prevent default construction + private ComIStreamAdapter() { } + + private bool _disposed = false; + private System.Runtime.InteropServices.ComTypes.IStream _comIstream = null; + private StreamValidation _streamValidation = null; + + #endregion + } + + internal class StreamValidation : IDisposable + { + internal StreamValidation(bool canWrite = false, bool canSeek = false, bool canRead = true) + { + _canWrite = canWrite; + _canSeek = canSeek; + _canRead = canRead; + } + + internal void ValidateRead(byte[] buffer, int offset, int count) + { + if (!_canRead) + { + throw new NotSupportedException(); + } + if (_disposed == true) + { + throw new ObjectDisposedException("COM IStream"); + } + if (buffer == null) + { + throw new ArgumentNullException("buffer"); + } + if (offset < 0) + { + throw new ArgumentOutOfRangeException("offset"); + } + if (count < 0) + { + throw new ArgumentOutOfRangeException("count"); + } + if ((buffer.Length - offset) < count) + { + throw new ArgumentException(); + } + } + + internal void ValidateWrite(byte[] buffer, int offset, int count) + { + if (!_canWrite) + { + throw new NotSupportedException(); + } + if (_disposed == true) + { + throw new ObjectDisposedException("COM IStream"); + } + if (buffer == null) + { + throw new ArgumentNullException("buffer"); + } + if (offset < 0) + { + throw new ArgumentOutOfRangeException("offset"); + } + if (count < 0) + { + throw new ArgumentOutOfRangeException("count"); + } + if ((buffer.Length - offset) < count) + { + throw new ArgumentException("Insufficient buffer size"); + } + } + + internal void ValidateSeek(long offset, SeekOrigin origin) + { + ValidateSeek(); + if ((origin < SeekOrigin.Begin) || (origin > SeekOrigin.End)) + { + throw new ArgumentException("Invalid value", "origin"); + } + } + + internal void ValidateSeek() + { + if (!_canSeek) + { + throw new NotSupportedException(); + } + if (_disposed == true) + { + throw new ObjectDisposedException("COM IStream"); + } + } + + public bool CanRead + { + get { return _canRead; } + } + + public bool CanWrite + { + get { return _canWrite; } + } + + public bool CanSeek + { + get { return _canSeek; } + } + + #region IDisposable methods + + public void Dispose() + { + _disposed = true; + } + + #endregion + + #region Implementation details + + private bool _disposed = false; + private bool _canWrite = false; + private bool _canSeek = false; + private bool _canRead = true; + + #endregion + } + + #endregion + + #region PrintSchema Adapter Classes + + // + // Following are concrete implementation of the PrinterExtension interfaces + // These classes wrap the underlying COM interfaces. + // + + internal class PrintSchemaOption : IPrintSchemaOption + { + + #region IPrintSchemaOption methods + + public bool Selected + { + get { return (0 == _option.Selected) ? false : true; } + } + + public PrintSchemaConstrainedSetting Constrained + { + get { return (PrintSchemaConstrainedSetting)_option.Constrained; } + } + + #endregion + + #region IPrintSchemaDisplayableElement methods + + public string DisplayName { get { return _option.DisplayName; } } + public string Name { get { return _option.Name; } } + public string XmlNamespace { get { return _option.NamespaceUri; } } + + #endregion + + #region Implementation details + + internal PrintSchemaOption(PrinterExtensionLib.IPrintSchemaOption option) + { + _option = option; + } + + internal PrinterExtensionLib.IPrintSchemaOption InteropOption + { + get { return _option; } + set { _option = value; } + } + + // + // Create the correct 'PrintSchemaOption' subclass, possibly exposing one of the these interfaces + // 1. IPrintSchemaPageMediaSizeOption + // 2. IPrintSchemaNUpOption + // + internal static IPrintSchemaOption CreateOptionSubclass(PrinterExtensionLib.IPrintSchemaOption option) + { + // IPrintSchemaNUpOption option + if (option is PrinterExtensionLib.IPrintSchemaNUpOption) + { + return new PrintSchemaNUpOption(option); + } + + // IPrintSchemaPageMediaSizeOption option + if (option is PrinterExtensionLib.IPrintSchemaPageMediaSizeOption) + { + return new PrintSchemaPageMediaSizeOption(option); + } + + return new PrintSchemaOption(option); + } + + internal PrinterExtensionLib.IPrintSchemaOption _option; + + // Prevent default constuction + private PrintSchemaOption() { } + + #endregion + } + + internal sealed class PrintSchemaPageMediaSizeOption : PrintSchemaOption, IPrintSchemaPageMediaSizeOption + { + #region IPrintSchemaPageMediaSizeOption methods + + public uint HeightInMicrons + { + get { return _pageMediaSizeOption.HeightInMicrons; } + } + + public uint WidthInMicrons + { + get { return _pageMediaSizeOption.WidthInMicrons; } + } + + #endregion + + #region Implementation details + + internal PrintSchemaPageMediaSizeOption(PrinterExtensionLib.IPrintSchemaOption option) + : base(option) + { + _pageMediaSizeOption = _option as PrinterExtensionLib.IPrintSchemaPageMediaSizeOption; + if (null == _pageMediaSizeOption) + { + throw new NotImplementedException("Could not retrieve IPrintSchemaPageMediaSizeOption interface."); + } + } + + private PrinterExtensionLib.IPrintSchemaPageMediaSizeOption _pageMediaSizeOption; + + #endregion + } + + internal sealed class PrintSchemaNUpOption : PrintSchemaOption, IPrintSchemaNUpOption + { + #region IPrintSchemaNUpOption methods + + public uint PagesPerSheet + { + get { return _nupOption.PagesPerSheet; } + } + + #endregion + + #region Implementation details + + internal PrintSchemaNUpOption(PrinterExtensionLib.IPrintSchemaOption option) : + base(option) + { + _nupOption = _option as PrinterExtensionLib.IPrintSchemaNUpOption; + if (null == _nupOption) + { + throw new NotImplementedException("Could not retrieve IPrintSchemaNUpOption interface."); + } + } + + private PrinterExtensionLib.IPrintSchemaNUpOption _nupOption; + + #endregion + } + + /// <summary> + /// This class provides wraps IPrintSchemaOptionCollection in a IEnumerable interface + /// </summary> + internal sealed class PrintSchemaOptionsCollection : IEnumerable<IPrintSchemaOption> + { + + #region IEnumerable<IPrintSchemaOption> methods + + public IEnumerator<IPrintSchemaOption> GetEnumerator() + { + for (uint i = 0; i < _optionCollection.Count; i++) + { + yield return new PrintSchemaOption(_optionCollection.GetAt(i)); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return (IEnumerator)GetEnumerator(); + } + + #endregion + + #region Implementation details + + internal PrintSchemaOptionsCollection(PrinterExtensionLib.IPrintSchemaOptionCollection optionCollection) + { + _optionCollection = optionCollection; + } + + private PrinterExtensionLib.IPrintSchemaOptionCollection _optionCollection; + + #endregion + } + + internal sealed class PrintSchemaFeature : IPrintSchemaFeature + { + #region IPrintSchemaFeature methods + + public PrintSchemaSelectionType SelectionType + { + get { return (PrintSchemaSelectionType)_feature.SelectionType; } + } + + public IPrintSchemaOption GetOption(string name) + { + return GetOption(name, PrintSchemaConstants.KeywordsNamespaceUri); + } + + public IPrintSchemaOption GetOption(string name, string xmlNamespace) + { + PrinterExtensionLib.IPrintSchemaOption option = _feature.GetOption(name, xmlNamespace); + if (option != null) + { + return PrintSchemaOption.CreateOptionSubclass(option); + } + + return null; + } + + public IPrintSchemaOption SelectedOption + { + get + { + return PrintSchemaOption.CreateOptionSubclass(_feature.SelectedOption); + } + set + { + _feature.SelectedOption = (value as PrintSchemaOption).InteropOption; + } + } + + public bool DisplayUI + { + get + { + return (0 == _feature.DisplayUI) ? false : true; + } + } + + #endregion + + #region IPrintSchemaDisplayableElement methods + + public string DisplayName { get { return _feature.DisplayName; } } + public string Name { get { return _feature.Name; } } + public string XmlNamespace { get { return _feature.NamespaceUri; } } + + #endregion + + #region Implementation details + + internal PrintSchemaFeature(PrinterExtensionLib.IPrintSchemaFeature feature) + { + _feature = feature; + } + + internal PrinterExtensionLib.IPrintSchemaFeature InteropFeature + { + get { return _feature; } + } + + private PrinterExtensionLib.IPrintSchemaFeature _feature; + + #endregion + } + + internal sealed class PrintSchemaPageImageableSize : IPrintSchemaPageImageableSize + { + #region IPrintSchemaPageImageableSize methods + + public uint ExtentHeightInMicrons + { + get { return _pageImageableSize.ExtentHeightInMicrons; } + } + + public uint ExtentWidthInMicrons + { + get { return _pageImageableSize.ExtentWidthInMicrons; } + } + + public uint ImageableSizeHeightInMicrons + { + get { return _pageImageableSize.ImageableSizeHeightInMicrons; } + } + + public uint ImageableSizeWidthInMicrons + { + get { return _pageImageableSize.ImageableSizeWidthInMicrons; } + } + + public uint OriginHeightInMicrons + { + get { return _pageImageableSize.OriginHeightInMicrons; } + } + + public uint OriginWidthInMicrons + { + get { return _pageImageableSize.OriginWidthInMicrons; } + } + + #endregion + + #region IPrintSchemaElement methods + + public string Name { get { return _pageImageableSize.Name; } } + public string XmlNamespace { get { return _pageImageableSize.NamespaceUri; } } + + #endregion + + #region Implementation details + + internal PrintSchemaPageImageableSize(PrinterExtensionLib.IPrintSchemaPageImageableSize pageImageableSize) + { + _pageImageableSize = pageImageableSize; + } + + private PrinterExtensionLib.IPrintSchemaPageImageableSize _pageImageableSize; + + #endregion + } + +#if WINDOWS_81_APIS + internal sealed class PrintSchemaParameterDefinition : IPrintSchemaParameterDefinition + { + #region IPrintSchemaParameterDefinition methods + + public bool UserInputRequired + { + get + { + if (_parameter.UserInputRequired != 0) + { + return true; + } + return false; + } + } + + public string UnitType + { + get { return _parameter.UnitType; } + } + + public PrintSchemaParameterDataType DataType + { + get { return (PrintSchemaParameterDataType)_parameter.DataType; } + } + + public int RangeMin + { + get { return _parameter.RangeMin; } + } + + public int RangeMax + { + get { return _parameter.RangeMax; } + } + #endregion + + #region IPrintSchemaDisplayableItem methods + + public string DisplayName { get { return _parameter.DisplayName; } } + public string Name { get { return _parameter.Name; } } + public string XmlNamespace { get { return _parameter.NamespaceUri; } } + + #endregion + + #region Implementation details + + internal PrintSchemaParameterDefinition(PrinterExtensionLib.IPrintSchemaParameterDefinition parameter) + { + _parameter = parameter; + } + + private PrinterExtensionLib.IPrintSchemaParameterDefinition _parameter; + + #endregion + } + + internal sealed class PrintSchemaParameterInitializer : IPrintSchemaParameterInitializer + { + #region IPrintSchemaParameterInitializer methods + + public string StringValue + { + get + { + object value = _parameter.get_Value(); + return (string)value; + } + set + { + _parameter.set_Value(value); + } + } + + public int IntegerValue + { + get + { + object value = _parameter.get_Value(); + return (int)value; + } + set + { + _parameter.set_Value(value); + } + } + #endregion + + #region IPrintSchemaElement methods + + public string Name { get { return _parameter.Name; } } + public string XmlNamespace { get { return _parameter.NamespaceUri; } } + + #endregion + + #region Implementation details + + internal PrintSchemaParameterInitializer(PrinterExtensionLib.IPrintSchemaParameterInitializer parameter) + { + _parameter = parameter; + } + + PrinterExtensionLib.IPrintSchemaParameterInitializer _parameter; + + #endregion + } +#endif + + internal sealed class PrintSchemaCapabilities : IPrintSchemaCapabilities + { + #region IPrintSchemaCapabilities methods + + public IPrintSchemaFeature GetFeatureByKeyName(string keyName) + { + PrinterExtensionLib.IPrintSchemaFeature feature = _capabilities.GetFeatureByKeyName(keyName); + if (feature != null) + { + return new PrintSchemaFeature(feature); + } + + return null; + } + + public IPrintSchemaFeature GetFeature(string featureName) + { + return GetFeature(featureName, PrintSchemaConstants.KeywordsNamespaceUri); + } + + public IPrintSchemaFeature GetFeature(string featureName, string xmlNamespace) + { + PrinterExtensionLib.IPrintSchemaFeature feature = _capabilities.GetFeature(featureName, xmlNamespace); + if (feature != null) + { + return new PrintSchemaFeature(feature); + } + + return null; + } + + public IPrintSchemaPageImageableSize PageImageableSize + { + get { return new PrintSchemaPageImageableSize(_capabilities.PageImageableSize); } + } + + public uint JobCopiesAllDocumentsMaxValue + { + get + { + uint value = _capabilities.JobCopiesAllDocumentsMaxValue; + if (value == 0) + { + throw new NotSupportedException("Property \"JobCopiesAllDocumentsMaxValue\" not found in print capabilities."); + } + + return value; + } + } + + public uint JobCopiesAllDocumentsMinValue + { + get + { + uint value = _capabilities.JobCopiesAllDocumentsMinValue; + if (value == 0) + { + throw new NotSupportedException("Property \"JobCopiesAllDocumentsMinValue\" not found in print capabilities."); + } + + return value; + } + } + + public IPrintSchemaOption GetSelectedOptionInPrintTicket(IPrintSchemaFeature feature) + { + PrintSchemaFeature f = feature as PrintSchemaFeature; + PrinterExtensionLib.IPrintSchemaOption option = _capabilities.GetSelectedOptionInPrintTicket(f.InteropFeature); + + if (option != null) + { + return PrintSchemaOption.CreateOptionSubclass(option); + } + + return null; + } + + public IEnumerable<IPrintSchemaOption> GetOptions(IPrintSchemaFeature pFeature) + { + return new PrintSchemaOptionsCollection( + _capabilities.GetOptions( + (pFeature as PrintSchemaFeature).InteropFeature) + ); + } + + public Stream GetReadStream() + { + return new ComIStreamAdapter(XmlStream, + false, // canWrite + true, // canSeek + true // canRead + ); + } + + public Stream GetWriteStream() + { + return new ComIStreamAdapter(XmlStream, + true, // canWrite + true, // canSeek + false // canRead + ); + } + +#if WINDOWS_81_APIS + public IPrintSchemaParameterDefinition GetParameterDefinition(string parameterName) + { + return GetParameterDefinition(parameterName, PrintSchemaConstants.KeywordsNamespaceUri); + } + + public IPrintSchemaParameterDefinition GetParameterDefinition(string parameterName, string xmlNamespace) + { + PrinterExtensionLib.IPrintSchemaParameterDefinition parameter = _capabilities2.GetParameterDefinition(parameterName, xmlNamespace); + if (parameter != null) + { + return new PrintSchemaParameterDefinition(parameter); + } + + return null; + } +#endif + + private System.Runtime.InteropServices.ComTypes.IStream XmlStream + { + get + { + System.Runtime.InteropServices.ComTypes.IStream istream = _capabilities.XmlNode as System.Runtime.InteropServices.ComTypes.IStream; + + return istream; + } + } + + #endregion + + #region Implementation details + + internal PrintSchemaCapabilities(PrinterExtensionLib.IPrintSchemaCapabilities caps) + { + _capabilities = caps; +#if WINDOWS_81_APIS + _capabilities2 = (PrinterExtensionLib.IPrintSchemaCapabilities2)caps; +#endif + } + + private PrinterExtensionLib.IPrintSchemaCapabilities _capabilities; +#if WINDOWS_81_APIS + private PrinterExtensionLib.IPrintSchemaCapabilities2 _capabilities2; +#endif + #endregion + } + + internal class PrintSchemaAsyncOperation : IPrintSchemaAsyncOperation + { + #region IPrintSchemaAsyncOperation methods + + public void Cancel() + { + _asyncOperation.Cancel(); + } + + public void Start() + { + _asyncOperation.Start(); + } + + public event EventHandler<PrintSchemaAsyncOperationEventArgs> Completed; + + #endregion + + #region Implementation details + + internal PrintSchemaAsyncOperation(PrinterExtensionLib.PrintSchemaAsyncOperation asyncOperation) + { + _asyncOperation = asyncOperation; + _asyncOperation.Completed += _asyncOperation_Completed; + } + + void _asyncOperation_Completed(PrinterExtensionLib.IPrintSchemaTicket printTicket, int hrOperation) + { + if (Completed != null) + { + IPrintSchemaTicket ticket = new PrintSchemaTicket(printTicket); + Completed(this, new PrintSchemaAsyncOperationEventArgs(ticket, hrOperation)); + } + + // This subscriber object (current object) holds a reference to the publishing object (i.e the underlying COM object) + // because it is a class member, and the publishing object holds a reference to the subscriber via the registered delegate. + // This implies neither object will be garbage collected until the application terminates. + // It's expected the event is fired once per instance so unsubscribing the delegate has no side effects. + _asyncOperation.Completed -= _asyncOperation_Completed; + Marshal.ReleaseComObject(_asyncOperation); + _asyncOperation = null; + } + + private PrinterExtensionLib.PrintSchemaAsyncOperation _asyncOperation; + + #endregion + } + + internal class PrintSchemaTicket : IPrintSchemaTicket + { + + #region IPrintSchemaTicket methods + + public IPrintSchemaCapabilities GetCapabilities() + { + return new PrintSchemaCapabilities(_printTicket.GetCapabilities()); + } + + public IPrintSchemaFeature GetFeature(string featureName) + { + return GetFeature(featureName, PrintSchemaConstants.KeywordsNamespaceUri); + } + + public IPrintSchemaFeature GetFeature(string featureName, string xmlNamespace) + { + PrinterExtensionLib.IPrintSchemaFeature feature = _printTicket.GetFeature(featureName, xmlNamespace); + if (feature != null) + { + return new PrintSchemaFeature(feature); + } + + return null; + } + + public IPrintSchemaFeature GetFeatureByKeyName(string keyName) + { + PrinterExtensionLib.IPrintSchemaFeature feature = _printTicket.GetFeatureByKeyName(keyName); + if (feature != null) + { + return new PrintSchemaFeature(feature); + } + + return null; + } + + public uint JobCopiesAllDocuments + { + get + { + uint value = _printTicket.JobCopiesAllDocuments; + if (value == 0) + { + throw new NotSupportedException("Property \"JobCopiesAllDocuments\" not found in print ticket."); + } + + return value; + } + set + { + _printTicket.JobCopiesAllDocuments = value; + } + } + + public Stream GetReadStream() + { + return new ComIStreamAdapter(XmlStream, + false, // canWrite + true, // canSeek + true // canRead + ); + } + + public Stream GetWriteStream() + { + return new ComIStreamAdapter(XmlStream, + true, // canWrite + true, // canSeek + false // canRead + ); + } + + private System.Runtime.InteropServices.ComTypes.IStream XmlStream + { + get + { + System.Runtime.InteropServices.ComTypes.IStream istream = _printTicket.XmlNode as System.Runtime.InteropServices.ComTypes.IStream; + + return istream; + } + } + + public IPrintSchemaAsyncOperation ValidateAsync() + { + PrinterExtensionLib.PrintSchemaAsyncOperation interopAsyncOperation; + _printTicket.ValidateAsync(out interopAsyncOperation); + return new PrintSchemaAsyncOperation(interopAsyncOperation); + } + + public IPrintSchemaAsyncOperation CommitAsync(IPrintSchemaTicket printTicketCommit) + { + PrinterExtensionLib.IPrintSchemaTicket interopTicket = (printTicketCommit as PrintSchemaTicket)._printTicket; + PrinterExtensionLib.PrintSchemaAsyncOperation interopAsyncOperation; + _printTicket.CommitAsync(interopTicket, out interopAsyncOperation); + return new PrintSchemaAsyncOperation(interopAsyncOperation); + } + + public void NotifyXmlChanged() + { + _printTicket.NotifyXmlChanged(); + } +#if WINDOWS_81_APIS + public IPrintSchemaParameterInitializer GetParameterInitializer(string parameterName) + { + return GetParameterInitializer(parameterName, PrintSchemaConstants.KeywordsNamespaceUri); + } + + public IPrintSchemaParameterInitializer GetParameterInitializer(string parameterName, string xmlNamespace) + { + PrinterExtensionLib.IPrintSchemaParameterInitializer parameter = _printTicket2.GetParameterInitializer(parameterName, xmlNamespace); + if (parameter != null) + { + return new PrintSchemaParameterInitializer(parameter); + } + + return null; + } +#endif + + #endregion + + #region Implementation details + + internal PrintSchemaTicket(PrinterExtensionLib.IPrintSchemaTicket printTicket) + { + _printTicket = printTicket; +#if WINDOWS_81_APIS + _printTicket2 = (PrinterExtensionLib.IPrintSchemaTicket2)printTicket; +#endif + } + + private PrinterExtensionLib.IPrintSchemaTicket _printTicket; +#if WINDOWS_81_APIS + private PrinterExtensionLib.IPrintSchemaTicket2 _printTicket2; +#endif + + #endregion + } + + internal enum PrintPropertyBagType + { + QueueProperties, + DriverProperties, + UserProperties + } + + internal class PrinterPropertyBag : IPrinterPropertyBag + { + #region IPrinterPropertyBag methods + + public bool GetBool(string propertyName) + { + try + { + int integerEquivalent = _bag.GetBool(propertyName); + bool boolEquivalent = true; + if (integerEquivalent == 0) + { + boolEquivalent = false; + } + return boolEquivalent; + } + catch (ArgumentException e) + { + // Fix the type of exception thrown when the property does not exist. + if (ShouldConvertExceptionType(e)) + { + throw new FileNotFoundException("", e); + } + throw; + } + } + + public byte[] GetBytes(string propertyName) + { + try + { + uint count = 0; + IntPtr intptrData = Marshal.AllocCoTaskMem(IntPtr.Size); + _bag.GetBytes( + propertyName, + out count, + intptrData); + + byte[] data = new byte[count]; + Marshal.Copy(Marshal.ReadIntPtr(intptrData), data, 0, (int)count); + Marshal.FreeCoTaskMem(Marshal.ReadIntPtr(intptrData)); + Marshal.FreeCoTaskMem(intptrData); + return data; + } + catch (ArgumentException e) + { + // Fix the type of exception thrown when the property does not exist. + if (ShouldConvertExceptionType(e)) + { + throw new FileNotFoundException("", e); + } + throw; + } + } + + public int GetInt(string propertyName) + { + try + { + return _bag.GetInt32(propertyName); + } + catch (ArgumentException e) + { + // Fix the type of exception thrown when the property does not exist. + if (ShouldConvertExceptionType(e)) + { + throw new FileNotFoundException("", e); + } + throw; + } + } + + public string GetString(string propertyName) + { + try + { + return _bag.GetString(propertyName); + } + catch (ArgumentException e) + { + // Fix the type of exception thrown when the property does not exist. + if (ShouldConvertExceptionType(e)) + { + throw new FileNotFoundException("", e); + } + throw; + } + } + + public void SetBool(string propertyName, bool value) + { + int integerEquivalent = 1; + if (value == false) + { + integerEquivalent = 0; + } + + _bag.SetBool(propertyName, integerEquivalent); + } + + public void SetBytes(string propertyName, byte[] data) + { + // Pin the byte array so that it will not be moved by the garbage collector + // This would not be required if the COM Interop function took in a byte[] parameter + // as opposed to a byte parameter + GCHandle gcHandle = GCHandle.Alloc(data, GCHandleType.Pinned); + try + { + _bag.SetBytes(propertyName, Convert.ToUInt32(data.Length), ref data[0]); + } + finally + { + gcHandle.Free(); + } + } + + public void SetInt(string propertyName, int value) + { + _bag.SetInt32(propertyName, value); + } + + public void SetString(string propertyName, string value) + { + _bag.SetString(propertyName, value); + } + + public Stream GetReadStream(string propertyName) + { + try + { + return new PrinterExtensionLibIStreamAdapter(_bag.GetReadStream(propertyName), false, true, true); + } + catch (COMException e) + { + // Fix the type of exception thrown when the property does not exist. + if (ShouldConvertExceptionType(e)) + { + throw new FileNotFoundException("", e); + } + throw; + } + } + + public Stream GetWriteStream(string propertyName) + { + return new PrinterExtensionLibIStreamAdapter(_bag.GetWriteStream(propertyName), true, true, false); + } + + #endregion + + #region Indexer + + public PrinterProperty this[string name] + { + get { return new PrinterProperty(this, name); } + } + + #endregion + + #region Implementation details + + internal PrinterPropertyBag(PrinterExtensionLib.IPrinterPropertyBag bag, PrintPropertyBagType type) + { + _bag = bag; + _type = type; + } + + /// <summary> + /// Check if exception thrown when a property is not found in a property bag needs to be converted. + /// </summary> + /// <param name="e"></param> + /// <returns>True if the exception type needs to be converted.</returns> + private bool ShouldConvertExceptionType(Exception e) + { + // Only the driver property bag throws exceptions other than 'FileNotFoundException' + // when a property is not found. + if (_type != PrintPropertyBagType.DriverProperties) + { + return false; + } + else if (e is ArgumentException) + { + return true; + } + else if (e is COMException) + { + // Since there is no portable way to check the HRESULT across classic .Net and + // .Net for Windows Store apps, all COMExceptions encountered are converted. + return true; + } + return false; + } + + private PrinterExtensionLib.IPrinterPropertyBag _bag; + private PrintPropertyBagType _type; + + #endregion + } + +#if WINDOWS_81_APIS + public sealed class PrintJob : IPrintJob + { + #region IPrintJob methods + + public string Name + { + get { return _job.Name; } + } + + public ulong Id + { + get { return _job.Id; } + } + + public ulong PrintedPages + { + get { return _job.PrintedPages; } + } + + public ulong TotalPages + { + get { return _job.TotalPages; } + } + + public PrintJobStatus Status + { + get { return (PrintJobStatus)_job.Status; } + } + + public DateTime SubmissionTime + { + get { return _job.SubmissionTime; } + } + + public void RequestCancel() + { + _job.RequestCancel(); + } + + #endregion + + #region Implementation details + + internal PrintJob(PrinterExtensionLib.IPrintJob job) + { + _job = job; + } + + PrinterExtensionLib.IPrintJob _job; + + #endregion + } + + /// <summary> + /// This class provides wraps IPrintJobCollection in a IEnumerable interface + /// </summary> + public sealed class PrintJobCollection : IEnumerable<IPrintJob> + { + #region IEnumerable<IPrintJob> methods + + public IEnumerator<IPrintJob> GetEnumerator() + { + for (uint i = 0; i < _jobCollection.Count; i++) + { + yield return new PrintJob(_jobCollection.GetAt(i)); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return (IEnumerator)GetEnumerator(); + } + + #endregion + + #region Implementation details + + internal PrintJobCollection(PrinterExtensionLib.IPrintJobCollection jobCollection) + { + _jobCollection = jobCollection; + } + + private PrinterExtensionLib.IPrintJobCollection _jobCollection; + + #endregion + } + + internal sealed class PrinterQueueView : IPrinterQueueView + { + #region IPrinterQueueView methods + + public void SetViewRange(uint viewOffset, uint viewSize) + { + _view.SetViewRange(viewOffset, viewSize); + } + + public event EventHandler<PrinterQueueViewEventArgs> OnChanged + { + add + { + if (_onChanged == null) + { + _view.OnChanged += _view_OnChanged; + } + _onChanged += value; + } + remove + { + _onChanged -= value; + if (_onChanged == null) + { + _view.OnChanged -= _view_OnChanged; + } + } + } + + #endregion + + #region Implementation details + + internal PrinterQueueView(PrinterExtensionLib.PrinterQueueView view) + { + _view = view; + } + + void _view_OnChanged(PrinterExtensionLib.IPrintJobCollection pCollection, uint ulViewOffset, uint ulViewSize, uint ulCountJobsInPrintQueue) + { + if (_onChanged != null) + { + _onChanged(this, new PrinterQueueViewEventArgs(new PrintJobCollection(pCollection), ulViewOffset, ulViewSize, ulCountJobsInPrintQueue)); + } + } + + private PrinterExtensionLib.PrinterQueueView _view; + private event EventHandler<PrinterQueueViewEventArgs> _onChanged; + + #endregion + } + + internal sealed class PrinterBidiSetRequestCallback : PrinterExtensionLib.IPrinterBidiSetRequestCallback + { + #region IPrinterBidiSetRequestCallback methods + + public void Completed(string response, int statusHResult) + { + _callback.Completed(response, statusHResult); + } + + #endregion + + #region Implementation details + + internal PrinterBidiSetRequestCallback(IPrinterBidiSetRequestCallback callback) + { + _callback = callback; + } + + private IPrinterBidiSetRequestCallback _callback; + + #endregion + } +#endif + + internal sealed class PrinterQueue : IPrinterQueue + { + #region IPrinterQueue methods + + public string Name + { + get { return _queue.Name; } + } + + public void SendBidiQuery(string bidiQuery) + { + _queue.SendBidiQuery(bidiQuery); + } + + public IntPtr Handle + { + get { return _queue.Handle; } + } + + public IPrinterPropertyBag GetProperties() + { + return new PrinterPropertyBag(_queue.GetProperties(), PrintPropertyBagType.QueueProperties); + } + public event EventHandler<PrinterQueueEventArgs> OnBidiResponseReceived + { + add + { + if (_onBidiResponseReceived == null) + { + _queue.OnBidiResponseReceived += _queue_OnBidiResponseReceived; + } + _onBidiResponseReceived += value; + } + remove + { + _onBidiResponseReceived -= value; + if (_onBidiResponseReceived == null) + { + _queue.OnBidiResponseReceived -= _queue_OnBidiResponseReceived; + } + } + } + +#if WINDOWS_81_APIS + public IPrinterExtensionAsyncOperation SendBidiSetRequestAsync(string bidiRequest, IPrinterBidiSetRequestCallback callback) + { + PrinterBidiSetRequestCallback comCallback = new PrinterBidiSetRequestCallback(callback); + PrinterExtensionLib.IPrinterBidiSetRequestCallback comCallbackInterface = comCallback; + return new PrinterExtensionAsyncOperation(_queue2.SendBidiSetRequestAsync(bidiRequest, comCallbackInterface)); + } + + public IPrinterQueueView GetPrinterQueueView(uint viewOffset, uint viewSize) + { + return new PrinterQueueView(_queue2.GetPrinterQueueView(viewOffset, viewSize)); + } +#endif + + #endregion + + #region Implementation details + + internal PrinterQueue(PrinterExtensionLib.PrinterQueue queue) + { + _queue = queue; +#if WINDOWS_81_APIS + _queue2 = (PrinterExtensionLib.IPrinterQueue2)queue; +#endif + } + + private void _queue_OnBidiResponseReceived(string bstrResponse, int hrStatus) + { + if (_onBidiResponseReceived != null) + { + _onBidiResponseReceived(this, new PrinterQueueEventArgs(bstrResponse, hrStatus)); + } + } + + private event EventHandler<PrinterQueueEventArgs> _onBidiResponseReceived; +#if WINDOWS_81_APIS + private PrinterExtensionLib.IPrinterQueue2 _queue2; +#endif + private PrinterExtensionLib.PrinterQueue _queue; + + #endregion + } + + internal sealed class PrinterExtensionRequest : IPrinterExtensionRequest + { + #region IPrinterExtensionRequest methods + + public void Complete() + { + _request.Complete(); + } + + public void Cancel(int hr, string logMessage) + { + _request.Cancel(hr, logMessage); + } + + #endregion + + #region Implementation details + + internal PrinterExtensionRequest(PrinterExtensionLib.IPrinterExtensionRequest request) + { + _request = request; + } + + private PrinterExtensionLib.IPrinterExtensionRequest _request; + + #endregion + } + + #endregion +} + diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionLibrary.csproj b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionLibrary.csproj new file mode 100644 index 00000000..8ecb8721 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionLibrary.csproj @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{D8DA0C4D-F972-4546-9068-8EB256F222F7}</ProjectGuid> + <DefaultLanguage>en-US</DefaultLanguage> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Microsoft.Samples.Printing.PrinterExtension</RootNamespace> + <AssemblyName>Microsoft.Samples.Printing.PrinterExtensionLibrary</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <!-- Silence warnings generated from all COM references. --> + <ResolveComReferenceSilent>true</ResolveComReferenceSilent> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8 Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Win8 Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8 Release|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Win8 Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8.1 Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Win8.1 Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;WINDOWS_81_APIS</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8.1 Release|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Win8.1 Release\</OutputPath> + <DefineConstants>TRACE;WINDOWS_81_APIS</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <!-- A reference to the entire .Net Framework and Windows SDK are automatically included --> + </ItemGroup> + <ItemGroup> + <Compile Include="PrinterExtensionAdapters.cs" /> + <Compile Include="PrinterExtensionTypes.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="PrinterExtensionManager.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <COMReference Include="PrinterExtensionLib"> + <Guid>{91CE54EE-C67C-4B46-A4FF-99416F27A8BF}</Guid> + <VersionMajor>1</VersionMajor> + <VersionMinor>0</VersionMinor> + <Lcid>0</Lcid> + <WrapperTool>tlbimp</WrapperTool> + <Isolated>False</Isolated> + <EmbedInteropTypes>True</EmbedInteropTypes> + </COMReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionManager.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionManager.cs new file mode 100644 index 00000000..91815d6a --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionManager.cs @@ -0,0 +1,121 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// +// Abstract: +// +// This file contains an Adapter that wrap the PrinterExtensionManager COM Interop type. +// +using System; +using System.IO; +using System.Collections; +using System.Collections.Generic; +using System.Runtime; +using System.Runtime.InteropServices; +using Microsoft.Samples.Printing.PrinterExtension.Types; + +namespace Microsoft.Samples.Printing.PrinterExtension +{ + public class PrinterExtensionManager + { + public PrinterExtensionManager() + { + _manager = new PrinterExtensionLib.PrinterExtensionManager(); + } + + #region IPrinterExtensionManager methods + + /// <summary> + /// Maps to COM IPrinterExtensionManager::DisableEvents + /// </summary> + public void DisableEvents() + { + _manager.DisableEvents(); + } + + /// <summary> + /// Maps to COM IPrinterExtensionManager::EnableEvents + /// </summary> + public void EnableEvents(Guid printerDriverId) + { + _manager.EnableEvents(printerDriverId); + } + + /// <summary> + /// Maps to COM IPrinterExtensionEvent::OnDriverEvent + /// </summary> + public event EventHandler<PrinterExtensionEventArgs> OnDriverEvent + { + add + { + if (_onDriverEvent == null) + { + _manager.OnDriverEvent += OnDriverEventReceiver; + } + _onDriverEvent += value; + } + remove + { + _onDriverEvent -= value; + if (_onDriverEvent == null) + { + _manager.OnDriverEvent -= OnDriverEventReceiver; + } + } + } + + /// <summary> + /// Maps to COM IPrinterExtensionEvent::OnPrinterQueuesEnumerated + /// </summary> + public event EventHandler<PrinterQueuesEnumeratedEventArgs> OnPrinterQueuesEnumerated + { + add + { + if (_onPrinterQueuesEnumerated == null) + { + _manager.OnPrinterQueuesEnumerated += OnPrinterQueuesEnumeratedReceiver; + } + _onPrinterQueuesEnumerated += value; + } + remove + { + _onPrinterQueuesEnumerated -= value; + if (_onPrinterQueuesEnumerated == null) + { + _manager.OnPrinterQueuesEnumerated -= OnPrinterQueuesEnumeratedReceiver; + } + } + } + + #endregion + + #region Implementation details + + private void OnDriverEventReceiver(PrinterExtensionLib.IPrinterExtensionEventArgs pEventArgs) + { + if (_onDriverEvent != null) + { + _onDriverEvent(this, new PrinterExtensionEventArgs(pEventArgs)); + } + } + + private void OnPrinterQueuesEnumeratedReceiver(PrinterExtensionLib.IPrinterExtensionContextCollection contextCollection) + { + if (_onPrinterQueuesEnumerated != null) + { + _onPrinterQueuesEnumerated(this, new PrinterQueuesEnumeratedEventArgs(contextCollection)); + } + } + + private event EventHandler<PrinterExtensionEventArgs> _onDriverEvent; + private event EventHandler<PrinterQueuesEnumeratedEventArgs> _onPrinterQueuesEnumerated; + + private PrinterExtensionLib.PrinterExtensionManager _manager; + + #endregion + } +}
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionTypes.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionTypes.cs new file mode 100644 index 00000000..33991cde --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionTypes.cs @@ -0,0 +1,921 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// +// Abstract: +// +// This file defines all types and interfaces that may be used to build a printer +// extension application. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; + +namespace Microsoft.Samples.Printing.PrinterExtension.Types +{ + // + // Enums and Constants + // + /// <summary> + /// Maps to COM PrintSchemaConstrainedSetting + /// </summary> + public enum PrintSchemaConstrainedSetting + { + None = 0, + PrintTicket = 1, + Admin = 2, + Device = 3, + } + + /// <summary> + /// Maps to COM PrintSchemaSelectionType + /// </summary> + public enum PrintSchemaSelectionType + { + PickOne = 0, + PickMany = 1 + } + +#if WINDOWS_81_APIS + /// <summary> + /// Maps to COM PrintSchemaParameterDataType + /// </summary> + public enum PrintSchemaParameterDataType + { + Integer = 0, + NumericString = 1, + String = 2 + } + + /// <summary> + /// Maps to COM PrintJobStatus + /// </summary> + [Flags] + public enum PrintJobStatus + { + Paused = 0x1, + Error = 0x2, + Deleting = 0x4, + Spooling = 0x8, + Printing = 0x10, + Offline = 0x20, + PaperOut = 0x40, + Printed = 0x80, + Deleted = 0x100, + BlockedDeviceQueue = 0x200, + UserIntervention = 0x400, + Restarted = 0x800, + Complete = 0x1000, + Retained = 0x2000, + } +#endif + + public static class PrinterExtensionReason + { + // An Enum was the first choice but the list of Guid is designed to be extendable. + // A read-only property was the second choice however this would have made new copies of the Guid. + // Using a class with static Guids balances both considerations. + + /// <summary> + /// In this mode preferences for a print job or default print preferences is expected to be displayed. + /// Maps to C++ PRINTER_EXTENSION_REASON_PRINT_PREFERENCES + /// </summary> + public static Guid PrintPreferences = new Guid("{EC8F261F-267C-469F-B5D6-3933023C29CC}"); + + + /// <summary> + /// In this mode a status monitor for the print queue is expected to be displayed. + /// Maps to C++ PRINTER_EXTENSION_REASON_DRIVER_EVENT + /// </summary> + public static Guid DriverEvent = new Guid("{23BB1328-63DE-4293-915B-A6A23D929ACB}"); + } + + public static class PrintSchemaConstants + { + /// <summary> + /// The namespace URI for the Print Schema keywords + /// </summary> + public const string KeywordsNamespaceUri = "http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords"; + /// <summary> + /// The namespace URI for the Print Schema keywords V1.1 + /// </summary> + public const string KeywordsV11NamespaceUri = "http://schemas.microsoft.com/windows/2013/05/printing/printschemakeywordsv11"; + /// <summary> + /// The namespace URI for the Print Schema Framework + /// </summary> + public const string FrameworkNamespaceUri = "http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework"; + } + + // + // Interfaces + // + + // The following interfaces are shared between the "Reference" and "Implementation" + // project. These interfaces are the public surface for the adapters that will remain + // internal to the "Implementation" project. It is done this way because the public + // surface and strong name must be the same for "Reference" and "Implementation". + + /// <summary> + /// Maps to COM IPrinterExtensionContext + /// </summary> + public interface IPrinterExtensionContext + { + /// <summary> + /// Maps to COM IPrinterExtensionContext::PrinterQueue + /// </summary> + IPrinterQueue Queue { get; } + + /// <summary> + /// Maps to COM IPrinterExtensionContext::PrintSchemaTicket + /// </summary> + IPrintSchemaTicket Ticket { get; } + + /// <summary> + /// Maps to COM IPrinterExtensionContext::DriverProperties + /// </summary> + IPrinterPropertyBag DriverProperties { get; } + + /// <summary> + /// Maps to COM IPrinterExtensionContext::UserProperties + /// </summary> + IPrinterPropertyBag UserProperties { get; } + } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs + /// </summary> + public interface IPrinterExtensionEventArgs : IPrinterExtensionContext + { + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::BidiNotification + /// </summary> + string BidiNotification { get; } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::ReasonId + /// </summary> + Guid ReasonId { get; } + + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::Request + /// </summary> + IPrinterExtensionRequest Request { get; } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::SourceApplication + /// </summary> + string SourceApplication { get; } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::DetailedReasonId + /// </summary> + Guid DetailedReasonId { get; } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::WindowModal + /// </summary> + bool WindowModal { get; } + + /// <summary> + /// Maps to COM IPrinterExtensionEventArgs::WindowParent + /// </summary> + IntPtr WindowParent { get; } + } + +#if WINDOWS_81_APIS + /// <summary> + /// Maps to COM IPrinterExtensionAsyncOperation + /// </summary> + public interface IPrinterExtensionAsyncOperation + { + /// <summary> + /// Maps to COM IPrinterExtensionAsyncOperation::Cancel + /// </summary> + void Cancel(); + } +#endif + + /// <summary> + /// Maps to COM IPrintSchemaElement + /// </summary> + public interface IPrintSchemaElement + { + /// <summary> + /// Maps to COM IPrintSchemaElement::Name + /// </summary> + string Name { get; } + + /// <summary> + /// Maps to COM IPrintSchemaElement::NamespaceUri + /// </summary> + string XmlNamespace { get; } + } + + /// <summary> + /// Maps to COM IPrintSchemaDisplayableElement + /// </summary> + public interface IPrintSchemaDisplayableElement : IPrintSchemaElement + { + /// <summary> + /// Maps to COM IPrintSchemaDisplayableElement::DisplayName + /// </summary> + string DisplayName { get; } + } + + /// <summary> + /// Maps to COM IPrintSchemaOption + /// </summary> + public interface IPrintSchemaOption : IPrintSchemaDisplayableElement + { + /// <summary> + /// Maps to COM IPrintSchemaOption::Selected + /// </summary> + bool Selected { get; } + + /// <summary> + /// Maps to COM IPrintSchemaOption::Constrained + /// </summary> + PrintSchemaConstrainedSetting Constrained { get; } + } + + /// <summary> + /// Maps to COM IPrintSchemaPageMediaSizeOption + /// </summary> + public interface IPrintSchemaPageMediaSizeOption : IPrintSchemaOption + { + /// <summary> + /// Maps to COM IPrintSchemaPageMediaSizeOption::HeightInMicrons + /// </summary> + uint HeightInMicrons { get; } + + /// <summary> + /// Maps to COM IPrintSchemaPageMediaSizeOption::WidthInMicrons + /// </summary> + uint WidthInMicrons { get; } + } + + /// <summary> + /// Maps to COM IPrintSchemaNUpOption + /// </summary> + public interface IPrintSchemaNUpOption : IPrintSchemaOption + { + /// <summary> + /// Maps to COM IPrintSchemaNUpOption::PagesPerSheet + /// </summary> + uint PagesPerSheet { get; } + } + + /// <summary> + /// Maps to COM IPrintSchemaFeature + /// </summary> + public interface IPrintSchemaFeature : IPrintSchemaDisplayableElement + { + /// <summary> + /// Maps to COM IPrintSchemaFeature::SelectedOption + /// </summary> + IPrintSchemaOption SelectedOption { get; set; } + + /// <summary> + /// Maps to COM IPrintSchemaFeature::SelectionType + /// </summary> + PrintSchemaSelectionType SelectionType { get; } + + /// <summary> + /// Maps to COM IPrintSchemaFeature::GetOption + /// </summary> + IPrintSchemaOption GetOption(string optionName); + + /// <summary> + /// Maps to COM IPrintSchemaFeature::GetOption + /// </summary> + IPrintSchemaOption GetOption(string optionName, string xmlNamespace); + + /// <summary> + /// Maps to COM IPrintSchemaFeature::DisplayUI + /// </summary> + bool DisplayUI { get; } + } + + /// <summary> + /// Maps to COM IPrintSchemaPageImageableSize + /// </summary> + public interface IPrintSchemaPageImageableSize : IPrintSchemaElement + { + /// <summary> + /// Maps to COM IPrintSchemaPageImageableSize::ExtentHeightInMicrons + /// </summary> + uint ExtentHeightInMicrons { get; } + + /// <summary> + /// Maps to COM IPrintSchemaPageImageableSize::ExtentWidthInMicrons + /// </summary> + uint ExtentWidthInMicrons { get; } + + /// <summary> + /// Maps to COM IPrintSchemaPageImageableSize::ImageableSizeHeightInMicrons + /// </summary> + uint ImageableSizeHeightInMicrons { get; } + + /// <summary> + /// Maps to COM IPrintSchemaPageImageableSize::ImageableSizeWidthInMicrons + /// </summary> + uint ImageableSizeWidthInMicrons { get; } + + /// <summary> + /// Maps to COM IPrintSchemaPageImageableSize::OriginHeightInMicrons + /// </summary> + uint OriginHeightInMicrons { get; } + + /// <summary> + /// Maps to COM IPrintSchemaPageImageableSize::OriginWidthInMicrons + /// </summary> + uint OriginWidthInMicrons { get; } + } + +#if WINDOWS_81_APIS + /// <summary> + /// Maps to COM IPrintSchemaParameterDefinition + /// </summary> + public interface IPrintSchemaParameterDefinition : IPrintSchemaDisplayableElement + { + /// <summary> + /// Maps to COM IPrintSchemaParameterDefinition::UserInputRequired + /// </summary> + bool UserInputRequired { get; } + + /// <summary> + /// Maps to COM IPrintSchemaParameterDefinition::UnitType + /// </summary> + string UnitType { get; } + + /// <summary> + /// Maps to COM IPrintSchemaParameterDefinition::DataType + /// </summary> + PrintSchemaParameterDataType DataType { get; } + + /// <summary> + /// Maps to COM IPrintSchemaParameterDefinition::RangeMin + /// </summary> + int RangeMin { get; } + + /// <summary> + /// Maps to COM IPrintSchemaParameterDefinition::RangeMax + /// </summary> + int RangeMax { get; } + } + + /// <summary> + /// Maps to COM IPrintSchemaParameterInitializer + /// </summary> + public interface IPrintSchemaParameterInitializer : IPrintSchemaElement + { + /// <summary> + /// Maps to COM IPrintSchemaParameterInitializer::Value + /// </summary> + string StringValue { get; set; } + /// <summary> + /// Maps to COM IPrintSchemaParameterInitializer::Value + /// </summary> + int IntegerValue { get; set; } + } +#endif + + /// <summary> + /// Maps to COM IPrintSchemaCapabilities + /// </summary> + public interface IPrintSchemaCapabilities + { + /// <summary> + /// Maps to COM IPrintSchemaCapabilities::GetFeatureByKeyName + /// </summary> + IPrintSchemaFeature GetFeatureByKeyName(string keyName); + + /// <summary> + /// Maps to COM IPrintSchemaCapabilities::GetFeature + /// </summary> + IPrintSchemaFeature GetFeature(string featureName); + + /// <summary> + /// Maps to COM IPrintSchemaCapabilities::GetFeature + /// </summary> + IPrintSchemaFeature GetFeature(string featureName, string xmlNamespace); + + /// <summary> + /// Maps to COM IPrintSchemaCapabilities::PageImageableSize + /// </summary> + IPrintSchemaPageImageableSize PageImageableSize { get; } + + /// <summary> + /// Maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMinValue + /// </summary> + uint JobCopiesAllDocumentsMaxValue { get; } + + /// <summary> + /// Maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMaxValue + /// </summary> + uint JobCopiesAllDocumentsMinValue { get; } + + /// <summary> + /// Maps to COM IPrintSchemaCapabilities::GetSelectedOptionInPrintTicket + /// </summary> + IPrintSchemaOption GetSelectedOptionInPrintTicket(IPrintSchemaFeature feature); + + /// <summary> + /// Maps to COM IPrintSchemaCapabilities::GetOptions + /// </summary> + IEnumerable<IPrintSchemaOption> GetOptions(IPrintSchemaFeature feature); + + /// <summary> + /// Replaces COM IPrintSchemaCapabilities::XmlNode + /// </summary> + Stream GetReadStream(); + + /// <summary> + /// Replaces COM IPrintSchemaCapabilities::XmlNode + /// </summary> + Stream GetWriteStream(); + +#if WINDOWS_81_APIS + /// <summary> + /// Maps to COM IPrintSchemaCapabilities2::GetParameterDefinition + /// </summary> + IPrintSchemaParameterDefinition GetParameterDefinition(string parameterName); + + /// <summary> + /// Maps to COM IPrintSchemaCapabilities2::GetParameterDefinition + /// </summary> + IPrintSchemaParameterDefinition GetParameterDefinition(string parameterName, string xmlNamespace); +#endif + } + + /// <summary> + /// The EventArgs for the PrintSchemaAsyncOperation + /// Maps to COM IPrintSchemaAsyncOperationEvent + /// </summary> + public class PrintSchemaAsyncOperationEventArgs : EventArgs + { + // + // Event arguments + // + /// <summary> + /// Maps to COM IPrintSchemaAsyncOperationEvent::Completed, parameter 'hrOperation' + /// </summary> + public int StatusHResult { get { return _statusHResult; } } + + /// <summary> + /// Maps to COM IPrintSchemaAsyncOperationEvent::Completed, parameter 'pTicket' + /// </summary> + public IPrintSchemaTicket Ticket { get { return _printTicket; } } + + // + // Implementation details + // + internal PrintSchemaAsyncOperationEventArgs(IPrintSchemaTicket printTicket, int statusHResult) + { + _statusHResult = statusHResult; + _printTicket = printTicket; + } + + private int _statusHResult; + private IPrintSchemaTicket _printTicket; + } + + /// <summary> + /// Maps to COM IPrintSchemaAsyncOperation + /// </summary> + public interface IPrintSchemaAsyncOperation + { + /// <summary> + /// Maps to COM IPrintSchemaAsyncOperationEvent::Completed + /// </summary> + event EventHandler<PrintSchemaAsyncOperationEventArgs> Completed; + + /// <summary> + /// Maps to COM IPrintSchemaAsyncOperation::Start + /// </summary> + void Start(); + + /// <summary> + /// Maps to COM IPrintSchemaAsyncOperation::Cancel + /// </summary> + void Cancel(); + } + + /// <summary> + /// Maps to COM IPrintSchemaTicket + /// </summary> + public interface IPrintSchemaTicket + { + /// <summary> + /// Maps to COM IPrintSchemaTicket::GetFeatureByKeyName + /// </summary> + IPrintSchemaFeature GetFeatureByKeyName(string featureName); + + /// <summary> + /// Maps to COM IPrintSchemaTicket::GetFeature + /// </summary> + IPrintSchemaFeature GetFeature(string featureName); + + /// <summary> + /// Maps to COM IPrintSchemaTicket::GetFeature + /// </summary> + IPrintSchemaFeature GetFeature(string featureName, string xmlNamespace); + + /// <summary> + /// Maps to COM IPrintSchemaTicket::ValidateAsync + /// </summary> + IPrintSchemaAsyncOperation ValidateAsync(); + + /// <summary> + /// Maps to COM IPrintSchemaTicket::CommitAsync + /// </summary> + IPrintSchemaAsyncOperation CommitAsync(IPrintSchemaTicket printTicketCommit); + + /// <summary> + /// Maps to COM IPrintSchemaTicket::NotifyXmlChanged + /// </summary> + void NotifyXmlChanged(); + + /// <summary> + /// Maps to COM IPrintSchemaTicket::GetCapabilities + /// </summary> + IPrintSchemaCapabilities GetCapabilities(); + + /// <summary> + /// Maps to COM IPrintSchemaTicket::JobCopiesAllDocuments + /// </summary> + uint JobCopiesAllDocuments { get; set; } + + /// <summary> + /// Replaces COM IPrintSchemaTicket::XmlNode + /// </summary> + Stream GetReadStream(); + + /// <summary> + /// Replaces COM IPrintSchemaTicket::XmlNode + /// </summary> + Stream GetWriteStream(); + +#if WINDOWS_81_APIS + /// <summary> + /// Maps to COM IPrintSchemaTicket2::GetParameterInitializer + /// </summary> + IPrintSchemaParameterInitializer GetParameterInitializer(string parameterName); + + /// <summary> + /// Maps to COM IPrintSchemaTicket2::GetParameterInitializer + /// </summary> + IPrintSchemaParameterInitializer GetParameterInitializer(string parameterName, string xmlNamespace); +#endif + } + + /// <summary> + /// Maps to COM IPrinterPropertyBag + /// </summary> + public interface IPrinterPropertyBag + { + /// <summary> + /// Maps to COM IPrinterPropertyBag::GetBool + /// </summary> + bool GetBool(string propertyName); + + /// <summary> + /// Maps to COM IPrinterPropertyBag::SetBool + /// </summary> + void SetBool(string propertyName, bool value); + + /// <summary> + /// Maps to COM IPrinterPropertyBag::GetInt32 + /// </summary> + int GetInt(string propertyName); + + /// <summary> + /// Maps to COM IPrinterPropertyBag::SetInt32 + /// </summary> + void SetInt(string propertyName, int value); + + /// <summary> + /// Maps to COM IPrinterPropertyBag::GetString + /// </summary> + string GetString(string propertyName); + + /// <summary> + /// Maps to COM IPrinterPropertyBag::SetString + /// </summary> + void SetString(string propertyName, string value); + + /// <summary> + /// Maps to COM IPrinterPropertyBag::GetBytes + /// </summary> + byte[] GetBytes(string propertyName); + + /// <summary> + /// Maps to COM IPrinterPropertyBag::SetBytes + /// </summary> + void SetBytes(string propertyName, byte[] value); + + /// <summary> + /// Maps to COM IPrinterPropertyBag::GetReadStream + /// </summary> + Stream GetReadStream(string propertyName); + + /// <summary> + /// Maps to COM IPrinterPropertyBag::GetWriteStream + /// </summary> + Stream GetWriteStream(string propertyName); + + /// <summary> + /// Indexer for the properties + /// </summary> + /// <param name="name">Property name</param> + /// <returns>An instance of 'PrinterProperty' used to get/set values</returns> + PrinterProperty this[string name] { get; } + } + + /// <summary> + /// Represents one property returned by the indexer in IPrinterPropertyBag + /// </summary> + public class PrinterProperty + { + internal PrinterProperty(IPrinterPropertyBag bag, string name) + { + _bag = bag; + _name = name; + } + + /// <summary> + /// Prevents default construction + /// </summary> + private PrinterProperty() + { + } + + /// <summary> + /// Get/Set a value of type 'bool' + /// </summary> + public bool Bool + { + get { return _bag.GetBool(_name); } + set { _bag.SetBool(_name, value); } + } + + /// <summary> + /// Get/Set a value of type 'Int32' + /// </summary> + public int Int + { + get { return _bag.GetInt(_name); } + set { _bag.SetInt(_name, value); } + } + + /// <summary> + /// Get/Set a value of type 'byte[]' + /// </summary> + public byte[] Bytes + { + get { return _bag.GetBytes(_name); } + set { _bag.SetBytes(_name, value); } + } + + /// <summary> + /// Get/Set a value of type 'string' + /// </summary> + public string String + { + get { return _bag.GetString(_name); } + set { _bag.SetString(_name, value); } + } + + /// <summary> + /// Get a read/write Stream corresponding to this property name + /// </summary> + public Stream WriteStream + { + get { return _bag.GetWriteStream(_name); } + } + + /// <summary> + /// Get a read-only Stream corresponding to this property name + /// </summary> + public Stream ReadStream + { + get { return _bag.GetReadStream(_name); } + } + + // + // Implementation details + // + private IPrinterPropertyBag _bag; + private string _name; + } + +#if WINDOWS_81_APIS + /// <summary> + /// Maps to COM IPrintJob + /// </summary> + public interface IPrintJob + { + /// <summary> + /// Maps to COM IPrintJob::Name + /// </summary> + string Name { get; } + + /// <summary> + /// Maps to COM IPrintJob::Id + /// </summary> + ulong Id { get; } + + /// <summary> + /// Maps to COM IPrintJob::PrintedPages + /// </summary> + ulong PrintedPages { get; } + + /// <summary> + /// Maps to COM IPrintJob::TotalPages + /// </summary> + ulong TotalPages { get; } + + /// <summary> + /// Maps to COM IPrintJob::Status + /// </summary> + PrintJobStatus Status { get; } + + /// <summary> + /// Maps to COM IPrintJob::SubmissionTime + /// </summary> + DateTime SubmissionTime { get; } + + /// <summary> + /// Maps to COM IPrintJob::RequestCancel + /// </summary> + void RequestCancel(); + } + + /// <summary> + /// Maps to COM IPrinterQueueViewEvent + /// </summary> + public class PrinterQueueViewEventArgs : EventArgs + { + /// <summary> + /// Maps to COM IPrinterQueueViewEvent::OnChanged, parameter 'pCollection' + /// </summary> + public IEnumerable<IPrintJob> Collection { get { return _collection; } } + + /// <summary> + /// Maps to COM IPrinterQueueViewEvent::OnChanged, parameter 'ulViewOffset' + /// </summary> + public uint ViewOffset { get { return _viewOffset; } } + + /// <summary> + /// Maps to COM IPrinterQueueViewEvent::OnChanged, parameter 'ulViewSize' + /// </summary> + public uint ViewSize { get { return _viewSize; } } + + /// <summary> + /// Maps to COM IPrinterQueueViewEvent::OnChanged, parameter 'ulCountJobsInPrintQueue' + /// </summary> + public uint CountJobsInPrintQueue { get { return _countJobsInPrintQueue; } } + + #region Implementation details + + internal PrinterQueueViewEventArgs(IEnumerable<IPrintJob> collection, uint viewOffset, uint viewSize, uint countJobsInPrintQueue) + { + _collection = collection; + _viewOffset = viewOffset; + _viewSize = viewSize; + _countJobsInPrintQueue = countJobsInPrintQueue; + } + + private IEnumerable<IPrintJob> _collection; + private uint _viewOffset; + private uint _viewSize; + private uint _countJobsInPrintQueue; + + #endregion + } + + /// <summary> + /// Maps to COM IPrinterQueueView + /// </summary> + public interface IPrinterQueueView + { + /// <summary> + /// Maps to COM IPrinterQueueView::SetViewRange + /// </summary> + void SetViewRange(uint viewOffset, uint viewSize); + + /// <summary> + /// Maps to COM IPrinterQueueViewEvent::OnChanged + /// </summary> + event EventHandler<PrinterQueueViewEventArgs> OnChanged; + } + + /// <summary> + /// Maps to COM IPrinterBidiSetRequestCallback + /// </summary> + public interface IPrinterBidiSetRequestCallback + { + /// <summary> + /// Maps to COM IPrinterBidiSetRequestCallback::Completed + /// </summary> + void Completed(string response, int statusHResult); + } +#endif + + /// <summary> + /// Maps to COM IPrinterQueueEvent + /// </summary> + public class PrinterQueueEventArgs : EventArgs + { + /// <summary> + /// Maps to COM IPrinterQueueEvent::OnBidiResponseReceived, parameter 'bstrResponse' + /// </summary> + public string Response { get { return _response; } } + + /// <summary> + /// Maps to COM IPrinterQueueEvent::OnBidiResponseReceived, parameter 'hrStatus' + /// </summary> + public int StatusHResult { get { return _statusHResult; } } + + // + // Implementation details + // + public PrinterQueueEventArgs(string response, int statusHResult) + { + _response = response; + _statusHResult = statusHResult; + } + + private int _statusHResult; + private string _response; + } + + /// <summary> + /// Maps to COM IPrinterQueue + /// </summary> + public interface IPrinterQueue + { + /// <summary> + /// Maps to COM IPrinterQueue::Handle + /// </summary> + IntPtr Handle { get; } + + /// <summary> + /// Maps to COM IPrinterQueue::Name + /// </summary> + string Name { get; } + + /// <summary> + /// Maps to COM IPrinterQueue::SendBidiQuery + /// </summary> + void SendBidiQuery(string bidiQuery); + + /// <summary> + /// Maps to COM IPrinterQueue::GetProperties + /// </summary> + IPrinterPropertyBag GetProperties(); + +#if WINDOWS_81_APIS + /// <summary> + /// Maps to COM IPrinterQueue2::SendBidiSetRequestAsync + /// </summary> + /// <param name="callback">Maps to COM callback type IPrinterBidiSetRequestCallback</param> + /// <returns>IPrinterExtensionAsyncOperation - async operation context</returns> + IPrinterExtensionAsyncOperation SendBidiSetRequestAsync(string bidiRequest, IPrinterBidiSetRequestCallback callback); + + /// <summary> + /// Maps to COM IPrinterQueue2::GetPrinterQueueView + /// </summary> + IPrinterQueueView GetPrinterQueueView(uint viewOffset, uint viewSize); +#endif + + /// <summary> + /// Maps to COM IPrinterQueueEvent::OnBidiResponseReceived + /// </summary> + event EventHandler<PrinterQueueEventArgs> OnBidiResponseReceived; + } + + /// <summary> + /// Maps to COM IPrinterExtensionRequest + /// </summary> + public interface IPrinterExtensionRequest + { + /// <summary> + /// Maps to COM IPrinterExtensionRequest::Complete + /// </summary> + void Complete(); + + /// <summary> + /// Maps to COM IPrinterExtensionRequest::Cancel + /// </summary> + void Cancel(int statusHResult, string logMessage); + } +} + diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/Properties/AssemblyInfo.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..8b42d1af --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft.Samples.Printing.PrinterExtensionLibrary")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyProduct("Microsoft.Samples.Printing.PrinterExtensionLibrary")] +[assembly: AssemblyCopyright("Copyright (c) 2011 Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionSample.sln b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionSample.sln new file mode 100644 index 00000000..5573b670 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionSample.sln @@ -0,0 +1,86 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExtensionSample", "ExtensionSample", "{EAF81F7A-957C-4C1F-A2ED-5A9FE3DAEA77}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PrinterExtensionLibrary", "PrinterExtensionLibrary", "{D86B51AE-7E8E-4A5B-947B-02BD9CA9A176}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrinterExtensionSample", "ExtensionSample\PrinterExtensionSample.csproj", "{CF554A99-6889-4B86-934F-B6AADBFEFC01}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrinterExtensionLibrary", "PrinterExtensionLibrary\PrinterExtensionLibrary.csproj", "{D8DA0C4D-F972-4546-9068-8EB256F222F7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Win8 Debug|x86 = Win8 Debug|x86 + Win8 Debug|x64 = Win8 Debug|x64 + Win8 Release|x86 = Win8 Release|x86 + Win8 Release|x64 = Win8 Release|x64 + Win8.1 Debug|x86 = Win8.1 Debug|x86 + Win8.1 Debug|x64 = Win8.1 Debug|x64 + Win8.1 Release|x86 = Win8.1 Release|x86 + Win8.1 Release|x64 = Win8.1 Release|x64 + Win8 Debug|Any CPU = Win8 Debug|Any CPU + Win8 Release|Any CPU = Win8 Release|Any CPU + Win8.1 Debug|Any CPU = Win8.1 Debug|Any CPU + Win8.1 Release|Any CPU = Win8.1 Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|x86.ActiveCfg = Win8 Debug|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|x86.Build.0 = Win8 Debug|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|x86.ActiveCfg = Win8 Release|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|x86.Build.0 = Win8 Release|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|x64.Build.0 = Win8 Release|x64 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|x86.ActiveCfg = Win8.1 Debug|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|x86.Build.0 = Win8.1 Debug|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|x86.ActiveCfg = Win8.1 Release|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|x86.Build.0 = Win8.1 Release|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|Any CPU.ActiveCfg = Win8 Debug|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|Any CPU.Build.0 = Win8 Debug|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|Any CPU.ActiveCfg = Win8 Release|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|Any CPU.Build.0 = Win8 Release|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|Any CPU.ActiveCfg = Win8.1 Debug|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|Any CPU.Build.0 = Win8.1 Debug|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|Any CPU.ActiveCfg = Win8.1 Release|x86 + {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|Any CPU.Build.0 = Win8.1 Release|x86 + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|x86.ActiveCfg = Win8 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|x86.Build.0 = Win8 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|x64.ActiveCfg = Win8 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|x64.Build.0 = Win8 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|x86.ActiveCfg = Win8 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|x86.Build.0 = Win8 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|x64.ActiveCfg = Win8 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|x64.Build.0 = Win8 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|x86.ActiveCfg = Win8.1 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|x86.Build.0 = Win8.1 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|x86.ActiveCfg = Win8.1 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|x86.Build.0 = Win8.1 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|x64.Build.0 = Win8.1 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|Any CPU.ActiveCfg = Win8 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|Any CPU.Build.0 = Win8 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|Any CPU.ActiveCfg = Win8 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|Any CPU.Build.0 = Win8 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|Any CPU.ActiveCfg = Win8.1 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|Any CPU.Build.0 = Win8.1 Debug|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|Any CPU.ActiveCfg = Win8.1 Release|Any CPU + {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|Any CPU.Build.0 = Win8.1 Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {CF554A99-6889-4B86-934F-B6AADBFEFC01} = {EAF81F7A-957C-4C1F-A2ED-5A9FE3DAEA77} + {D8DA0C4D-F972-4546-9068-8EB256F222F7} = {D86B51AE-7E8E-4A5B-947B-02BD9CA9A176} + EndGlobalSection +EndGlobal diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ReadMe.md b/print/v4PrintDriverSamples/PrinterExtensionSample/ReadMe.md new file mode 100644 index 00000000..e7ab1d25 --- /dev/null +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/ReadMe.md @@ -0,0 +1,14 @@ +Printer Extension Sample +======================== + +This sample demonstrates how to use .NET to build a customized, desktop UI for a v4 print driver. This .NET app uses PrintTicket, PrintCapabilities and Bidi in order to communicate with the print system and is suitable for inclusion in a v4 print driver. + +**Note** This sample is for the v4 print driver model. + +Related topics +-------------- + +[Building a Driver](http://msdn.microsoft.com/en-us/library/windows/hardware/ff554644) + +[v4 Print Driver Interfaces and Enumerations](http://msdn.microsoft.com/en-us/library/hh464103(v=vs.85).aspx) + diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js new file mode 100644 index 00000000..0605efff --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js @@ -0,0 +1,679 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// ConstraintScript.js +// +// Abstract: +// +// Sample Javascript constraints file for v4 printer drivers. + +// +// Declaration of various enums/constants that may be useful when modifying this sample. +// + +// Add a reference that provides intellisense +/// <reference path="v4PrintDriver-Intellisense.js" /> + +// -------------------------------------------------------------------------- +// Note: To disable intellisense for Windows 8.1 APIs, please delete the line below +/// <reference path="v4PrintDriver-Intellisense-Windows8.1.js" /> +// -------------------------------------------------------------------------- + +var psfPrefix = "psf"; +var pskNs = "http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords"; +var pskV11Ns = "http://schemas.microsoft.com/windows/2013/05/printing/printschemakeywordsv11"; +var psfNs = "http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework"; + +var PrintSchemaConstrainedSetting = { + PrintSchemaConstrainedSetting_None: 0, + PrintSchemaConstrainedSetting_PrintTicket: 1, + PrintSchemaConstrainedSetting_Admin: 2, + PrintSchemaConstrainedSetting_Device: 3 +}; + +var PrintSchemaParameterDataType = { + PrintSchemaParameterDataType_Integer: 0, + PrintSchemaParameterDataType_NumericString: 1, + PrintSchemaParameterDataType_String: 2 +}; + +var STREAM_SEEK = { + STREAM_SEEK_SET: 0, + STREAM_SEEK_CUR: 1, + STREAM_SEEK_END: 2 +}; + +var PrintSchemaSelectionType = { + PrintSchemaSelectionType_PickOne: 0, + PrintSchemaSelectionType_PickMany: 1 +}; + +function validatePrintTicket(printTicket, scriptContext) { + /// <summary> + /// Validates a print ticket. + /// + /// This example expresses the constraint that if 'ISOA4' PageMediaSize is selected, + /// the 'PhotographicGlossy' PageMediaType has to be selected. + /// Should another 'PageMediaType' option be selected, this method sets the selected option's name + /// to 'PhotographicGlossy' and indicates that the print ticket was modified to make it valid. + /// </summary> + /// <param name="printTicket" type="IPrintSchemaTicket"> + /// Print ticket to be validated. + /// </param> + /// <param name="scriptContext" type="IPrinterScriptContext"> + /// Script context object. + /// </param> + /// <returns type="Number" integer="true"> + /// Integer value indicating validation status. + /// 1 - Print ticket is valid and was not modified. + /// 2 - Print ticket was modified to make it valid. + /// 0 - Print ticket is invalid (not demonstrated by this example). + /// </returns> + + var retVal = 1; + + // Set the selection namespace on the printTicket's XmlNode. This instance allows us to query for + // nodes belonging to the 'pskNs' namespace. + setSelectionNamespace( + printTicket.XmlNode, + psfPrefix, + psfNs); + + // If the print ticket has an invalid combination of PageMediaSize and PageMediaType options, fix it, + // and return '2' to indicate the print ticket has been modified. + if (constraintSample.isMediaTypeConstrainedByMediaSize(printTicket)) { + var printTicketMediaTypeFeature = printTicket.GetFeature("PageMediaType"); + + var pskPrefix = getPrefixForNamespace( + printTicket.XmlNode, + pskNs); + + // Retrieve the only allowed 'PageMediaType' option, from the print capabilities. + // Note: Retrieving the print capabilities is a very expensive operation, and should be performed only if necessary. + var printCapabilities = printTicket.GetCapabilities(); + var printCapsMediaTypeFeature = printCapabilities.GetFeature("PageMediaType"); + var allowedPageMediaTypeOption = printCapsMediaTypeFeature.GetOption(constraintSample.allowedPageMediaType); + + // Replace the constrained print ticket option with the allowed one. + printTicketMediaTypeFeature.SelectedOption = allowedPageMediaTypeOption; + + retVal = 2; + } + + // Below demonstrates correct usage of IPrintSchemaTicket2 APIs so that the script does not terminate + // when running on a Windows 8 version of PrintConfig.dll. + if (printSchemaApiHelpers.supportsIPrintSchemaTicket2(printTicket)) { + var param = printTicket.GetParameterInitializer("JobCopiesAllDocuments"); + } + + return retVal; +} + + +function completePrintCapabilities(printTicket, scriptContext, printCapabilities) { + /// <summary> + /// This example demonstrates how drivers can alter the print capabilities' 'PageImageableSize' values + /// based on a 'PageBorderless' feature, or based on 'PageOrientation'. + /// + /// What this example does: + /// + /// 1. Retrieve the 'PageOrientation' feature from the print ticket. + /// 2. Retrieve the 'PageBorderless' feature from the print ticket. + /// 3. If 'Landscape' is the selected option for the 'PageOrientation' feature, + /// set custom 'PageImageableSize' margins in the print capabilities document. + /// 4. Else if 'PageBorderless' is the selected option for the 'PageBorderless' feature, + /// set custom 'PageImageableSize' margins in the print capabilities. + /// </summary> + /// <param name="printTicket" type="IPrintSchemaTicket" mayBeNull="true"> + /// If not 'null', the print ticket's settings are used to customize the print capabilities. + /// </param> + /// <param name="scriptContext" type="IPrinterScriptContext"> + /// Script context object. + /// </param> + /// <param name="printCapabilities" type="IPrintSchemaCapabilities"> + /// Print capabilities object to be customized. + /// </param> + + // This sample does not customize the default print capabilities (i.e. when no print ticket is passed in). + if (!printTicket) { + return; + } + + // Below demonstrates correct usage of IPrintSchemaCapabilities2 APIs so that the script does not terminate + // when running on a Windows 8 version of PrintConfig.dll. + if (printSchemaApiHelpers.supportsIPrintSchemaCapabilities2(printCapabilities)) { + var param = printCapabilities.GetParameterDefinition("JobCopiesAllDocuments"); + } + + setSelectionNamespace( + printTicket.XmlNode, + psfPrefix, + psfNs); + + setSelectionNamespace( + printCapabilities.XmlNode, + psfPrefix, + psfNs); + + var ticketPskPrefix = getPrefixForNamespace(printTicket.XmlNode, pskNs); + + // Check the if 'Borderless' is the selected option for the 'PageBorderless' + // Feature in the print ticket. + var isBorderlessPrinting = false; + var borderlessFeatureXmlNode = printTicket.GetFeature("PageBorderless"); + if (borderlessFeatureXmlNode) { + var borderlessOptionName = borderlessFeatureXmlNode.SelectedOption.Name; + if (borderlessOptionName === "Borderless") { + isBorderlessPrinting = true; + } + } + + // Similarly check if 'Landscape' is the selected option for the 'PageOrientation' + // Feature in the print ticket. + var isLandscapeOrientation = false; + var orientationFeature = printTicket.GetFeature("PageOrientation"); + if (orientationFeature) { + var orientationOptionName = orientationFeature.SelectedOption.Name; + if (orientationOptionName === "Landscape") { + isLandscapeOrientation = true; + } + } + + var imageableSizeProperty = null; + var imageableAreaProperty = null; + + // Adjust the 'PageImageableSize' values depending on whether this is borderless + // printing or landscape orientation. + if (isLandscapeOrientation) { + // Custom values for print capabilities properties 'OriginWidth' and 'OriginHeight'. + var originWidth = 5001; + var originHeight = 5001; + + // Set the 'PageImageableArea' margin property values in the print capabilities document. + imageableSizeProperty = getProperty( + printCapabilities.XmlNode, + pskNs, + "PageImageableSize"); + imageableAreaProperty = getProperty( + imageableSizeProperty, + pskNs, + "ImageableArea"); + setSubPropertyValue( + imageableAreaProperty, + pskNs, + "OriginWidth", + originWidth); + setSubPropertyValue( + imageableAreaProperty, + pskNs, + "OriginHeight", + originHeight); + } else if (isBorderlessPrinting) { + // Retrieve the 'PageMediaSize' feature from the print ticket. Retrieve the ScoredProperties + // 'MediaSizeWidth', 'MediaSizeHeight' from that feature, and use these values to set the + // 'PageImageableSize' margins in the print capabilities document. + var pageMediaSizeFeature = printTicket.GetFeature("PageMediaSize"); + if (!pageMediaSizeFeature) { + return; + } + + var pageMediaSizeSelectedOption = pageMediaSizeFeature.SelectedOption; + if (!pageMediaSizeSelectedOption) { + return; + } + + var mediaWidthValueNode = pageMediaSizeSelectedOption.GetPropertyValue("MediaSizeWidth"); + var mediaHeightValueNode = pageMediaSizeSelectedOption.GetPropertyValue("MediaSizeHeight"); + var mediaSizeWidth = mediaWidthValueNode.firstChild.nodeValue; + var mediaSizeHeight = mediaHeightValueNode.firstChild.nodeValue; + + // Set the values for the 'PageImageableSize' property in the print capabilities document. + imageableSizeProperty = getProperty( + printCapabilities.XmlNode, + pskNs, + "PageImageableSize"); + imageableAreaProperty = getProperty( + imageableSizeProperty, + pskNs, + "ImageableArea"); + setSubPropertyValue( + imageableAreaProperty, + pskNs, + "OriginWidth", + 0); + setSubPropertyValue( + imageableAreaProperty, + pskNs, + "OriginHeight", + 0); + setSubPropertyValue( + imageableAreaProperty, + pskNs, + "ExtentHeight", + parseInt( + mediaSizeHeight)); + setSubPropertyValue( + imageableAreaProperty, + pskNs, + "ExtentWidth", + parseInt( + mediaSizeWidth)); + } + + // If the input print ticket has disallowed PageMediaSize and PageMediaType options + // (as expressed in 'validatePrintTicket' function above), mark the constrained options as 'constrained by + // print ticket settings' i.e. 'psk:PrintTicketSettings'. + if (constraintSample.isMediaTypeConstrainedByMediaSize(printTicket)) { + var mediaTypeFeature = printTicket.GetFeature("PageMediaType"); + var mediaTypeOptions = printCapabilities.GetOptions(mediaTypeFeature); + + for (i = 0; i < mediaTypeOptions.Count; i++) { + var mediaTypeOption = mediaTypeOptions.GetAt(i); + + // The only option that is not constrained, as expressed in 'validatePrintTicket' function above. + if ((mediaTypeOption.Name === constraintSample.allowedPageMediaType) && + (mediaTypeOption.NamespaceUri === pskNs)) { + continue; + } + + // If an option is already marked constrained, there is no need to mark it once again. + if (!mediaTypeOption.Constrained) { + var pskPrefix = getPrefixForNamespace( + printTicket.XmlNode, + pskNs); + + mediaTypeOption.XmlNode.setAttribute("constrained", pskPrefix + ":PrintTicketSettings"); + } + } + } +} + +// Demonstrates a simple example of how to express print ticket constraints via the +// 'validatePrintTicket' and 'completePrintCapabilities' extension functions. +var constraintSample = { + // The PageMediaSize option that constrains/limits the allowed PageMediaType options. + constrainingMediaSize : "ISOA4", + + // The only PageMediaType option that not constrained by the constraining PageMediaSize option. + allowedPageMediaType : "PhotographicGlossy", + + isMediaTypeConstrainedByMediaSize : function(printTicket) { + /// <summary> + /// Determines if a print ticket is constrained (i.e. if the 'constrainingMediaSize' PageMediaSize option is + /// present, and constrains the PageMediaType option present in the print ticket). + /// </summary> + /// <param name="printTicket" type="IPrintSchemaTicket"> + /// Print ticket to be checked for constrained options. + /// </param> + /// <returns type="Boolean"> + /// true - PageMediaType option and PageMediaSize option are incompatible. + /// false - PageMediaType option and PageMediaSize option are compatible. + /// </returns> + + // Retrieve the "PageMediaSize", "PageMediaType" features and their selected option names + // from the print ticket. + var mediaSizeFeature = printTicket.GetFeature("PageMediaSize"); + var mediaTypeFeature = printTicket.GetFeature("PageMediaType"); + + if (mediaSizeFeature && mediaTypeFeature) { + // Verify if the PageMediaSize selected option is 'psk:ISOA4'. + var mediaSizeOptionNamespaceUri = mediaSizeFeature.SelectedOption.NamespaceUri; + var mediaSizeOptionName = mediaSizeFeature.SelectedOption.Name; + + if ((mediaSizeOptionNamespaceUri === pskNs) && + (mediaSizeOptionName === constraintSample.constrainingMediaSize)) { + + var mediaTypeOptionNamespaceUri = mediaTypeFeature.SelectedOption.NamespaceUri; + var mediaTypeOptionName = mediaTypeFeature.SelectedOption.Name; + + // If the print ticket contains anything other than the allowed PageMediaType option, + // return 'true' to indicate so. + if ((mediaTypeOptionNamespaceUri !== pskNs) || + (mediaTypeOptionName !== constraintSample.allowedPageMediaType)) { + return true; + } + } + } + + return false; + } +} + + +////************************************************************* +//// * +//// Utility functions * +//// * +////************************************************************* + +function setPropertyValue(propertyNode, value) { + /// <summary> + /// Set the value contained in the 'Value' node under a 'Property' + /// or a 'ScoredProperty' node in the print ticket/print capabilities document. + /// </summary> + /// <param name="propertyNode" type="IXMLDOMNode"> + /// The 'Property'/'ScoredProperty' node. + /// </param> + /// <param name="value" type="variant"> + /// The value to be stored under the 'Value' node. + /// </param> + /// <returns type="IXMLDOMNode" mayBeNull="true" locid="R:propertyValue"> + /// First child 'Property' node if found, Null otherwise. + /// </returns> + var valueNode = getPropertyFirstValueNode(propertyNode); + if (valueNode) { + var child = valueNode.firstChild; + if (child) { + child.nodeValue = value; + return child; + } + } + return null; +} + + +function setSubPropertyValue(parentProperty, keywordNamespace, subPropertyName, value) { + /// <summary> + /// Set the value contained in an inner Property node's 'Value' node (i.e. 'Value' node in a Property node + /// contained inside another Property node). + /// </summary> + /// <param name="parentProperty" type="IXMLDOMNode"> + /// The parent property node. + /// </param> + /// <param name="keywordNamespace" type="String"> + /// The namespace in which the property name is defined. + /// </param> + /// <param name="subPropertyName" type="String"> + /// The name of the sub-property node. + /// </param> + /// <param name="value" type="variant"> + /// The value to be set in the sub-property node's 'Value' node. + /// </param> + /// <returns type="IXMLDOMNode" mayBeNull="true"> + /// Refer setPropertyValue. + /// </returns> + if (!parentProperty || + !keywordNamespace || + !subPropertyName) { + return null; + } + var subPropertyNode = getProperty( + parentProperty, + keywordNamespace, + subPropertyName); + return setPropertyValue( + subPropertyNode, + value); +} + +function getScoredProperty(node, keywordNamespace, scoredPropertyName) { + /// <summary> + /// Retrieve a 'ScoredProperty' element in a print ticket/print capabilities document. + /// </summary> + /// <param name="node" type="IXMLDOMNode"> + /// The scope of the search i.e. the parent node. + /// </param> + /// <param name="keywordNamespace" type="String"> + /// The namespace in which the element's 'name' attribute is defined. + /// </param> + /// <param name="scoredPropertyName" type="String"> + /// The ScoredProperty's 'name' attribute (without the namespace prefix). + /// </param> + /// <returns type="IXMLDOMNode" mayBeNull="true"> + /// The node on success, 'null' on failure. + /// </returns> + + // Note: It is possible to hard-code the 'psfPrefix' variable in the tag name since the + // SelectionNamespace property has been set against 'psfPrefix' + // in validatePrintTicket/completePrintCapabilities. + return searchByAttributeName( + node, + psfPrefix + ":ScoredProperty", + keywordNamespace, + scoredPropertyName); +} + +function getProperty(node, keywordNamespace, propertyName) { + /// <summary> + /// Retrieve a 'Property' element in a print ticket/print capabilities document. + /// </summary> + /// <param name="node" type="IXMLDOMNode"> + /// The scope of the search i.e. the parent node. + /// </param> + /// <param name="keywordNamespace" type="String"> + /// The namespace in which the element's 'name' attribute is defined. + /// </param> + /// <param name="propertyName" type="String"> + /// The Property's 'name' attribute (without the namespace prefix). + /// </param> + /// <returns type="IXMLDOMNode" mayBeNull="true"> + /// The node on success, 'null' on failure. + /// </returns> + return searchByAttributeName( + node, + psfPrefix + ":Property", + keywordNamespace, + propertyName); +} + +function setSelectedOptionName(printSchemaFeature, keywordPrefix, optionName) { + /// <summary> + /// Set the 'name' attribute of a Feature's selected option + /// Note: This function should be invoked with Feature type that is retrieved + /// via either PrintCapabilties->GetFeature() or PrintTicket->GetFeature(). + /// + /// Caution: Setting only the 'name' attribute can result in an invalid option element. + /// Some options require their entire subtree to be updated. + /// </summary> + /// <param name="printSchemaFeature" type="IPrintSchemaFeature"> + /// Feature variable. + /// </param> + /// <param name="keywordPrefix" type="String"> + /// The prefix for the optionName parameter. + /// </param> + /// <param name="optionName" type="String"> + /// The name (without prefix) to set as the 'name' attribute. + /// </param> + if (!printSchemaFeature || + !printSchemaFeature.SelectedOption || + !printSchemaFeature.SelectedOption.XmlNode) { + return; + } + printSchemaFeature.SelectedOption.XmlNode.setAttribute( + "name", + keywordPrefix + ":" + optionName); +} + + +////************************************************************* +//// * +//// Functions used by utility functions * +//// * +////************************************************************* + +function getPropertyFirstValueNode(propertyNode) { + /// <summary> + /// Retrieve the first 'value' node found under a 'Property' or 'ScoredProperty' node. + /// </summary> + /// <param name="propertyNode" type="IXMLDOMNode"> + /// The 'Property'/'ScoredProperty' node. + /// </param> + /// <returns type="IXMLDOMNode" mayBeNull="true"> + /// The 'Value' node on success, 'null' on failure. + /// </returns> + if (!propertyNode) { + return null; + } + + var nodeName = propertyNode.nodeName; + if ((nodeName.indexOf(":Property") < 0) && + (nodeName.indexOf(":ScoredProperty") < 0)) { + return null; + } + + var valueNode = propertyNode.selectSingleNode(psfPrefix + ":Value"); + return valueNode; +} + +function searchByAttributeName(node, tagName, keywordNamespace, nameAttribute) { + /// <summary> + /// Search for a node that with a specific tag name and containing a + /// specific 'name' attribute + /// e.g. <Bar name=\"ns:Foo\"> is a valid result for the following search: + /// Retrieve elements with tagName='Bar' whose nameAttribute='Foo' in + /// the namespace corresponding to prefix 'ns'. + /// </summary> + /// <param name="node" type="IXMLDOMNode"> + /// Scope of the search i.e. the parent node. + /// </param> + /// <param name="tagName" type="String"> + /// Restrict the searches to elements with this tag name. + /// </param> + /// <param name="keywordNamespace" type="String"> + /// The namespace in which the element's name is defined. + /// </param> + /// <param name="nameAttribute" type="String"> + /// The 'name' attribute to search for. + /// </param> + /// <returns type="IXMLDOMNode" mayBeNull="true"> + /// IXMLDOMNode on success, 'null' on failure. + /// </returns> + if (!node || + !tagName || + !keywordNamespace || + !nameAttribute) { + return null; + } + + // Please refer to: + // http://blogs.msdn.com/b/benkuhn/archive/2006/05/04/printticket-names-and-xpath.aspx + // for more information on this XPath query. + var xPathQuery = "descendant::" + + tagName + + "[substring-after(@name,':')='" + + nameAttribute + + "']" + + "[name(namespace::*[.='" + + keywordNamespace + + "'])=substring-before(@name,':')]" + ; + + return node.selectSingleNode(xPathQuery); +} + +function setSelectionNamespace(xmlNode, prefix, namespace) { + /// <summary> + /// This function sets the 'SelectionNamespaces' property on the XML Node. + /// For more details: http://msdn.microsoft.com/en-us/library/ms756048(VS.85).aspx + /// </summary> + /// <param name="xmlNode" type="IXMLDOMNode"> + /// The node on which the property is set. + /// </param> + /// <param name="prefix" type="String"> + /// The prefix to be associated with the namespace. + /// </param> + /// <param name="namespace" type="String"> + /// The namespace to be added to SelectionNamespaces. + /// </param> + xmlNode.setProperty( + "SelectionNamespaces", + "xmlns:" + + prefix + + "='" + + namespace + + "'" + ); +} + +function getPrefixForNamespace(node, namespace) { + /// <summary> + /// This function returns the prefix for a given namespace. + /// Example: In 'psf:printTicket', 'psf' is the prefix for the namespace. + /// xmlns:psf="http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework" + /// </summary> + /// <param name="node" type="IXMLDOMNode"> + /// A node in the XML document. + /// </param> + /// <param name="namespace" type="String"> + /// The namespace for which prefix is returned. + /// </param> + /// <returns type="String"> + /// Returns the namespace corresponding to the prefix. + /// </returns> + + if (!node) { + return null; + } + + // Navigate to the root element of the document. + var rootNode = node.documentElement; + + // Query to retrieve the list of attribute nodes for the current node + // that matches the namespace in the 'namespace' variable. + var xPathQuery = "namespace::node()[.='" + + namespace + + "']"; + var namespaceNode = rootNode.selectSingleNode(xPathQuery); + var prefix = namespaceNode.baseName; + + return prefix; +} + +var printSchemaApiHelpers = { + supportsIPrintSchemaCapabilities2: function (printCapabilities) { + /// <summary> + /// Determines if the IPrintSchemaCapabilities2 APIs are supported on the 'printCapabilities' object. + /// </summary> + /// <param name="printCapabilities" type="IPrintSchemaCapabilities"> + /// Print capabilities object. + /// </param> + /// <returns type="Boolean"> + /// true - the interface APIs are supported. + /// false - the interface APIs are not supported. + /// </returns> + + var supported = true; + + try { + if (typeof printCapabilities.getParameterDefinition === "undefined") { + supported = false; + } + } + catch (exception) { + supported = false; + } + + return supported; + }, + supportsIPrintSchemaTicket2: function(printTicket) { + /// <summary> + /// Determines if the IPrintSchemaTicket2 APIs are supported on the 'printTicket' object. + /// </summary> + /// <param name="printTicket" type="IPrintSchemaTicket"> + /// Print ticket object. + /// </param> + /// <returns type="Boolean"> + /// true - the interface APIs are supported. + /// false - the interface APIs are not supported. + /// </returns> + + var supported = true; + + try { + if (typeof printTicket.getParameterInitializer === "undefined") { + supported = false; + } + } + catch (exception) { + supported = false; + } + + return supported; + } +}
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.sln b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.sln new file mode 100644 index 00000000..16309c48 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConstraintScript", "ConstraintScript.vcxproj", "{3743F253-48F5-4E35-9158-87A7A4B21BAD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3743F253-48F5-4E35-9158-87A7A4B21BAD}.Debug|Win32.ActiveCfg = Debug|Win32 + {3743F253-48F5-4E35-9158-87A7A4B21BAD}.Debug|Win32.Build.0 = Debug|Win32 + {3743F253-48F5-4E35-9158-87A7A4B21BAD}.Release|Win32.ActiveCfg = Release|Win32 + {3743F253-48F5-4E35-9158-87A7A4B21BAD}.Release|Win32.Build.0 = Release|Win32 + {3743F253-48F5-4E35-9158-87A7A4B21BAD}.Debug|x64.ActiveCfg = Debug|x64 + {3743F253-48F5-4E35-9158-87A7A4B21BAD}.Debug|x64.Build.0 = Debug|x64 + {3743F253-48F5-4E35-9158-87A7A4B21BAD}.Release|x64.ActiveCfg = Release|x64 + {3743F253-48F5-4E35-9158-87A7A4B21BAD}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj new file mode 100644 index 00000000..32f2e007 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj @@ -0,0 +1,150 @@ +<?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="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{3743F253-48F5-4E35-9158-87A7A4B21BAD}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + <SupportsPackaging>false</SupportsPackaging> + <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <SampleGuid>{9E99443A-A160-4CFF-B9B7-86E42C9F6352}</SampleGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <OutDir>$(IntDir)</OutDir> + </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </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')" /> + </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')" /> + </ImportGroup> + <ItemGroup Label="WrappedTaskItems" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>ConstraintScript</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>ConstraintScript</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>ConstraintScript</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>ConstraintScript</TargetName> + </PropertyGroup> + <ItemGroup> + <None Include="ConstraintScript.js" /> + </ItemGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <Inf Exclude="@(Inf)" Include="*.inf" /> + <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> + </ItemGroup> + <ItemGroup> + <None Include="*.txt" Exclude="@(None)" /> + <None Include="*.htm" Exclude="@(None)" /> + <None Include="*.html" Exclude="@(None)" /> + <None Include="*.ico" Exclude="@(None)" /> + <None Include="*.cur" Exclude="@(None)" /> + <None Include="*.bmp" Exclude="@(None)" /> + <None Include="*.dlg" Exclude="@(None)" /> + <None Include="*.rct" Exclude="@(None)" /> + <None Include="*.gif" Exclude="@(None)" /> + <None Include="*.jpg" Exclude="@(None)" /> + <None Include="*.jpeg" Exclude="@(None)" /> + <None Include="*.wav" Exclude="@(None)" /> + <None Include="*.jpe" Exclude="@(None)" /> + <None Include="*.tiff" Exclude="@(None)" /> + <None Include="*.tif" Exclude="@(None)" /> + <None Include="*.png" Exclude="@(None)" /> + <None Include="*.rc2" Exclude="@(None)" /> + <None Include="*.def" Exclude="@(None)" /> + <None Include="*.bat" Exclude="@(None)" /> + <None Include="*.hpj" Exclude="@(None)" /> + <None Include="*.asmx" Exclude="@(None)" /> + </ItemGroup> + <ItemGroup> + <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters new file mode 100644 index 00000000..dc898596 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> + <UniqueIdentifier>{13816FE7-E5E7-44C3-A1BC-C290ADE11E77}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + <UniqueIdentifier>{1B9F5A82-93F9-43BB-9206-07B44A903E65}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> + <UniqueIdentifier>{97FFF924-8790-432D-B7FB-620D32F06728}</UniqueIdentifier> + </Filter> + <Filter Include="Driver Files"> + <Extensions>inf;inv;inx;mof;mc;</Extensions> + <UniqueIdentifier>{37982029-F9B3-4A61-8379-A5CE0AE7F8B5}</UniqueIdentifier> + </Filter> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ReadMe.md b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ReadMe.md new file mode 100644 index 00000000..60c78353 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ReadMe.md @@ -0,0 +1,23 @@ +Print Driver Constraints Sample +=============================== + +This sample demonstrates how to implement advanced constraint handling, and also PrintTicket/PrintCapabilities handling using JavaScript. + +The Constraints.js file in this sample demonstrates the implementation of JavaScript-based constraints to be used with a v4 print driver. The file implements the following two of the four functions used by JavaScript constraint files, as well as several helper functions: + +- **ValidatePrintTicket** takes a given [IPrintSchemaTicket](http://msdn.microsoft.com/en-us/library/hh451398(v=vs.85).aspx) object and validates it for the current printer. The function may determine that the Print Ticket was already valid, modify the Print Ticket to make it valid, or determine that the Print Ticket is invalid and could not be made valid. +- **CompletePrintCapabilities** takes a given **IPrintSchemaTicket** object and the [IPrintSchemaCapabilities](http://msdn.microsoft.com/en-us/library/hh451256(v=vs.85).aspx) object that was produced by the configuration module and augments it as needed. This can be used to establish positive constraint situations. + +This sample does not demonstrate **ConvertPrintTicketToDevMode** or **ConvertDevModeToPrintTicket**, which utilize a property bag to store data in the private section of the DEVMODE structure. + +**Note** This sample is for the v4 print driver model. + +Related topics +-------------- + +[Building a Driver](http://msdn.microsoft.com/en-us/library/windows/hardware/ff554644) + +[IPrintSchemaCapabilities](http://msdn.microsoft.com/en-us/library/hh451256(v=vs.85).aspx) + +[IPrintSchemaTicket](http://msdn.microsoft.com/en-us/library/hh451398(v=vs.85).aspx) + diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js new file mode 100644 index 00000000..bbbc31a0 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js @@ -0,0 +1,126 @@ +/// <reference path="v4PrintDriver-Intellisense.js" /> + +v4PrintDriverIntellisense.appendInterfaceMethods( + IPrintSchemaTicket, + { + GetParameterInitializer: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaTicket2::GetParameterInitializer. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="IPrintSchemaParameterInitializer" /> + } + }); + +v4PrintDriverIntellisense.appendInterfaceMethods( + IPrintSchemaCapabilities, + { + GetParameterDefinition: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaCapabilities2::GetParameterDefinition. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="IPrintSchemaParameterDefinition" /> + } + }); + +IPrintSchemaParameterInitializer = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaParameterInitializer, + IPrintSchemaElement, + { + /// <field name="Value" type="String/Number"> + /// Property-get/set maps to COM IPrintSchemaParameterInitializer::Value. + /// </field> + Value: null, + }); + +IPrintSchemaParameterDefinition = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaParameterDefinition, + IPrintSchemaDisplayableElement, + { + /// <field name="UserInputRequired" type="Boolean"> + /// Property-get maps to COM IPrintSchemaParameterDefinition::UserInputRequired. + /// </field> + UserInputRequired: null, + /// <field name="UnitType" type="String"> + /// Property-get maps to COM IPrintSchemaParameterDefinition::UnitType. + /// </field> + UnitType: null, + /// <field name="DataType" type="PrintSchemaParameterDataType"> + /// Property-get maps to COM IPrintSchemaParameterDefinition::DataType. + /// </field> + DataType: null, + /// <field name="RangeMin" type="Number"> + /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMin. + /// </field> + RangeMin: null, + /// <field name="RangeMax" type="Number"> + /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMax. + /// </field> + RangeMax: null + }); + +IPrinterScriptUsbJobContextReturnCodes = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptUsbJobContextReturnCodes, + null, + { + /// <field name="Success" type="Number" integer="true"> + /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Success. + /// </field> + Success: null, + /// <field name="Failure" type="Number" integer="true"> + /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Failure. + /// </field> + Failure: null, + /// <field name="Retry" type="Number" integer="true"> + /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Retry. + /// </field> + Retry: null, + /// <field name="DeviceBusy" type="Number" integer="true"> + /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::DeviceBusy. + /// </field> + DeviceBusy: null, + /// <field name="AbortTheJob" type="Number" integer="true"> + /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::AbortTheJob. + /// </field> + AbortTheJob: null + }); + +IPrinterScriptUsbWritePrintDataProgress = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptUsbWritePrintDataProgress, + null, + { + /// <field name="ProcessedByteCount" type="Number"> + /// Property-get/set maps to COM IPrinterScriptUsbWritePrintDataProgress::ProcessedByteCount. + /// </field> + ProcessedByteCount: null + }); + +IPrinterScriptUsbJobContext = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptUsbJobContext, + null, + { + /// <field name="JobPropertyBag" type="IPrinterScriptablePropertyBag"> + /// Property-get maps to COM IPrinterScriptUsbJobContext::JobPropertyBag. + /// </field> + JobPropertyBag: null, + /// <field name="ReturnCodes" type="IPrinterScriptUsbJobContextReturnCodes"> + /// Property-get maps to COM IPrinterScriptUsbJobContext::ReturnCodes. + /// </field> + ReturnCodes: null, + /// <field name="TemporaryStreams" type="Array"> + /// Property-get maps to COM IPrinterScriptUsbJobContext::TemporaryStreams. Provides an array of IPrinterScriptableSequentialStream. + /// </field> + TemporaryStreams: null, + /// <field name="PrintedPageCount" type="Number"> + /// Property-get/set maps to COM IPrinterScriptUsbJobContext::PrintedPageCount. + /// </field> + PrintedPageCount: null + });
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense.js b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense.js new file mode 100644 index 00000000..2386541d --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense.js @@ -0,0 +1,513 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// v4PrintDriver-Intellisense.js +// +// Abstract: +// +// This file defines intellisense to be used by JavaScript extensions in v4 print drivers. + +var v4PrintDriverIntellisense = { + /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> + createInterface: function (childInterface, baseType, prototype) { + /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> + childInterface.__class = true; + + if (prototype) { + childInterface.prototype = prototype; + } + + if (baseType) { + childInterface.__baseType = baseType; + childInterface.__basePrototypePending = true; + v4PrintDriverIntellisense.resolveInheritance(childInterface); + } + }, + appendInterfaceMethods: function (baseType, prototype) { + /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> + for (var memberName in prototype) { + baseType.prototype[memberName] = prototype[memberName]; + } + }, + resolveInheritance: function (childInterface) { + /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> + var baseType = childInterface.__baseType; + if (!baseType) { + return; + } + + if (baseType.__baseType) { + resolveInheritance(baseType); + } + + if (!childInterface.__basePrototypePending) { + return; + } + + for (var memberName in baseType.prototype) { + var memberValue = baseType.prototype[memberName]; + if (!childInterface.prototype[memberName]) { + childInterface.prototype[memberName] = memberValue; + } + } + + delete childInterface.__basePrototypePending; + } +} + +IPrintSchemaElement = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaElement, + null, + { + /// <field name="XmlNode" type="XML DOM"> + /// Property-get maps to COM IPrintSchemaElement::XmlNode. + /// </field> + XmlNode: null, + /// <field name="Name" type="String"> + /// Property-get maps to COM IPrintSchemaElement::Name. + /// </field> + Name: null, + /// <field name="NamespaceUri" type="String"> + /// Property-get maps to COM IPrintSchemaElement::NamespaceUri. + /// </field> + NamespaceUri: null + }); + +IPrintSchemaDisplayableElement = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaDisplayableElement, + IPrintSchemaElement, + { + /// <field name="DisplayName" type="String"> + /// Property-get maps to COM IPrintSchemaDisplayableElement::DisplayName. + /// </field> + DisplayName: null + }); + + +IPrintSchemaOption = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaOption, + IPrintSchemaDisplayableElement, + { + /// <field name="Selected" type="Boolean"> + /// Property-get maps to COM IPrintSchemaOption::Selected. + /// </field> + Selected: null, + /// <field name="Constrained" type="PrintSchemaConstrainedSetting"> + /// Property-get maps to COM IPrintSchemaOption::Constrained. + /// </field> + Constrained: null, + GetPropertyValue: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaOption::GetPropertyValue. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="XML DOM" /> + }, + /// <field name="PagesPerSheet" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaNUpOption::PagesPerSheet. Valid for NUp option only. + /// </field> + PagesPerSheet: null, + /// <field name="WidthInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::WidthInMicrons. Valid for PageMediaSize option only. + /// </field> + WidthInMicrons: null, + /// <field name="HeightInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::HeightInMicrons. Valid for PageMediaSize option only. + /// </field> + HeightInMicrons: null + + }); + +IPrintSchemaOptionCollection = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaOptionCollection, + null, + { + /// <field name="Count" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaOptionCollection::Count. + /// </field> + Count: null, + GetAt: function (index) { + /// <summary> + /// Property-get maps to COM IPrintSchemaOptionCollection::GetAt. + /// </summary> + /// <param name="index" type="Number" integer="true" /> + /// <returns type="IPrintSchemaOption" /> + } + }); + + +IPrintSchemaFeature = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaFeature, + IPrintSchemaDisplayableElement, + { + /// <field name="SelectedOption" type="IPrintSchemaOption"> + /// Property-set/get maps to COM IPrintSchemaFeature::SelectedOption. + /// </field> + SelectedOption: null, + /// <field name="SelectionType" type="PrintSchemaSelectionType"> + /// Property-get maps to COM IPrintSchemaFeature::SelectionType. + /// </field> + SelectionType: null, + GetOption: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaFeature::GetOption. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="IPrintSchemaOption" /> + }, + /// <field name="DisplayUI" type="Boolean"> + /// Property-get maps to COM IPrintSchemaFeature::DisplayUI. + /// </field> + DisplayUI: null + }); + + +IPrintSchemaPageImageableSize = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaPageImageableSize, + IPrintSchemaElement, + { + /// <field name="ImageableSizeWidthInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeWidthInMicrons. + /// </field> + ImageableSizeWidthInMicrons: null, + /// <field name="ImageableSizeHeightInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeHeightInMicrons. + /// </field> + ImageableSizeHeightInMicrons: null, + /// <field name="OriginWidthInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginWidthInMicrons. + /// </field> + OriginWidthInMicrons: null, + /// <field name="OriginHeightInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginHeightInMicrons. + /// </field> + OriginHeightInMicrons: null, + /// <field name="ExtentWidthInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentWidthInMicrons. + /// </field> + ExtentWidthInMicrons: null, + /// <field name="ExtentHeightInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentHeightInMicrons. + /// </field> + ExtentHeightInMicrons: null + }); + + +IPrintSchemaCapabilities = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaCapabilities, + IPrintSchemaElement, + { + GetFeatureByKeyName: function (keyName) { + /// <summary> + /// Method maps to COM IPrintSchemaCapabilities::GetFeatureByKeyName. + /// </summary> + /// <param name="keyName" type="String" /> + /// <returns type="IPrintSchemaFeature" /> + }, + GetFeature: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaCapabilities::GetFeature. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="IPrintSchemaFeature" /> + }, + /// <field name="PageImageableSize" type="IPrintSchemaPageImageableSize"> + /// Property-get maps to COM IPrintSchemaCapabilities::PageImageableSize. + /// </field> + PageImageableSize: null, + /// <field name="JobCopiesAllDocumentsMinValue" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMinValue. + /// </field> + JobCopiesAllDocumentsMinValue: null, + /// <field name="JobCopiesAllDocumentsMaxValue" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMaxValue. + /// </field> + JobCopiesAllDocumentsMaxValue: null, + GetSelectedOptionInPrintTicket: function (feature) { + /// <summary> + /// Method maps to COM IPrintSchemaCapabilities::GetSelectedOptionInPrintTicket. + /// </summary> + /// <param name="feature" type="IPrintSchemaFeature" /> + /// <returns type="IPrintSchemaOption" /> + }, + GetOptions: function (feature) { + /// <summary> + /// Method maps to COM IPrintSchemaCapabilities::GetOptions. + /// </summary> + /// <param name="feature" type="IPrintSchemaFeature" /> + /// <returns type="IPrintSchemaOptionCollection" /> + } + }); + + +IPrintSchemaTicket = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaTicket, + IPrintSchemaElement, + { + GetFeatureByKeyName: function (keyName) { + /// <summary> + /// Method maps to COM IPrintSchemaTicket::GetFeatureByKeyName. + /// </summary> + /// <param name="keyName" type="String" /> + /// <returns type="IPrintSchemaFeature" /> + }, + GetFeature: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaTicket::GetFeature. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="IPrintSchemaFeature" /> + }, + NotifyXmlChanged: function () { + /// <summary> + /// Method maps to COM IPrintSchemaTicket::NotifyXmlChanged. + /// </summary> + }, + GetCapabilities: function () { + /// <summary> + /// Method maps to COM IPrintSchemaTicket::GetCapabilities. + /// </summary> + /// <returns type="IPrintSchemaCapabilities" /> + }, + /// <field name="JobCopiesAllDocuments" type="Number" integer="true"> + /// Property-get/put maps to IPrintSchemaTicket::JobCopiesAllDocuments. + /// </field> + JobCopiesAllDocuments: null + }); + + +IPrinterScriptableSequentialStream = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptableSequentialStream, + null, + { + Read: function (count) { + /// <summary> + /// Method maps to COM IPrinterScriptableSequentialStream::Read. + /// </summary> + /// <param name="count" type="Number" integer="true" /> + /// <returns type="Array" /> + }, + Write: function (array) { + /// <summary> + /// Method maps to COM IPrinterScriptableSequentialStream::Write. + /// </summary> + /// <param name="array" type="Array" /> + /// <returns type="Number" integer="true"/> + } + }); + +IPrinterScriptableStream = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptableStream, + IPrinterScriptableSequentialStream, + { + Commit: function () { + /// <summary> + /// Method maps to COM IPrinterScriptableStream::Commit. + /// </summary> + }, + Seek: function (offset, streamSeek) { + /// <summary> + /// Method maps to COM IPrinterScriptableStream::Seek + /// </summary> + /// <param name="offset" type="Number" integer="true" /> + /// <param name="streamSeek" type="STREAM_SEEK" /> + /// <returns type="Number" integer="true"/> + }, + SetSize: function (size) { + /// <summary> + /// Method maps to COM IPrinterScriptableStream::SetSize. + /// </summary> + /// <param name="size" type="Number" integer="true" /> + } + }); + + +IPrinterScriptablePropertyBag = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptablePropertyBag, + null, + { + GetBool: function (name) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::GetBool. + /// </summary> + /// <param name="name" type="String" /> + /// <returns type="Boolean" /> + }, + SetBool: function (name, value) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::SetBool. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="value" type="Boolean" /> + }, + GetInt32: function (name) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::GetInt32. + /// </summary> + /// <param name="name" type="String" /> + /// <returns type="Number" integer="true"/> + }, + SetInt32: function (name, value) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::SetInt32. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="value" type="Number" integer="true" /> + }, + GetString: function (name) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::GetString. + /// </summary> + /// <param name="name" type="String" /> + /// <returns type="String" /> + }, + SetString: function (name, value) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::SetString. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="value" type="String" /> + }, + GetReadStream: function (name) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::GetReadStream. + /// </summary> + /// <param name="name" type="String" /> + /// <returns type="IPrinterScriptableStream" /> + }, + GetWriteStream: function (name) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::GetWriteStream. + /// </summary> + /// <param name="name" type="String" /> + /// <returns type="IPrinterScriptableStream" /> + } + }); + + +IPrinterScriptContext = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptContext, + null, + { + /// <field name="DriverProperties" type="IPrinterScriptablePropertyBag"> + /// Property-get maps to COM IPrinterScriptContext::DriverProperties. + /// </field> + DriverProperties: null, + /// <field name="QueueProperties" type="IPrinterScriptablePropertyBag"> + /// Property-get maps to COM IPrinterScriptContext::QueueProperties. + /// </field> + QueueProperties: null, + /// <field name="UserProperties" type="IPrinterScriptablePropertyBag"> + /// Property-get maps to COM IPrinterScriptContext::UserProperties. + /// </field> + UserProperties: null + }); + +IPrinterBidiSchemaElement = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterBidiSchemaElement, + null, + { + /// <field name="Name" type="String"> + /// Property-get maps to COM IPrinterBidiSchemaElement::Name. + /// </field> + Name: null, + /// <field type="PrinterBidiSchemaElementType"> + /// Property-get maps to COM IPrinterBidiSchemaElement::BidiType. + /// </field> + BidiType: null, + /// <field type="Object"> + /// Property-get maps to COM IPrinterBidiSchemaElement::Value. + /// </field> + Value: null + }); + +IPrinterBidiSchemaResponses = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterBidiSchemaResponses, + null, + { + AddNull: function (schema) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddNull. + /// </summary> + /// <param name="schema" type="String" /> + }, + AddString: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddString. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="String" /> + }, + AddText: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddText. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="String" /> + }, + AddEnum: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddEnum. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="String" /> + }, + AddInt32: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddInt32. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="Number" integer="true" /> + }, + AddBool: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddBool. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="Boolean" /> + }, + AddFloat: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddFloat. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="Number" /> + }, + AddBlob: function (schema, array) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddBlob. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="array" type="Array" /> + }, + AddRequeryKey: function (queryKey) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddRequeryKey. + /// </summary> + /// <param name="queryKey" type="String" /> + } + }); diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/ReadMe.md b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/ReadMe.md new file mode 100644 index 00000000..2b0528d3 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/ReadMe.md @@ -0,0 +1,44 @@ +Print Driver USB Monitor and Bidi Sample +======================================== + +This sample demonstrates how to support bidirectional (Bidi) communication over the USB bus, using JavaScript and XML. This sample supports bidirectional status while not printing, and unsolicited status from the printer while printing. + +The following files are included in the sample: + +- USBMON\_Bidi\_JavaScript\_File.js. This JavaScript file demonstrates the implementation of a Bidi support for USBMon with a v4 print driver. The JavaScript file supports three functions: getSchemas() is used to make Bidi GET queries to a device, setSchema() is used to make a single Bidi SET query to the device, and getStatus() is called repeatedly during printing in order to retrieve unsolicited status from the printer using the data from the read channel of the device. +- USBMON\_Bidi\_XML\_File.xml. This XML file demonstrates how to build a Bidi Schema extension for USB. It describes the supported schema elements that can be queried or set, along with their restrictions. + +For more information, see [USB Bidi Extender](http://msdn.microsoft.com/en-us/library/windows/hardware/jj659903(v=vs.85).aspx). + +**Note** This sample is for the v4 print driver model. + +**Note** When you make calls to printerStream.read() in the sample, the printer returns an array which includes an additional element that represents the array length. The following code snippet can be used to copy the returned array into a new array, and also to remove the additional element. + +<table> +<colgroup> +<col width="100%" /> +</colgroup> +<thead> +<tr class="header"> +<th align="left">JavaScript</th> +</tr> +</thead> +<tbody> +<tr class="odd"> +<td align="left"><pre><code>var readBuffer = []; +var readBytes = 0; +var readSize = 4096; + +readBuffer = printerStream.read( readSize ); +readBytes = readBuffer.length; + + +var cleanArray = []; + +for ( i = 0; i < readBytes; i++ ) { + cleanArray[i] = readBuffer.shift(); +}</code></pre></td> +</tr> +</tbody> +</table> + diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.js b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.js Binary files differnew file mode 100644 index 00000000..d066fe65 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.js diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.sln b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.sln new file mode 100644 index 00000000..accd9781 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "USBMon-Bidi-Extension", "USBMon-Bidi-Extension.vcxproj", "{9ADDA646-6402-49C1-8DE3-5E8161501609}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9ADDA646-6402-49C1-8DE3-5E8161501609}.Debug|Win32.ActiveCfg = Debug|Win32 + {9ADDA646-6402-49C1-8DE3-5E8161501609}.Debug|Win32.Build.0 = Debug|Win32 + {9ADDA646-6402-49C1-8DE3-5E8161501609}.Release|Win32.ActiveCfg = Release|Win32 + {9ADDA646-6402-49C1-8DE3-5E8161501609}.Release|Win32.Build.0 = Release|Win32 + {9ADDA646-6402-49C1-8DE3-5E8161501609}.Debug|x64.ActiveCfg = Debug|x64 + {9ADDA646-6402-49C1-8DE3-5E8161501609}.Debug|x64.Build.0 = Debug|x64 + {9ADDA646-6402-49C1-8DE3-5E8161501609}.Release|x64.ActiveCfg = Release|x64 + {9ADDA646-6402-49C1-8DE3-5E8161501609}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj new file mode 100644 index 00000000..5dac5ac6 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj @@ -0,0 +1,151 @@ +<?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="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{9ADDA646-6402-49C1-8DE3-5E8161501609}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + <SupportsPackaging>false</SupportsPackaging> + <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <SampleGuid>{5233D70B-3962-4627-B29A-9C0A35610B5B}</SampleGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <OutDir>$(IntDir)</OutDir> + </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </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')" /> + </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')" /> + </ImportGroup> + <ItemGroup Label="WrappedTaskItems" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>USBMon-Bidi-Extension</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>USBMon-Bidi-Extension</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>USBMon-Bidi-Extension</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>USBMon-Bidi-Extension</TargetName> + </PropertyGroup> + <ItemGroup> + <None Include="USBMon-Bidi-Extension.js" /> + <None Include="USBMon-Bidi-Extension.xml" /> + </ItemGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <Inf Exclude="@(Inf)" Include="*.inf" /> + <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> + </ItemGroup> + <ItemGroup> + <None Include="*.txt" Exclude="@(None)" /> + <None Include="*.htm" Exclude="@(None)" /> + <None Include="*.html" Exclude="@(None)" /> + <None Include="*.ico" Exclude="@(None)" /> + <None Include="*.cur" Exclude="@(None)" /> + <None Include="*.bmp" Exclude="@(None)" /> + <None Include="*.dlg" Exclude="@(None)" /> + <None Include="*.rct" Exclude="@(None)" /> + <None Include="*.gif" Exclude="@(None)" /> + <None Include="*.jpg" Exclude="@(None)" /> + <None Include="*.jpeg" Exclude="@(None)" /> + <None Include="*.wav" Exclude="@(None)" /> + <None Include="*.jpe" Exclude="@(None)" /> + <None Include="*.tiff" Exclude="@(None)" /> + <None Include="*.tif" Exclude="@(None)" /> + <None Include="*.png" Exclude="@(None)" /> + <None Include="*.rc2" Exclude="@(None)" /> + <None Include="*.def" Exclude="@(None)" /> + <None Include="*.bat" Exclude="@(None)" /> + <None Include="*.hpj" Exclude="@(None)" /> + <None Include="*.asmx" Exclude="@(None)" /> + </ItemGroup> + <ItemGroup> + <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj.Filters b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj.Filters new file mode 100644 index 00000000..bdfa6e2f --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj.Filters @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> + <UniqueIdentifier>{779218F5-6AF7-428A-B095-7CBA5126C413}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + <UniqueIdentifier>{7EE9AB0A-990F-4733-8072-4F30033D2B77}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> + <UniqueIdentifier>{404DBCB9-03F7-4AB9-A0D5-36D7DF44DCEE}</UniqueIdentifier> + </Filter> + <Filter Include="Driver Files"> + <Extensions>inf;inv;inx;mof;mc;</Extensions> + <UniqueIdentifier>{B4AECD6D-977B-4925-90B0-28186A3AAFD2}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <None Include="USBMon-Bidi-Extension.xml"> + <Filter>Resource Files</Filter> + </None> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.xml b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.xml new file mode 100644 index 00000000..5d98893c --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.xml @@ -0,0 +1,24 @@ +<?xml version='1.0'?> +<bidi:Schema xmlns:bidi="http://schemas.microsoft.com/windows/2010/09/printing/usbbidi"> + <Property name='Printer'> + <Property name='DeviceInfo'> + <Const name="Category" type="BIDI_STRING" value="DeviceCategory"/> + <Value name="QueueProperty" type="BIDI_STRING" accessType="Get" queryKey="Configuration" refreshInterval="60" drvPrinterEvent="true"/> + </Property> + <Property name='Configuration'> + <Property name='DuplexUnit'> + <Value name="Installed" type="BIDI_BOOL" accessType="Get" queryKey="Configuration" refreshInterval="60" drvPrinterEvent="true"/> + </Property> + <Property name='Memory'> + <Value name="Size" type="BIDI_INT" accessType="Get" queryKey="Configuration" refreshInterval="60" drvPrinterEvent="true"/> + </Property> + </Property> + <Property name="Extension"> + <Value name="ChangeableData" type="BIDI_INT" accessType="GetSet" drvPrinterEvent="false"/> + <Value name="DeviceAction" type="BIDI_BOOL" accessType="Set"/> + <Value name="IntegerValue" type="BIDI_INT" accessType="GetSet" queryKey="IntKey" drvPrinterEvent="true"/> + <Value name="StringValue" type="BIDI_STRING" accessType="Get" refreshInterval="15"/> + <Value name="StatusData" type="BIDI_INT" accessType="Get" queryKey="IntKey"/> + </Property> + </Property> +</bidi:Schema> diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense-Windows8.1.js b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense-Windows8.1.js new file mode 100644 index 00000000..bbbc31a0 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense-Windows8.1.js @@ -0,0 +1,126 @@ +/// <reference path="v4PrintDriver-Intellisense.js" /> + +v4PrintDriverIntellisense.appendInterfaceMethods( + IPrintSchemaTicket, + { + GetParameterInitializer: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaTicket2::GetParameterInitializer. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="IPrintSchemaParameterInitializer" /> + } + }); + +v4PrintDriverIntellisense.appendInterfaceMethods( + IPrintSchemaCapabilities, + { + GetParameterDefinition: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaCapabilities2::GetParameterDefinition. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="IPrintSchemaParameterDefinition" /> + } + }); + +IPrintSchemaParameterInitializer = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaParameterInitializer, + IPrintSchemaElement, + { + /// <field name="Value" type="String/Number"> + /// Property-get/set maps to COM IPrintSchemaParameterInitializer::Value. + /// </field> + Value: null, + }); + +IPrintSchemaParameterDefinition = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaParameterDefinition, + IPrintSchemaDisplayableElement, + { + /// <field name="UserInputRequired" type="Boolean"> + /// Property-get maps to COM IPrintSchemaParameterDefinition::UserInputRequired. + /// </field> + UserInputRequired: null, + /// <field name="UnitType" type="String"> + /// Property-get maps to COM IPrintSchemaParameterDefinition::UnitType. + /// </field> + UnitType: null, + /// <field name="DataType" type="PrintSchemaParameterDataType"> + /// Property-get maps to COM IPrintSchemaParameterDefinition::DataType. + /// </field> + DataType: null, + /// <field name="RangeMin" type="Number"> + /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMin. + /// </field> + RangeMin: null, + /// <field name="RangeMax" type="Number"> + /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMax. + /// </field> + RangeMax: null + }); + +IPrinterScriptUsbJobContextReturnCodes = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptUsbJobContextReturnCodes, + null, + { + /// <field name="Success" type="Number" integer="true"> + /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Success. + /// </field> + Success: null, + /// <field name="Failure" type="Number" integer="true"> + /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Failure. + /// </field> + Failure: null, + /// <field name="Retry" type="Number" integer="true"> + /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Retry. + /// </field> + Retry: null, + /// <field name="DeviceBusy" type="Number" integer="true"> + /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::DeviceBusy. + /// </field> + DeviceBusy: null, + /// <field name="AbortTheJob" type="Number" integer="true"> + /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::AbortTheJob. + /// </field> + AbortTheJob: null + }); + +IPrinterScriptUsbWritePrintDataProgress = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptUsbWritePrintDataProgress, + null, + { + /// <field name="ProcessedByteCount" type="Number"> + /// Property-get/set maps to COM IPrinterScriptUsbWritePrintDataProgress::ProcessedByteCount. + /// </field> + ProcessedByteCount: null + }); + +IPrinterScriptUsbJobContext = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptUsbJobContext, + null, + { + /// <field name="JobPropertyBag" type="IPrinterScriptablePropertyBag"> + /// Property-get maps to COM IPrinterScriptUsbJobContext::JobPropertyBag. + /// </field> + JobPropertyBag: null, + /// <field name="ReturnCodes" type="IPrinterScriptUsbJobContextReturnCodes"> + /// Property-get maps to COM IPrinterScriptUsbJobContext::ReturnCodes. + /// </field> + ReturnCodes: null, + /// <field name="TemporaryStreams" type="Array"> + /// Property-get maps to COM IPrinterScriptUsbJobContext::TemporaryStreams. Provides an array of IPrinterScriptableSequentialStream. + /// </field> + TemporaryStreams: null, + /// <field name="PrintedPageCount" type="Number"> + /// Property-get/set maps to COM IPrinterScriptUsbJobContext::PrintedPageCount. + /// </field> + PrintedPageCount: null + });
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense.js b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense.js new file mode 100644 index 00000000..2386541d --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense.js @@ -0,0 +1,513 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved +// +// File Name: +// +// v4PrintDriver-Intellisense.js +// +// Abstract: +// +// This file defines intellisense to be used by JavaScript extensions in v4 print drivers. + +var v4PrintDriverIntellisense = { + /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> + createInterface: function (childInterface, baseType, prototype) { + /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> + childInterface.__class = true; + + if (prototype) { + childInterface.prototype = prototype; + } + + if (baseType) { + childInterface.__baseType = baseType; + childInterface.__basePrototypePending = true; + v4PrintDriverIntellisense.resolveInheritance(childInterface); + } + }, + appendInterfaceMethods: function (baseType, prototype) { + /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> + for (var memberName in prototype) { + baseType.prototype[memberName] = prototype[memberName]; + } + }, + resolveInheritance: function (childInterface) { + /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> + var baseType = childInterface.__baseType; + if (!baseType) { + return; + } + + if (baseType.__baseType) { + resolveInheritance(baseType); + } + + if (!childInterface.__basePrototypePending) { + return; + } + + for (var memberName in baseType.prototype) { + var memberValue = baseType.prototype[memberName]; + if (!childInterface.prototype[memberName]) { + childInterface.prototype[memberName] = memberValue; + } + } + + delete childInterface.__basePrototypePending; + } +} + +IPrintSchemaElement = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaElement, + null, + { + /// <field name="XmlNode" type="XML DOM"> + /// Property-get maps to COM IPrintSchemaElement::XmlNode. + /// </field> + XmlNode: null, + /// <field name="Name" type="String"> + /// Property-get maps to COM IPrintSchemaElement::Name. + /// </field> + Name: null, + /// <field name="NamespaceUri" type="String"> + /// Property-get maps to COM IPrintSchemaElement::NamespaceUri. + /// </field> + NamespaceUri: null + }); + +IPrintSchemaDisplayableElement = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaDisplayableElement, + IPrintSchemaElement, + { + /// <field name="DisplayName" type="String"> + /// Property-get maps to COM IPrintSchemaDisplayableElement::DisplayName. + /// </field> + DisplayName: null + }); + + +IPrintSchemaOption = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaOption, + IPrintSchemaDisplayableElement, + { + /// <field name="Selected" type="Boolean"> + /// Property-get maps to COM IPrintSchemaOption::Selected. + /// </field> + Selected: null, + /// <field name="Constrained" type="PrintSchemaConstrainedSetting"> + /// Property-get maps to COM IPrintSchemaOption::Constrained. + /// </field> + Constrained: null, + GetPropertyValue: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaOption::GetPropertyValue. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="XML DOM" /> + }, + /// <field name="PagesPerSheet" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaNUpOption::PagesPerSheet. Valid for NUp option only. + /// </field> + PagesPerSheet: null, + /// <field name="WidthInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::WidthInMicrons. Valid for PageMediaSize option only. + /// </field> + WidthInMicrons: null, + /// <field name="HeightInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::HeightInMicrons. Valid for PageMediaSize option only. + /// </field> + HeightInMicrons: null + + }); + +IPrintSchemaOptionCollection = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaOptionCollection, + null, + { + /// <field name="Count" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaOptionCollection::Count. + /// </field> + Count: null, + GetAt: function (index) { + /// <summary> + /// Property-get maps to COM IPrintSchemaOptionCollection::GetAt. + /// </summary> + /// <param name="index" type="Number" integer="true" /> + /// <returns type="IPrintSchemaOption" /> + } + }); + + +IPrintSchemaFeature = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaFeature, + IPrintSchemaDisplayableElement, + { + /// <field name="SelectedOption" type="IPrintSchemaOption"> + /// Property-set/get maps to COM IPrintSchemaFeature::SelectedOption. + /// </field> + SelectedOption: null, + /// <field name="SelectionType" type="PrintSchemaSelectionType"> + /// Property-get maps to COM IPrintSchemaFeature::SelectionType. + /// </field> + SelectionType: null, + GetOption: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaFeature::GetOption. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="IPrintSchemaOption" /> + }, + /// <field name="DisplayUI" type="Boolean"> + /// Property-get maps to COM IPrintSchemaFeature::DisplayUI. + /// </field> + DisplayUI: null + }); + + +IPrintSchemaPageImageableSize = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaPageImageableSize, + IPrintSchemaElement, + { + /// <field name="ImageableSizeWidthInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeWidthInMicrons. + /// </field> + ImageableSizeWidthInMicrons: null, + /// <field name="ImageableSizeHeightInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeHeightInMicrons. + /// </field> + ImageableSizeHeightInMicrons: null, + /// <field name="OriginWidthInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginWidthInMicrons. + /// </field> + OriginWidthInMicrons: null, + /// <field name="OriginHeightInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginHeightInMicrons. + /// </field> + OriginHeightInMicrons: null, + /// <field name="ExtentWidthInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentWidthInMicrons. + /// </field> + ExtentWidthInMicrons: null, + /// <field name="ExtentHeightInMicrons" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentHeightInMicrons. + /// </field> + ExtentHeightInMicrons: null + }); + + +IPrintSchemaCapabilities = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaCapabilities, + IPrintSchemaElement, + { + GetFeatureByKeyName: function (keyName) { + /// <summary> + /// Method maps to COM IPrintSchemaCapabilities::GetFeatureByKeyName. + /// </summary> + /// <param name="keyName" type="String" /> + /// <returns type="IPrintSchemaFeature" /> + }, + GetFeature: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaCapabilities::GetFeature. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="IPrintSchemaFeature" /> + }, + /// <field name="PageImageableSize" type="IPrintSchemaPageImageableSize"> + /// Property-get maps to COM IPrintSchemaCapabilities::PageImageableSize. + /// </field> + PageImageableSize: null, + /// <field name="JobCopiesAllDocumentsMinValue" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMinValue. + /// </field> + JobCopiesAllDocumentsMinValue: null, + /// <field name="JobCopiesAllDocumentsMaxValue" type="Number" integer="true"> + /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMaxValue. + /// </field> + JobCopiesAllDocumentsMaxValue: null, + GetSelectedOptionInPrintTicket: function (feature) { + /// <summary> + /// Method maps to COM IPrintSchemaCapabilities::GetSelectedOptionInPrintTicket. + /// </summary> + /// <param name="feature" type="IPrintSchemaFeature" /> + /// <returns type="IPrintSchemaOption" /> + }, + GetOptions: function (feature) { + /// <summary> + /// Method maps to COM IPrintSchemaCapabilities::GetOptions. + /// </summary> + /// <param name="feature" type="IPrintSchemaFeature" /> + /// <returns type="IPrintSchemaOptionCollection" /> + } + }); + + +IPrintSchemaTicket = function () { } +v4PrintDriverIntellisense.createInterface( + IPrintSchemaTicket, + IPrintSchemaElement, + { + GetFeatureByKeyName: function (keyName) { + /// <summary> + /// Method maps to COM IPrintSchemaTicket::GetFeatureByKeyName. + /// </summary> + /// <param name="keyName" type="String" /> + /// <returns type="IPrintSchemaFeature" /> + }, + GetFeature: function (name, namespaceUri) { + /// <summary> + /// Method maps to COM IPrintSchemaTicket::GetFeature. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="namespaceUri" type="String" /> + /// <returns type="IPrintSchemaFeature" /> + }, + NotifyXmlChanged: function () { + /// <summary> + /// Method maps to COM IPrintSchemaTicket::NotifyXmlChanged. + /// </summary> + }, + GetCapabilities: function () { + /// <summary> + /// Method maps to COM IPrintSchemaTicket::GetCapabilities. + /// </summary> + /// <returns type="IPrintSchemaCapabilities" /> + }, + /// <field name="JobCopiesAllDocuments" type="Number" integer="true"> + /// Property-get/put maps to IPrintSchemaTicket::JobCopiesAllDocuments. + /// </field> + JobCopiesAllDocuments: null + }); + + +IPrinterScriptableSequentialStream = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptableSequentialStream, + null, + { + Read: function (count) { + /// <summary> + /// Method maps to COM IPrinterScriptableSequentialStream::Read. + /// </summary> + /// <param name="count" type="Number" integer="true" /> + /// <returns type="Array" /> + }, + Write: function (array) { + /// <summary> + /// Method maps to COM IPrinterScriptableSequentialStream::Write. + /// </summary> + /// <param name="array" type="Array" /> + /// <returns type="Number" integer="true"/> + } + }); + +IPrinterScriptableStream = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptableStream, + IPrinterScriptableSequentialStream, + { + Commit: function () { + /// <summary> + /// Method maps to COM IPrinterScriptableStream::Commit. + /// </summary> + }, + Seek: function (offset, streamSeek) { + /// <summary> + /// Method maps to COM IPrinterScriptableStream::Seek + /// </summary> + /// <param name="offset" type="Number" integer="true" /> + /// <param name="streamSeek" type="STREAM_SEEK" /> + /// <returns type="Number" integer="true"/> + }, + SetSize: function (size) { + /// <summary> + /// Method maps to COM IPrinterScriptableStream::SetSize. + /// </summary> + /// <param name="size" type="Number" integer="true" /> + } + }); + + +IPrinterScriptablePropertyBag = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptablePropertyBag, + null, + { + GetBool: function (name) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::GetBool. + /// </summary> + /// <param name="name" type="String" /> + /// <returns type="Boolean" /> + }, + SetBool: function (name, value) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::SetBool. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="value" type="Boolean" /> + }, + GetInt32: function (name) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::GetInt32. + /// </summary> + /// <param name="name" type="String" /> + /// <returns type="Number" integer="true"/> + }, + SetInt32: function (name, value) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::SetInt32. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="value" type="Number" integer="true" /> + }, + GetString: function (name) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::GetString. + /// </summary> + /// <param name="name" type="String" /> + /// <returns type="String" /> + }, + SetString: function (name, value) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::SetString. + /// </summary> + /// <param name="name" type="String" /> + /// <param name="value" type="String" /> + }, + GetReadStream: function (name) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::GetReadStream. + /// </summary> + /// <param name="name" type="String" /> + /// <returns type="IPrinterScriptableStream" /> + }, + GetWriteStream: function (name) { + /// <summary> + /// Method maps to COM IPrinterScriptablePropertyBag::GetWriteStream. + /// </summary> + /// <param name="name" type="String" /> + /// <returns type="IPrinterScriptableStream" /> + } + }); + + +IPrinterScriptContext = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterScriptContext, + null, + { + /// <field name="DriverProperties" type="IPrinterScriptablePropertyBag"> + /// Property-get maps to COM IPrinterScriptContext::DriverProperties. + /// </field> + DriverProperties: null, + /// <field name="QueueProperties" type="IPrinterScriptablePropertyBag"> + /// Property-get maps to COM IPrinterScriptContext::QueueProperties. + /// </field> + QueueProperties: null, + /// <field name="UserProperties" type="IPrinterScriptablePropertyBag"> + /// Property-get maps to COM IPrinterScriptContext::UserProperties. + /// </field> + UserProperties: null + }); + +IPrinterBidiSchemaElement = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterBidiSchemaElement, + null, + { + /// <field name="Name" type="String"> + /// Property-get maps to COM IPrinterBidiSchemaElement::Name. + /// </field> + Name: null, + /// <field type="PrinterBidiSchemaElementType"> + /// Property-get maps to COM IPrinterBidiSchemaElement::BidiType. + /// </field> + BidiType: null, + /// <field type="Object"> + /// Property-get maps to COM IPrinterBidiSchemaElement::Value. + /// </field> + Value: null + }); + +IPrinterBidiSchemaResponses = function () { } +v4PrintDriverIntellisense.createInterface( + IPrinterBidiSchemaResponses, + null, + { + AddNull: function (schema) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddNull. + /// </summary> + /// <param name="schema" type="String" /> + }, + AddString: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddString. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="String" /> + }, + AddText: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddText. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="String" /> + }, + AddEnum: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddEnum. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="String" /> + }, + AddInt32: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddInt32. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="Number" integer="true" /> + }, + AddBool: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddBool. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="Boolean" /> + }, + AddFloat: function (schema, value) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddFloat. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="value" type="Number" /> + }, + AddBlob: function (schema, array) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddBlob. + /// </summary> + /// <param name="schema" type="String" /> + /// <param name="array" type="Array" /> + }, + AddRequeryKey: function (queryKey) { + /// <summary> + /// Method maps to COM IPrinterBidiSchemaResponses::AddRequeryKey. + /// </summary> + /// <param name="queryKey" type="String" /> + } + }); diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/ReadMe.md b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/ReadMe.md new file mode 100644 index 00000000..514015d7 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/ReadMe.md @@ -0,0 +1,47 @@ +WSDMon Bidi Extension Sample +============================ + +This sample demonstrates how to use an XML extension file to support bidirectional (Bidi) communication with a WSD connected printer. + +The v4 print driver model continues to employ the WSDMon Bidi Extension file format, as well as the SNMP Bidi Extension file format. + +**Note** + +Third-party port monitors and language monitors are not supported in the v4 driver model or with print class drivers. + +The WSDMON port monitor is a printer port monitor that supports printing to network printers that comply with the Web Services for Devices (WSD) technology. The WSDMON port monitor listens for WSD events and updates the printer status accordingly. + +A Bidi schema is a hierarchy of printer attributes, some of which are properties and others that are values (or value entries). + +A *property* is a node in the schema hierarchy. A property can have one or more children, and these children can be other properties or values. + +A *value* is a leaf in the schema hierarchy that represents either a single data item or a list of related data items. A value has a name, a data type, and a data value. A value cannot have child elements. + +The WSDMON port monitor can: + +- Discover network printers and install them. + +- Send jobs to WSD printers. + +- Monitor the status and configuration of the WSD printers and update the printer object status accordingly. + +- Respond to bidirectional (bidi) queries for supported bidi schemas. + +- Monitor bidi Schema value changes and send notifications. + +WSDMON supports the following Xcv commands: + +- CleanupPort + +- DeviceID + +- PnPXID + +- ResetCommunication + +- ServiceID + +**Note** This sample is for the v4 print driver model. + +For more information, see [V4 Driver Connectivity Architecture](http://msdn.microsoft.com/en-us/library/windows/hardware/) and [Bidirectional Communication Schema](http://msdn.microsoft.com/en-us/library/windows/hardware/ff545169(v=vs.85).aspx). + diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.sln b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.sln new file mode 100644 index 00000000..7c7318e6 --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WSDMon-Bidi-Extension", "WSDMon-Bidi-Extension.vcxproj", "{F3AE3A42-0F21-4E36-8E5D-F3C399060D3D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F3AE3A42-0F21-4E36-8E5D-F3C399060D3D}.Debug|Win32.ActiveCfg = Debug|Win32 + {F3AE3A42-0F21-4E36-8E5D-F3C399060D3D}.Debug|Win32.Build.0 = Debug|Win32 + {F3AE3A42-0F21-4E36-8E5D-F3C399060D3D}.Release|Win32.ActiveCfg = Release|Win32 + {F3AE3A42-0F21-4E36-8E5D-F3C399060D3D}.Release|Win32.Build.0 = Release|Win32 + {F3AE3A42-0F21-4E36-8E5D-F3C399060D3D}.Debug|x64.ActiveCfg = Debug|x64 + {F3AE3A42-0F21-4E36-8E5D-F3C399060D3D}.Debug|x64.Build.0 = Debug|x64 + {F3AE3A42-0F21-4E36-8E5D-F3C399060D3D}.Release|x64.ActiveCfg = Release|x64 + {F3AE3A42-0F21-4E36-8E5D-F3C399060D3D}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj new file mode 100644 index 00000000..960aff5b --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj @@ -0,0 +1,150 @@ +<?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="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{F3AE3A42-0F21-4E36-8E5D-F3C399060D3D}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + <SupportsPackaging>false</SupportsPackaging> + <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <SampleGuid>{97755429-CC3C-4B58-BC51-A59C619F85C8}</SampleGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverType>None</DriverType> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <OutDir>$(IntDir)</OutDir> + </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </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')" /> + </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')" /> + </ImportGroup> + <ItemGroup Label="WrappedTaskItems" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>WSDMon-Bidi-Extension</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>WSDMon-Bidi-Extension</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>WSDMon-Bidi-Extension</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>WSDMon-Bidi-Extension</TargetName> + </PropertyGroup> + <ItemGroup> + <None Include="WSDMon-Bidi-Extension.xml" /> + </ItemGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <ExceptionHandling> + </ExceptionHandling> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <Inf Exclude="@(Inf)" Include="*.inf" /> + <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> + </ItemGroup> + <ItemGroup> + <None Include="*.txt" Exclude="@(None)" /> + <None Include="*.htm" Exclude="@(None)" /> + <None Include="*.html" Exclude="@(None)" /> + <None Include="*.ico" Exclude="@(None)" /> + <None Include="*.cur" Exclude="@(None)" /> + <None Include="*.bmp" Exclude="@(None)" /> + <None Include="*.dlg" Exclude="@(None)" /> + <None Include="*.rct" Exclude="@(None)" /> + <None Include="*.gif" Exclude="@(None)" /> + <None Include="*.jpg" Exclude="@(None)" /> + <None Include="*.jpeg" Exclude="@(None)" /> + <None Include="*.wav" Exclude="@(None)" /> + <None Include="*.jpe" Exclude="@(None)" /> + <None Include="*.tiff" Exclude="@(None)" /> + <None Include="*.tif" Exclude="@(None)" /> + <None Include="*.png" Exclude="@(None)" /> + <None Include="*.rc2" Exclude="@(None)" /> + <None Include="*.def" Exclude="@(None)" /> + <None Include="*.bat" Exclude="@(None)" /> + <None Include="*.hpj" Exclude="@(None)" /> + <None Include="*.asmx" Exclude="@(None)" /> + </ItemGroup> + <ItemGroup> + <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj.Filters b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj.Filters new file mode 100644 index 00000000..a0f5371f --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj.Filters @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> + <UniqueIdentifier>{97DCB8DD-A2C7-4BC9-9BED-F52D4DEED9F8}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + <UniqueIdentifier>{4499D9A5-12C4-4DCA-863A-080346D0DF6A}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> + <UniqueIdentifier>{7EC62C4F-BCD7-4890-A981-D5F8E1B06D6C}</UniqueIdentifier> + </Filter> + <Filter Include="Driver Files"> + <Extensions>inf;inv;inx;mof;mc;</Extensions> + <UniqueIdentifier>{F8B1D5FC-4292-4BC7-8521-752BFB1BE306}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <None Include="WSDMon-Bidi-Extension.xml"> + <Filter>Resource Files</Filter> + </None> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.xml b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.xml new file mode 100644 index 00000000..1fa1bacd --- /dev/null +++ b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.xml @@ -0,0 +1,79 @@ +<?xml version='1.0'?> +<bidi:Definition xmlns:bidi='http://schemas.microsoft.com/windows/2005/03/printing/bidi'> + <!-- + The schema extension below represents a fictitious printer named 'CustomPrinter', and contains further schema + extensions for a fictitious lamination unit. + --> + <Schema xmlns:cp='http://www.microsoft.com/2013/04/customwsdprinter' xmlns:wprt='http://schemas.microsoft.com/windows/2006/08/wdp/print'> + <Property name='CustomPrinter'> + <!-- + The schema extensions below represent a fictitious lamination unit that may be installed on the CustomPrinter. + The extensions demonstrate various Bidi constructs and operations. + --> + <Property name='LaminationUnit'> + <!-- + Example of an 'Installed' construct: + The 'Installed' construct is used to query if a printer feature is installed. + + In the below example, the 'Installed' construct queries the device to determine if a lamination + unit is installed. + --> + <Installed name='Installed' query='cp:CustomPrinterConfiguration' filter='cp:CustomPrinterConfiguration/cp:Extensions[cp:Name="LaminationUnit"]' drvPrinterEvent='true' /> + + <!-- + Example of a schema element that is read-only i.e. it's value can be retrieved via a Bidi 'Get' action. + The 'Value' construct represents a query that retrieves data for the specified schema element. + + In the below example, the read-only 'pouch level' property is analogous to the ink level, + and queries the number of lamination pouches remaining on the device --> + <Value name='PouchLevel' type='BIDI_INT' query='cp:CustomPrinterConfiguration' filter='cp:CustomPrinterConfiguration/cp:LaminationUnit/cp:PouchLevel' drvPrinterEvent='true'/> + + <!-- + Example of schema element that is write-only i.e. it's value can be set via a Bidi 'Set' action. + The 'accessType' attribute indicates that the schema element's value can be set. + + In the below example, the \CustomPrinter.Maintenance:Clean schema provides a way to clean the lamination unit. + + Note: The Bidi 'Set' action is defined in WS Print v1.2, which must be supported by the device + before this operation can complete successfully. + --> + <Property name='Maintenance'> + <Value name='Clean' type='BIDI_BOOL' query='cp:CustomPrinterConfiguration' filter='cp:CustomPrinterConfiguration/cp:LaminationUnit/cp:Clean' drvPrinterEvent='true' accessType='Set' wsPrintVersion='1.2' /> + </Property> + + <!-- + Example of schema element that is read-write i.e. it's value can be retrieved via a Bidi 'Get' action, + or can be set via a Bidi 'Set' action. + The 'accessType' attribute indicates that the schema element's value can be either retrieved or set. + + In the below example, the \CustomPrinter.LaminationUnit.NumberPouchesUsed property defines how + many pouches are used per lamination job. + + Note: The Bidi 'Set' action is defined in WS Print v1.2, which must be supported by the device + before this operation can complete successfully. + --> + <Value name='NumberPouchesUsed' type='BIDI_INT' query='cp:CustomPrinterConfiguration' filter='cp:CustomPrinterConfiguration/cp:LaminationUnit/cp:NumberPouchesUsed' drvPrinterEvent='true' accessType='GetSet' wsPrintVersion='1.2' /> + + <!-- + Example of a 'List' construct: + This construct represents a string type that comprises a comma-separated list of values. + + In the below example, the query would result in a comma-separated list that contains the types + of lamination pouches supported. + --> + <List name='SupportedPouchTypes' query='cp:CustomPrinterConfiguration' filter='cp:CustomPrinterConfiguration/cp:LaminationUnit/cp:SupportedPouchTypes'/> + + <!-- + Example of a 'Const' construct: + This construct is used for elements that don't change in value. + The construct defines the data type and the value that must be returned. + + In the below example, the constant value 'Type' is set to 'ThermalLaminator', + identifying the type of the lamination unit. It is presumed that this is the + only type of unit supported by this driver, hence it is a constant value. + --> + <Const name='Type' type='BIDI_STRING'>ThermalLaminator</Const> + </Property> + </Property> + </Schema> +</bidi:Definition>
\ No newline at end of file |
