How to support user customize page in Print Support APP?

piggy lazy 5 Reputation points
2023-03-17T09:38:24.09+00:00

I am working on the Print Support APP. We need the printer support user customized paper size. Unfortunately, the Microsoft's Print-support-app-design-guide documentation do not mention how to implementation this function.

Followed by the document named Print Schema Specification v2.0,I insert a xml node (listed below) as child of psk:PageMediaSize node within event handler of PrintDeviceCapabilitiesChanged.

<psk:CustomMediaSize psf2:psftype=""Option""  psf2:default=""false"">
  <psk12:LeftImageableMargin psf2:psftype=""Property"" xsi:type=""xsd:integer"">0</psk12:LeftImageableMargin>
  <psk12:RightImageableMargin psf2:psftype=""Property"" xsi:type=""xsd:integer"">0</psk12:RightImageableMargin>
  <psk12:TopImageableMargin psf2:psftype=""Property"" xsi:type=""xsd:integer"">0</psk12:TopImageableMargin>
  <psk12:BottomImageableMargin psf2:psftype=""Property"" xsi:type=""xsd:integer"">0</psk12:BottomImageableMargin>
  <psk:MediaSizeHeight psf2:psftype=""ScoredProperty"" xsi:type=""psf:ParameterRef"">psk:PageMediaSizeMediaSizeHeight</psk:MediaSizeHeight>
  <psk:MediaSizeWidth psf2:psftype=""ScoredProperty"" xsi:type=""psf:ParameterRef"">psk:PageMediaSizeMediaSizeWidth</psk:MediaSizeWidth>
</psk:CustomMediaSize>

After that, the suitable customized pages are added into Capabilities. But there has a problem: the display name is not correctly for those paper! All the names are same, NOT the name when user create it!

The XML of PageMediaSize Feature got at windows.printSupportSettingsUI extention is:

