none
How to Customize print setting (WSDA) RRS feed

  • Question

  • hello 

    I have a metro app in which I have a device( 3Dprinter) associated with the app via its device meta data. I can enumerate the associated printers and display in app which is showing 3D features from my GPD file (thease features are in different namespace uri) below code shows what i have done


     _features = ref new Platform::Collections::Vector<Platform::String^>;
     _features->Append("Job3DQuality");
     _features->Append("Job3DDensity");
     _features->Append("Job3DSupports");
     _features->Append("Job3DMaterialType");


     below code shows all these features exist in printcpability document. 
     if (!printHelper->FeatureExists(feature))
     {
                rootPage->AddMessage(feature + ": feature does not exist");
                continue;
     }

    // for printcapability
    static wchar_t *g_pwszHeaderNS = L"http://schemas.microsoft.com/3dmanufacturing/2013/01/pskeywords3d";
    BSTR bstrNamespaceURI = SysAllocString(g_pwszHeaderNS);
     HRESULT hr = _spCapabilities->GetFeature(bstrFeature, bstrNamespaceURI, &spFeature);

    //for printticket
     static wchar_t *g_pwszHeaderNS1 = L"http://schemas.fabrikam.com/3MF/2013/01";
     BSTR bstrNamespaceURI1 = SysAllocString(g_pwszHeaderNS1);
     hr = _spTicket->GetFeature(bstrFeature, bstrNamespaceURI1, &spTicketFeature);

    both thease functions shows success result code .

     After submitting the job result is showing "PrintTicket saved successfully" but it is generating printicket 
    with default option in .gpd file not with my selected option from metro app.

     The app is from the metro sample collection "Device app for printers SDK sample(Print settings and print notifications)".

    so can you please tell me where i am going wrong . is there any changes i will have to do in metro app to add features which comes with different namespace uri.

    any quick help will be appreciated..!

       
    Saturday, April 26, 2014 7:25 AM

All replies

  • I believe the error is caused by your v4 print driver. If you are using the v4 sample driver from the SDK, the sample driver in the SDK is incomplete in that it does not implement the function convertDevModeToPrintTicket in the FabrikamPrintDriverV4-constraints.js file.

    Here is a sample implementation based off the rest of the v4 sample in the SDK.

    // file FabrikamPrintDriverV4-constraints.js

    function convertDevModeToPrintTicket(devModeProperties, scriptContext, printTicket) {

        /// <param name="devModeProperties" type="IPrinterScriptablePropertyBag">

        ///     The DevMode property bag.

        /// </param>

        /// <param name="scriptContext" type="IPrinterScriptContext">

        ///     Script context object.

        /// </param>

        /// <param name="printTicket" type="IPrintSchemaTicket">

        ///     Print ticket to be converted from the DevMode.

        /// </param>

        var printTicket = printTicket.XmlNode;

        var Root;

        // find psf:PrintCapabilities

        for (var ChildCount = 0; ChildCount < printTicket.childNodes.length; ChildCount++) {

            Root = printTicket.childNodes.item(ChildCount);

            if (Root.nodeName == "psf:PrintTicket") {

                // Add new attribute xmlns:psk3d="http://schemas.microsoft.com/3dmanufacturing/2013/01/pskeywords3d""

                Root.setAttribute("xmlns:psk3d", psk3dNs.toString());

                //            debug.innerHTML +=  psk3dNs.toString() + "<br>";

            }

        }

        // psk3d:Job3DToolCount

        navigateAndUpdateDOM(Root);

    }

    You will also need to ensure that the V4 print driver manifest indicates that the dev mode map is enabled. Also include this in the inf so its copied over as part of the driver package.

    // changes to be made in the manifest FabrikamPrintDriverV4-manifest.ini

    [DriverConfig]

    DataFile=FabrikamPrintDriverV4.gpd

    PrinterDriverID={eca54d3f-0919-4572-9b69-3020d8f86892}

    ConstraintScript=FabrikamPrintDriverV4-Constraints.js

    RequiredFiles=UNIRES.DLL,STDNAMES.GPD,MSXPSINC.GPD

    DriverCategory=PrintFax.Printer.3d

    DevModeMap=v4-DevModeMap.xml

    Flags=HostBasedDevice

    //changes to be made in the FabrikamPrintDriverV4.inf

    [FabrikamPrintDriverV4_FILES]

    v4-DevModeMap.xml

    [SourceDisksFiles]

    v4-DevModeMap.xml=1

    More information on the dev mode map is located here

    http://msdn.microsoft.com/en-us/library/windows/hardware/jj218738(v=vs.85).aspx

    With these changes the print ticket will match the namespace seen in the print capabilities.

    Tuesday, September 2, 2014 10:16 PM