diff options
| author | Adonais Romero González <[email protected]> | 2024-05-06 16:21:31 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-05-06 16:21:31 -0700 |
| commit | a74a241c664c4e1d7c0838287b34076c19d9858a (patch) | |
| tree | 6ff7562612967b122acf8acf8a69c4dcfd5905db /print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript | |
| parent | def8e8e34ed2b7b1deb2fc9112ac4255f1a0f2ba (diff) | |
| parent | 15477ce52bbb6b42ca591ecdfb484cac089f89ab (diff) | |
Merge develop changes prior to upcoming WDK release (May 2024)
Diffstat (limited to 'print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript')
7 files changed, 0 insertions, 1614 deletions
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 -/// <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 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 @@ -<?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> - <ProjectConfiguration Include="Debug|ARM64"> - <Configuration>Debug</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM64"> - <Configuration>Release</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{6701474B-F8FF-4260-BFA6-3CA57816EF12}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <SupportsPackaging>false</SupportsPackaging> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{1037647C-EC47-4C60-ADA7-815F653774D9}</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> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <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|ARM64'"> - <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> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <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> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <TargetName>ConstraintScript</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <TargetName>ConstraintScript</TargetName> - </PropertyGroup> - <ItemGroup> - <None Include="ConstraintScript.js" /> - </ItemGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inf" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </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 deleted file mode 100644 index a953801e..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters +++ /dev/null @@ -1,21 +0,0 @@ -<?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>{E5E0E095-07E3-475A-B3A9-CDFFB0B251D5}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{DCAD2131-1F10-4E17-8798-E0D2C3CBABE9}</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>{14445C2D-F6CE-4302-8FE1-C245A9C8D403}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{69EDD4E4-1B0E-40AE-BDFE-A245F90B384C}</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 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 @@ -/// <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 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 = { - /// <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" /> - } - }); |
