From cbbd53eda55fbdf65f22b5f57c7dbc4b1ea594fd Mon Sep 17 00:00:00 2001 From: alexke-dev <65682333+alexke-dev@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:28:02 -0700 Subject: Remove Print Driver Samples (#1017) * Remove print driver samples. Add README.md to redirect consumers to Print Support App (PSA) development guide. * Remove en-us from URL. --- .../ConstraintScript.js | 679 --------------------- .../ConstraintScript.sln | 34 -- .../ConstraintScript.vcxproj | 209 ------- .../ConstraintScript.vcxproj.Filters | 21 - .../v4PrintDriver-ConstraintScript/README.md | 32 - .../v4PrintDriver-Intellisense-Windows8.1.js | 126 ---- .../v4PrintDriver-Intellisense.js | 513 ---------------- 7 files changed, 1614 deletions(-) delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.sln delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js delete mode 100644 print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense.js (limited to 'print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript') diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js deleted file mode 100644 index 0605efff..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js +++ /dev/null @@ -1,679 +0,0 @@ -// 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 -/// - -// -------------------------------------------------------------------------- -// Note: To disable intellisense for Windows 8.1 APIs, please delete the line below -/// -// -------------------------------------------------------------------------- - -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) { - /// - /// 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. - /// - /// - /// Print ticket to be validated. - /// - /// - /// Script context object. - /// - /// - /// 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). - /// - - 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) { - /// - /// 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. - /// - /// - /// If not 'null', the print ticket's settings are used to customize the print capabilities. - /// - /// - /// Script context object. - /// - /// - /// Print capabilities object to be customized. - /// - - // 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) { - /// - /// 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). - /// - /// - /// Print ticket to be checked for constrained options. - /// - /// - /// true - PageMediaType option and PageMediaSize option are incompatible. - /// false - PageMediaType option and PageMediaSize option are compatible. - /// - - // 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) { - /// - /// Set the value contained in the 'Value' node under a 'Property' - /// or a 'ScoredProperty' node in the print ticket/print capabilities document. - /// - /// - /// The 'Property'/'ScoredProperty' node. - /// - /// - /// The value to be stored under the 'Value' node. - /// - /// - /// First child 'Property' node if found, Null otherwise. - /// - 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) { - /// - /// 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). - /// - /// - /// The parent property node. - /// - /// - /// The namespace in which the property name is defined. - /// - /// - /// The name of the sub-property node. - /// - /// - /// The value to be set in the sub-property node's 'Value' node. - /// - /// - /// Refer setPropertyValue. - /// - if (!parentProperty || - !keywordNamespace || - !subPropertyName) { - return null; - } - var subPropertyNode = getProperty( - parentProperty, - keywordNamespace, - subPropertyName); - return setPropertyValue( - subPropertyNode, - value); -} - -function getScoredProperty(node, keywordNamespace, scoredPropertyName) { - /// - /// Retrieve a 'ScoredProperty' element in a print ticket/print capabilities document. - /// - /// - /// The scope of the search i.e. the parent node. - /// - /// - /// The namespace in which the element's 'name' attribute is defined. - /// - /// - /// The ScoredProperty's 'name' attribute (without the namespace prefix). - /// - /// - /// The node on success, 'null' on failure. - /// - - // 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) { - /// - /// Retrieve a 'Property' element in a print ticket/print capabilities document. - /// - /// - /// The scope of the search i.e. the parent node. - /// - /// - /// The namespace in which the element's 'name' attribute is defined. - /// - /// - /// The Property's 'name' attribute (without the namespace prefix). - /// - /// - /// The node on success, 'null' on failure. - /// - return searchByAttributeName( - node, - psfPrefix + ":Property", - keywordNamespace, - propertyName); -} - -function setSelectedOptionName(printSchemaFeature, keywordPrefix, optionName) { - /// - /// 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. - /// - /// - /// Feature variable. - /// - /// - /// The prefix for the optionName parameter. - /// - /// - /// The name (without prefix) to set as the 'name' attribute. - /// - if (!printSchemaFeature || - !printSchemaFeature.SelectedOption || - !printSchemaFeature.SelectedOption.XmlNode) { - return; - } - printSchemaFeature.SelectedOption.XmlNode.setAttribute( - "name", - keywordPrefix + ":" + optionName); -} - - -////************************************************************* -//// * -//// Functions used by utility functions * -//// * -////************************************************************* - -function getPropertyFirstValueNode(propertyNode) { - /// - /// Retrieve the first 'value' node found under a 'Property' or 'ScoredProperty' node. - /// - /// - /// The 'Property'/'ScoredProperty' node. - /// - /// - /// The 'Value' node on success, 'null' on failure. - /// - 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) { - /// - /// 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'. - /// - /// - /// Scope of the search i.e. the parent node. - /// - /// - /// Restrict the searches to elements with this tag name. - /// - /// - /// The namespace in which the element's name is defined. - /// - /// - /// The 'name' attribute to search for. - /// - /// - /// IXMLDOMNode on success, 'null' on failure. - /// - 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) { - /// - /// This function sets the 'SelectionNamespaces' property on the XML Node. - /// For more details: http://msdn.microsoft.com/en-us/library/ms756048(VS.85).aspx - /// - /// - /// The node on which the property is set. - /// - /// - /// The prefix to be associated with the namespace. - /// - /// - /// The namespace to be added to SelectionNamespaces. - /// - xmlNode.setProperty( - "SelectionNamespaces", - "xmlns:" - + prefix - + "='" - + namespace - + "'" - ); -} - -function getPrefixForNamespace(node, namespace) { - /// - /// 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" - /// - /// - /// A node in the XML document. - /// - /// - /// The namespace for which prefix is returned. - /// - /// - /// Returns the namespace corresponding to the prefix. - /// - - 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) { - /// - /// Determines if the IPrintSchemaCapabilities2 APIs are supported on the 'printCapabilities' object. - /// - /// - /// Print capabilities object. - /// - /// - /// true - the interface APIs are supported. - /// false - the interface APIs are not supported. - /// - - var supported = true; - - try { - if (typeof printCapabilities.getParameterDefinition === "undefined") { - supported = false; - } - } - catch (exception) { - supported = false; - } - - return supported; - }, - supportsIPrintSchemaTicket2: function(printTicket) { - /// - /// Determines if the IPrintSchemaTicket2 APIs are supported on the 'printTicket' object. - /// - /// - /// Print ticket object. - /// - /// - /// true - the interface APIs are supported. - /// false - the interface APIs are not supported. - /// - - 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 deleted file mode 100644 index 67e9e904..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.sln +++ /dev/null @@ -1,34 +0,0 @@ - -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", "{6701474B-F8FF-4260-BFA6-3CA57816EF12}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - Debug|ARM64 = Debug|ARM64 - Release|ARM64 = Release|ARM64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|Win32.ActiveCfg = Debug|Win32 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|Win32.Build.0 = Debug|Win32 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|Win32.ActiveCfg = Release|Win32 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|Win32.Build.0 = Release|Win32 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|x64.ActiveCfg = Debug|x64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|x64.Build.0 = Debug|x64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|x64.ActiveCfg = Release|x64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|x64.Build.0 = Release|x64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|ARM64.Build.0 = Debug|ARM64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|ARM64.ActiveCfg = Release|ARM64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|ARM64.Build.0 = Release|ARM64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj deleted file mode 100644 index 911bad57..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj +++ /dev/null @@ -1,209 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - Debug - ARM64 - - - Release - ARM64 - - - - {6701474B-F8FF-4260-BFA6-3CA57816EF12} - $(MSBuildProjectName) - false - Debug - Win32 - {1037647C-EC47-4C60-ADA7-815F653774D9} - - - - Windows10 - False - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - Windows10 - True - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - Windows10 - False - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - Windows10 - True - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - Windows10 - False - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - Windows10 - True - Desktop - None - WindowsKernelModeDriver10.0 - Utility - - - - $(IntDir) - - - - - - - - - - - - - - - - - - - - - - ConstraintScript - - - ConstraintScript - - - ConstraintScript - - - ConstraintScript - - - ConstraintScript - - - ConstraintScript - - - - - - - - - - - sha256 - - - - - - - - - sha256 - - - - - - - - - sha256 - - - - - - - - - sha256 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters deleted file mode 100644 index a953801e..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {E5E0E095-07E3-475A-B3A9-CDFFB0B251D5} - - - h;hpp;hxx;hm;inl;inc;xsd - {DCAD2131-1F10-4E17-8798-E0D2C3CBABE9} - - - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {14445C2D-F6CE-4302-8FE1-C245A9C8D403} - - - inf;inv;inx;mof;mc; - {69EDD4E4-1B0E-40AE-BDFE-A245F90B384C} - - - \ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md deleted file mode 100644 index a98abd5f..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -page_type: sample -description: "Demonstrates how to implement advanced constraint handling and PrintTicket/PrintCapabilities handling using JavaScript." -languages: -- javascript -products: -- windows -- windows-wdk ---- - -# 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](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/printerextension/nn-printerextension-iprintschematicket) 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](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/printerextension/nn-printerextension-iprintschemacapabilities) 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 with Visual Studio and the WDK](https://docs.microsoft.com/windows-hardware/drivers/develop/building-a-driver) - -[IPrintSchemaCapabilities](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/printerextension/nn-printerextension-iprintschemacapabilities) - -[IPrintSchemaTicket](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/printerextension/nn-printerextension-iprintschematicket) diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js deleted file mode 100644 index bbbc31a0..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js +++ /dev/null @@ -1,126 +0,0 @@ -/// - -v4PrintDriverIntellisense.appendInterfaceMethods( - IPrintSchemaTicket, - { - GetParameterInitializer: function (name, namespaceUri) { - /// - /// Method maps to COM IPrintSchemaTicket2::GetParameterInitializer. - /// - /// - /// - /// - } - }); - -v4PrintDriverIntellisense.appendInterfaceMethods( - IPrintSchemaCapabilities, - { - GetParameterDefinition: function (name, namespaceUri) { - /// - /// Method maps to COM IPrintSchemaCapabilities2::GetParameterDefinition. - /// - /// - /// - /// - } - }); - -IPrintSchemaParameterInitializer = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaParameterInitializer, - IPrintSchemaElement, - { - /// - /// Property-get/set maps to COM IPrintSchemaParameterInitializer::Value. - /// - Value: null, - }); - -IPrintSchemaParameterDefinition = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaParameterDefinition, - IPrintSchemaDisplayableElement, - { - /// - /// Property-get maps to COM IPrintSchemaParameterDefinition::UserInputRequired. - /// - UserInputRequired: null, - /// - /// Property-get maps to COM IPrintSchemaParameterDefinition::UnitType. - /// - UnitType: null, - /// - /// Property-get maps to COM IPrintSchemaParameterDefinition::DataType. - /// - DataType: null, - /// - /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMin. - /// - RangeMin: null, - /// - /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMax. - /// - RangeMax: null - }); - -IPrinterScriptUsbJobContextReturnCodes = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbJobContextReturnCodes, - null, - { - /// - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Success. - /// - Success: null, - /// - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Failure. - /// - Failure: null, - /// - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Retry. - /// - Retry: null, - /// - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::DeviceBusy. - /// - DeviceBusy: null, - /// - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::AbortTheJob. - /// - AbortTheJob: null - }); - -IPrinterScriptUsbWritePrintDataProgress = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbWritePrintDataProgress, - null, - { - /// - /// Property-get/set maps to COM IPrinterScriptUsbWritePrintDataProgress::ProcessedByteCount. - /// - ProcessedByteCount: null - }); - -IPrinterScriptUsbJobContext = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbJobContext, - null, - { - /// - /// Property-get maps to COM IPrinterScriptUsbJobContext::JobPropertyBag. - /// - JobPropertyBag: null, - /// - /// Property-get maps to COM IPrinterScriptUsbJobContext::ReturnCodes. - /// - ReturnCodes: null, - /// - /// Property-get maps to COM IPrinterScriptUsbJobContext::TemporaryStreams. Provides an array of IPrinterScriptableSequentialStream. - /// - TemporaryStreams: null, - /// - /// Property-get/set maps to COM IPrinterScriptUsbJobContext::PrintedPageCount. - /// - 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 deleted file mode 100644 index 2386541d..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense.js +++ /dev/null @@ -1,513 +0,0 @@ -// 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 = { - /// Intended for use by v4 print driver JavaScript Intellisense. - createInterface: function (childInterface, baseType, prototype) { - /// Intended for use by v4 print driver JavaScript Intellisense. - childInterface.__class = true; - - if (prototype) { - childInterface.prototype = prototype; - } - - if (baseType) { - childInterface.__baseType = baseType; - childInterface.__basePrototypePending = true; - v4PrintDriverIntellisense.resolveInheritance(childInterface); - } - }, - appendInterfaceMethods: function (baseType, prototype) { - /// Intended for use by v4 print driver JavaScript Intellisense. - for (var memberName in prototype) { - baseType.prototype[memberName] = prototype[memberName]; - } - }, - resolveInheritance: function (childInterface) { - /// Intended for use by v4 print driver JavaScript Intellisense. - 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, - { - /// - /// Property-get maps to COM IPrintSchemaElement::XmlNode. - /// - XmlNode: null, - /// - /// Property-get maps to COM IPrintSchemaElement::Name. - /// - Name: null, - /// - /// Property-get maps to COM IPrintSchemaElement::NamespaceUri. - /// - NamespaceUri: null - }); - -IPrintSchemaDisplayableElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaDisplayableElement, - IPrintSchemaElement, - { - /// - /// Property-get maps to COM IPrintSchemaDisplayableElement::DisplayName. - /// - DisplayName: null - }); - - -IPrintSchemaOption = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaOption, - IPrintSchemaDisplayableElement, - { - /// - /// Property-get maps to COM IPrintSchemaOption::Selected. - /// - Selected: null, - /// - /// Property-get maps to COM IPrintSchemaOption::Constrained. - /// - Constrained: null, - GetPropertyValue: function (name, namespaceUri) { - /// - /// Method maps to COM IPrintSchemaOption::GetPropertyValue. - /// - /// - /// - /// - }, - /// - /// Property-get maps to COM IPrintSchemaNUpOption::PagesPerSheet. Valid for NUp option only. - /// - PagesPerSheet: null, - /// - /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::WidthInMicrons. Valid for PageMediaSize option only. - /// - WidthInMicrons: null, - /// - /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::HeightInMicrons. Valid for PageMediaSize option only. - /// - HeightInMicrons: null - - }); - -IPrintSchemaOptionCollection = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaOptionCollection, - null, - { - /// - /// Property-get maps to COM IPrintSchemaOptionCollection::Count. - /// - Count: null, - GetAt: function (index) { - /// - /// Property-get maps to COM IPrintSchemaOptionCollection::GetAt. - /// - /// - /// - } - }); - - -IPrintSchemaFeature = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaFeature, - IPrintSchemaDisplayableElement, - { - /// - /// Property-set/get maps to COM IPrintSchemaFeature::SelectedOption. - /// - SelectedOption: null, - /// - /// Property-get maps to COM IPrintSchemaFeature::SelectionType. - /// - SelectionType: null, - GetOption: function (name, namespaceUri) { - /// - /// Method maps to COM IPrintSchemaFeature::GetOption. - /// - /// - /// - /// - }, - /// - /// Property-get maps to COM IPrintSchemaFeature::DisplayUI. - /// - DisplayUI: null - }); - - -IPrintSchemaPageImageableSize = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaPageImageableSize, - IPrintSchemaElement, - { - /// - /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeWidthInMicrons. - /// - ImageableSizeWidthInMicrons: null, - /// - /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeHeightInMicrons. - /// - ImageableSizeHeightInMicrons: null, - /// - /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginWidthInMicrons. - /// - OriginWidthInMicrons: null, - /// - /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginHeightInMicrons. - /// - OriginHeightInMicrons: null, - /// - /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentWidthInMicrons. - /// - ExtentWidthInMicrons: null, - /// - /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentHeightInMicrons. - /// - ExtentHeightInMicrons: null - }); - - -IPrintSchemaCapabilities = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaCapabilities, - IPrintSchemaElement, - { - GetFeatureByKeyName: function (keyName) { - /// - /// Method maps to COM IPrintSchemaCapabilities::GetFeatureByKeyName. - /// - /// - /// - }, - GetFeature: function (name, namespaceUri) { - /// - /// Method maps to COM IPrintSchemaCapabilities::GetFeature. - /// - /// - /// - /// - }, - /// - /// Property-get maps to COM IPrintSchemaCapabilities::PageImageableSize. - /// - PageImageableSize: null, - /// - /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMinValue. - /// - JobCopiesAllDocumentsMinValue: null, - /// - /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMaxValue. - /// - JobCopiesAllDocumentsMaxValue: null, - GetSelectedOptionInPrintTicket: function (feature) { - /// - /// Method maps to COM IPrintSchemaCapabilities::GetSelectedOptionInPrintTicket. - /// - /// - /// - }, - GetOptions: function (feature) { - /// - /// Method maps to COM IPrintSchemaCapabilities::GetOptions. - /// - /// - /// - } - }); - - -IPrintSchemaTicket = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaTicket, - IPrintSchemaElement, - { - GetFeatureByKeyName: function (keyName) { - /// - /// Method maps to COM IPrintSchemaTicket::GetFeatureByKeyName. - /// - /// - /// - }, - GetFeature: function (name, namespaceUri) { - /// - /// Method maps to COM IPrintSchemaTicket::GetFeature. - /// - /// - /// - /// - }, - NotifyXmlChanged: function () { - /// - /// Method maps to COM IPrintSchemaTicket::NotifyXmlChanged. - /// - }, - GetCapabilities: function () { - /// - /// Method maps to COM IPrintSchemaTicket::GetCapabilities. - /// - /// - }, - /// - /// Property-get/put maps to IPrintSchemaTicket::JobCopiesAllDocuments. - /// - JobCopiesAllDocuments: null - }); - - -IPrinterScriptableSequentialStream = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptableSequentialStream, - null, - { - Read: function (count) { - /// - /// Method maps to COM IPrinterScriptableSequentialStream::Read. - /// - /// - /// - }, - Write: function (array) { - /// - /// Method maps to COM IPrinterScriptableSequentialStream::Write. - /// - /// - /// - } - }); - -IPrinterScriptableStream = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptableStream, - IPrinterScriptableSequentialStream, - { - Commit: function () { - /// - /// Method maps to COM IPrinterScriptableStream::Commit. - /// - }, - Seek: function (offset, streamSeek) { - /// - /// Method maps to COM IPrinterScriptableStream::Seek - /// - /// - /// - /// - }, - SetSize: function (size) { - /// - /// Method maps to COM IPrinterScriptableStream::SetSize. - /// - /// - } - }); - - -IPrinterScriptablePropertyBag = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptablePropertyBag, - null, - { - GetBool: function (name) { - /// - /// Method maps to COM IPrinterScriptablePropertyBag::GetBool. - /// - /// - /// - }, - SetBool: function (name, value) { - /// - /// Method maps to COM IPrinterScriptablePropertyBag::SetBool. - /// - /// - /// - }, - GetInt32: function (name) { - /// - /// Method maps to COM IPrinterScriptablePropertyBag::GetInt32. - /// - /// - /// - }, - SetInt32: function (name, value) { - /// - /// Method maps to COM IPrinterScriptablePropertyBag::SetInt32. - /// - /// - /// - }, - GetString: function (name) { - /// - /// Method maps to COM IPrinterScriptablePropertyBag::GetString. - /// - /// - /// - }, - SetString: function (name, value) { - /// - /// Method maps to COM IPrinterScriptablePropertyBag::SetString. - /// - /// - /// - }, - GetReadStream: function (name) { - /// - /// Method maps to COM IPrinterScriptablePropertyBag::GetReadStream. - /// - /// - /// - }, - GetWriteStream: function (name) { - /// - /// Method maps to COM IPrinterScriptablePropertyBag::GetWriteStream. - /// - /// - /// - } - }); - - -IPrinterScriptContext = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptContext, - null, - { - /// - /// Property-get maps to COM IPrinterScriptContext::DriverProperties. - /// - DriverProperties: null, - /// - /// Property-get maps to COM IPrinterScriptContext::QueueProperties. - /// - QueueProperties: null, - /// - /// Property-get maps to COM IPrinterScriptContext::UserProperties. - /// - UserProperties: null - }); - -IPrinterBidiSchemaElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterBidiSchemaElement, - null, - { - /// - /// Property-get maps to COM IPrinterBidiSchemaElement::Name. - /// - Name: null, - /// - /// Property-get maps to COM IPrinterBidiSchemaElement::BidiType. - /// - BidiType: null, - /// - /// Property-get maps to COM IPrinterBidiSchemaElement::Value. - /// - Value: null - }); - -IPrinterBidiSchemaResponses = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterBidiSchemaResponses, - null, - { - AddNull: function (schema) { - /// - /// Method maps to COM IPrinterBidiSchemaResponses::AddNull. - /// - /// - }, - AddString: function (schema, value) { - /// - /// Method maps to COM IPrinterBidiSchemaResponses::AddString. - /// - /// - /// - }, - AddText: function (schema, value) { - /// - /// Method maps to COM IPrinterBidiSchemaResponses::AddText. - /// - /// - /// - }, - AddEnum: function (schema, value) { - /// - /// Method maps to COM IPrinterBidiSchemaResponses::AddEnum. - /// - /// - /// - }, - AddInt32: function (schema, value) { - /// - /// Method maps to COM IPrinterBidiSchemaResponses::AddInt32. - /// - /// - /// - }, - AddBool: function (schema, value) { - /// - /// Method maps to COM IPrinterBidiSchemaResponses::AddBool. - /// - /// - /// - }, - AddFloat: function (schema, value) { - /// - /// Method maps to COM IPrinterBidiSchemaResponses::AddFloat. - /// - /// - /// - }, - AddBlob: function (schema, array) { - /// - /// Method maps to COM IPrinterBidiSchemaResponses::AddBlob. - /// - /// - /// - }, - AddRequeryKey: function (queryKey) { - /// - /// Method maps to COM IPrinterBidiSchemaResponses::AddRequeryKey. - /// - /// - } - }); -- cgit v1.3.1