<psf:Feature xmlns:psf="http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework" name="psk:PageMediaSize"> 
  <psf:Property name="psf:SelectionType"><psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:QName">psk:PickOne</psf:Value></psf:Property>
  <psf:Property name="psk:DisplayName"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">纸张大小</psf:Value> </psf:Property>

  <psf:Option name="psk:NorthAmericaLegal" constrained="psk:None">
    <psf:ScoredProperty name="psk:MediaSizeWidth"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">215900</psf:Value> </psf:ScoredProperty>
    <psf:ScoredProperty name="psk:MediaSizeHeight"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">355600</psf:Value> </psf:ScoredProperty>
    <psf:Property name="psk:DisplayName"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">法律专用纸</psf:Value> </psf:Property>
  </psf:Option>

  <psf:Option name="psk:ISOA4" constrained="psk:None">
    <psf:ScoredProperty name="psk:MediaSizeWidth"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">210000</psf:Value> </psf:ScoredProperty>
    <psf:ScoredProperty name="psk:MediaSizeHeight"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">297000</psf:Value> </psf:ScoredProperty>
    <psf:Property name="psk:DisplayName"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">A4</psf:Value> </psf:Property>
  </psf:Option>

  <psf:Option name="ns0000:UserForm144" constrained="psk:None">
    <psf:ScoredProperty name="psk:MediaSizeWidth"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">50800</psf:Value> </psf:ScoredProperty>
    <psf:ScoredProperty name="psk:MediaSizeHeight"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">127000</psf:Value> </psf:ScoredProperty>
    <psf:Property name="psk:DisplayName"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">用户定义大小</psf:Value> </psf:Property>
  </psf:Option>

  <psf:Option name="ns0000:UserForm145" constrained="psk:None">
    <psf:ScoredProperty name="psk:MediaSizeWidth"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">101600</psf:Value> </psf:ScoredProperty>
    <psf:ScoredProperty name="psk:MediaSizeHeight"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">101600</psf:Value> </psf:ScoredProperty>
    <psf:Property name="psk:DisplayName"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">用户定义大小</psf:Value> </psf:Property>
  </psf:Option>

  <psf:Option name="ns0000:UserForm146" constrained="psk:None">
    <psf:ScoredProperty name="psk:MediaSizeWidth"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">101600</psf:Value> </psf:ScoredProperty>
    <psf:ScoredProperty name="psk:MediaSizeHeight"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">50800</psf:Value> </psf:ScoredProperty>
    <psf:Property name="psk:DisplayName"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">用户定义大小</psf:Value> </psf:Property>
  </psf:Option>

  <psf:Option name="ns0000:UserForm148" constrained="psk:None">
    <psf:ScoredProperty name="psk:MediaSizeWidth"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">254000</psf:Value> </psf:ScoredProperty>
    <psf:ScoredProperty name="psk:MediaSizeHeight"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">279400</psf:Value> </psf:ScoredProperty>
    <psf:Property name="psk:DisplayName"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">用户定义大小</psf:Value> </psf:Property>
  </psf:Option>

  <psf:Option name="ns0000:UserForm153" constrained="psk:None">
    <psf:ScoredProperty name="psk:MediaSizeWidth"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">101600</psf:Value> </psf:ScoredProperty>
    <psf:ScoredProperty name="psk:MediaSizeHeight"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">50800</psf:Value> </psf:ScoredProperty>
    <psf:Property name="psk:DisplayName"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">用户定义大小</psf:Value> </psf:Property>
  </psf:Option>

  <psf:Option name="ns0000:UserForm154" constrained="psk:None">
    <psf:ScoredProperty name="psk:MediaSizeWidth"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">101600</psf:Value> </psf:ScoredProperty>
    <psf:ScoredProperty name="psk:MediaSizeHeight"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">50800</psf:Value> </psf:ScoredProperty>
    <psf:Property name="psk:DisplayName"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">用户定义大小</psf:Value> </psf:Property>
  </psf:Option>

  <psf:Option name="psk:CustomMediaSize" constrained="psk:None">
    <psf:Property name="psk:DisplayName"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">用户定义大小</psf:Value> </psf:Property>
    <psf:ScoredProperty name="psk:MediaSizeWidth"> <psf:ParameterRef name="psk:PageMediaSizeMediaSizeWidth"/> </psf:ScoredProperty>
    <psf:ScoredProperty name="psk:MediaSizeHeight"> <psf:ParameterRef name="psk:PageMediaSizeMediaSizeHeight"/> </psf:ScoredProperty>
    <psf:Property name="ns0002:LeftImageableMargin"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">0</psf:Value> </psf:Property>
    <psf:Property name="ns0002:RightImageableMargin"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">0</psf:Value> </psf:Property>
    <psf:Property name="ns0002:TopImageableMargin"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">0</psf:Value> </psf:Property>
    <psf:Property name="ns0002:BottomImageableMargin"> <psf:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:integer">0</psf:Value> </psf:Property>
  </psf:Option>

 </psf:Feature>

All the Option which name start with ns000:UserForm are user defined page. The DisplayName is same as "用户定义大小" which should be "User defined size" in English.

Those DisplayName shows on UI:

PSA

How to solve this problem?

Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,690 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,736 Reputation points
    2023-03-20T14:06:14.33+00:00

    Hello there,

    Do your device allow "user-defined paper size"?

    For printers that do not support the characteristics required for specifying customized paper size ranges explicitly, an alternate method is provided, which specifies paper sizes relative to the printer's largest paper size.

    To use this method, your GPD file's PaperSize feature must include an *Option entry with a CUSTOMSIZE argument. This entry must contain the following option attributes:

    *MinSize *MaxSize *MaxPrintableWidth *CustCursorOriginX *CustCursorOriginX *CustPrintableOriginX *CustPrintableOriginY *CustPrintableSizeX *CustPrintableSizeY *Command When specifying a size range relative to the printer's largest paper size

    Supporting User-Defined Paper Sizes https://learn.microsoft.com/en-us/windows-hardware/drivers/print/supporting-user-defined-paper-sizes

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer–


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.