330 likes | 1.67k Vues
PrintTicket and PrintCapabilities: Overview of Communications Schema and API. Outline. Print Schema, PrintTicket and PrintCapabilities Overview PrintTicket/PrintCapabilities Implementation Details Application Support Driver Requirements and Services Call to Action. Goals.
E N D
PrintTicket and PrintCapabilities:Overview of Communications Schemaand API
Outline • Print Schema, PrintTicket and PrintCapabilities Overview • PrintTicket/PrintCapabilities Implementation Details • Application Support • Driver Requirements and Services • Call to Action
Goals • Define benefits for adoption of Print Schema • Define the PrintSchema and PrintTicket/PrintCapabilities • Understand interaction of technologies • Understand information flow • Communicate the requirements to implement PT/PC in a driver • Changes to existing drivers • System services to assist PT/PC support
Print Settings and Capabilities Today • Limited App to Driver Communication • Device capabilities – Win32 DeviceCapabilities() API • Binary, non-extensible • Job formatting settings - DEVMODE • Binary, opaque, inconsistent, non-portable • No handling of user intent • No consistency between capability and formatting representation • Pain Points • Application and driver UI and settings mismatch • Application are unable to determine full capabilities of drivers
Planned Windows Longhorn Print Settings and Capabilities • Print Schema • XML Schema for print settings and capabilities • Print Schema Framework • Enables rich expression of print capabilities • Enables intelligent validation of print settings and user intent • Print Schema Keywords • Publicly defined keywords to represent device capabilities and settings • Supports private extensions
Planned Windows Longhorn Print Settings and Capabilities • Print Schema Keyword Scoping • Keywords are “scoped” to levels in a hierarchy • Job > Document > Page • Keywords can be inherited from higher levels • E.g. DocumentDuplex settings can be inherited from the Job level to the Document level • Keywords can be overridden from lower levels • E.g. PageMediaSize settings from a Page level will override a PageMediaSize setting from a Job or Document level
Windows Longhorn Print Settings and Capabilities • PrintTicket and PrintCapabilities (PT/PC) • Implement the Print Schema on the Windows platform • PrintTicket • Specify and persist print job formatting information • Function parallels current binary DEVMODE structure • PrintCapabilities • Publish configurable device attributes • Function parallels current Win32 DeviceCapabilities API
Print Driver Support for PT/PC • Print Driver Provider interface • Enables drivers to support PT/PC functionality • Plug-in interface for Unidrv and PScript5 drivers • Enables plug-ins to extend core driver PT/PC functionality • GPD/PPD to Print Schema Custom Mapping • Enables translation of GPD/PPD specified keywords to Print Schema equivalents • Support for all Version 3 print drivers - including MetroDrv drivers
Application Support for PT/PC • Win32 API • Enables Win32 applications to • Query PrintCapabilities • Merge and validate PrintTickets • Convert between PrintTickets and DEVMODEs • WinFX API • API supports Win32 functionality for WinFX applications • Additional convenience objects partially wrap XML data to simplify application access • Advanced features and private keywords require XML manipulation • Win32 and WinFX APIs make it easy for applications to adopt PT/PC
Metro Supportfor PT/PC • PrintTickets define print settings for Metro Reach Packages • Metro leverages the “scoping prefix” support of PT • PrintTicket “scoping” levels map directly to the Metro content hierarchy • Job → FixedDocumentSequence • Document → FixedDocument • Page → FixedPage • Attend “Details on the Longhorn Spool File Format” presentation for more information on Metro
PT/PC XML Sample PrintCapabilities XML <f:PrintCapabilities xmlns:f="http://.../printschemaframework" xmlns:k="http://.../printschemakeywords"> <f:Feature name=“k:JobStaple”> <f:Option name=“k:None”/> <f:Option name=“k:StapleTopLeft”> <f:ScoredProperty name=“k:StapleAngle”> <psf:Value xsi:type="xs:integer">45</psf:Value> </f:ScoredProperty> … </f:Feature> </f:PrintCapabilities> PrintTicket XML <f:PrintTicket xmlns:f="http://.../printschemaframework" xmlns:k="http://.../printschemakeywords"> <f:Feature name=“k:JobStaple”> <f:Option name=“k:None”/> </f:Feature> </f:PrintTicket>
PT/PC Metro Sample Relationship Hierarchy Metro Package FixedDocument Sequence Job PT FixedDocument 1 FixedDocument N … Doc PT 1 Doc PT N … … FixedPage N/1 FixedPage 1/1 Page PT 1/1 Page PT N/1
PT/PC Metro Sample <f:PrintTicket ... > <f:Feature name=“k:PageMediaSize”> <f:Option name=“k:NALetter”/> </f:Feature> <f:Feature name=“k:PageOutputQuality”> <f:Option name=“k:High”/> </f:Feature> <f:Feature name=“k:PageOrientation”> <f:Option name=“k:Portrait”/> </f:Feature> </f:PrintTicket> Job PrintTicket + <f:PrintTicket ... > <f:Feature name=“k:PageOutputQuality”> <f:Option name=“k:Normal”/> </f:Feature> </f:PrintTicket> Document PrintTicket + <f:PrintTicket ... > <f:Feature name=“k:PageOrientation”> <f:Option name=“k:Landscape”/> </f:Feature> </f:PrintTicket> Page PrintTicket = <f:PrintTicket ... > <f:Feature name=“k:PageMediaSize”> <f:Option name=“k:NALetter”/> </f:Feature> <f:Feature name=“k:PageOutputQuality”> <f:Option name=“k:Normal”/> </f:Feature> <f:Feature name=“k:PageOrientation”> <f:Option name=“k:Landscape”/> </f:Feature> </f:PrintTicket> Merged PrintTicket for Page
PT/PC Distribution Plans • PT/PC driver support will be available on Windows XP forward • PT/PC WinFX API will only be available with WinFX • PT/PC Win32 API planned to ship with Windows Longhorn and PT/PC drivers • OS support being explored for Windows XP and later
PrintTicket/PrintCapabilities End-to-End Managed Code WinFX App Win32 App Microsoft ISV Application IHV WinFX PT/PC API Win32 PT/PC API Platform PT/PC System Layer Driver GPD/PPD Legacy IHV Plugin (non-provider) Longhorn Unidrv/PScript5 (PT/PC provider) Longhorn IHV Print Driver (PT/PC provider) Legacy IHV Print Driver (non-provider) Longhorn IHV Plugin (PT/PC provider)
WinFX PT/PC API: PrintQueue • Assembly • System.Printing.dll • Namespace • System.Printing.PrintSubSystem • Class • PrintQueue • APIs • public PrintCapabilities GetPrintCapabilities( PrintTicket printTicket) • public MemoryStream GetPrintCapabilitiesAsXml(PrintTicket printTicket) • public ValidationResult MergeAndValidatePrintTicket( PrintTicket basePrintTicket, PrintTicket deltaPrintTicket) • public static intMaxPrintSchemaVersion {get} • public PrintTicketUserPrintTicket{get; set} • Public PrintTicketDefaultPrintTicket {get; set}
WinFX PT/PC API: PrintTicketConverter • Assembly • ReachFramework.dll • Namespace • System.Printing.Interop • Class • PrintTicketConverter • APIs • public PrintTicket ConvertDevModeToPrintTicket(byte[] devMode) • public byte[] ConvertPrintTicketToDevMode( PrintTicket printTicket, BaseDevModeType baseType) • public static intMaxPrintSchemaVersion {get}
WinFX PT/PC API: Convenience Objects • Assembly • ReachFramework.dll • Namespace • System.Printing.Configuration • Class • PrintTicket, PrintCapabilities • API samples pt.PageOrientation.Value = PrintSchema.OrientationValue.Portrait; pt.PageMediaSize.SetCustomMediaSize(width, height); pt.PageCopyCount.Value = 10; if (pc.SupportsCapability(PrintSchema.Feature.DocumentDuplex)) { ... } foreach (FixedMediaSizeOption media in pc.PageMediaSizeCapability.FixedMediaSizes) { ... } • Provides object based access to PT/PC content so clients do not have to manipulate raw XML for common features • For advanced or private Print Schema features clients need to access raw XML
WinFX PT/PC API: Metro Support • Assembly • PresentationFramework.dll • Namespace • System.Windows.Documents • Class • FixedDocumentSequence, FixedDocument, FixedPage • APIs • public object PrintTicket {get; set} • Sample PrintQueue printQueue = new PrintQueue(...); PrintTicket pt = printQueue.UserPrintTicket.Clone(); pt.PageOrientation.Value = PrintSchema.OrientationValue.Landscape; FixedDocument fixDoc = new FixedDocument(); fixDoc.PrintTicket = pt;
Win32 PT/PC API • SDK Header • sdk\inc\prntvpt.h • SDK Lib • sdk\lib\i386|ia64|amd64\prntvpt.lib • APIs • HRESULT WINAPI PTQuerySchemaVersionSupport(...) • HRESULT WINAPI PTOpenProvider(...) • HRESULT WINAPI PTOpenProviderEx(...) • HRESULT WINAPI PTGetPrintCapabilities(...) • HRESULT WINAPI PTMergeAndValidatePrintTicket(...) • HRESULT WINAPI PTConvertPrintTicketToDevMode(...) • HRESULT WINAPI PTConvertDevModeToPrintTicket(...) • HRESULT WINAPI PTCloseProvider(...) • No Win32 equivalent of WinFX PT/PC convenience objects
PrintTicket/PrintCapabilities End-to-End Managed Code WinFX App Win32 App Microsoft ISV Application IHV WinFX PT/PC API Win32 PT/PC API Platform PT/PC System Layer Driver GPD/PPD Legacy IHV Plugin (non-provider) Longhorn Unidrv/PScript5 (PT/PC provider) Longhorn IHV Print Driver (PT/PC provider) Legacy IHV Print Driver (non-provider) Longhorn IHV Plugin (PT/PC provider)
PT/PC System Layer • Unmanaged, common system layer for both WinFX and Win32 APIs • Enable a single, consistent set of PT/PC APIs regardless of the underlying driver’s support • For printer driver with PT/PC provider support • PT/PC system layer routes client’s PT/PC request to the printer driver, and returns driver’s PT/PC service result to the client • For legacy driver without PT/PC provider support • PT/PC system layer performs PT/PC service on behalf of the legacy driver, with Win32 API limitations
Support PT/PC in IHV Printer Driver • Implement IPrintTicketProvider interface to become a PT/PC provider: (defined in oak\inc\prdrvcom.h) DECLARE_INTERFACE_(IPrintTicketProvider, IUnknown) { // IUnknown methods skipped STDMETHOD(GetSupportedVersions)(...) STDMETHOD(BindPrinter)(...) STDMETHOD(ConvertPrintTicketToDevMode)(...) STDMETHOD(ConvertDevModeToPrintTicket)(...) STDMETHOD(GetPrintCapabilities)(...) STDMETHOD(ValidatePrintTicket)(...) }
Longhorn MS Core Driver PT/PC Support • Longhorn Unidrv/PScript5 core drivers are PT/PC providers • Core drivers perform PT/PC operations based on GPD/PPD • Printer’s capabilities, feature set and constraints • Core drivers map between standard GPD/PPD features/options and public Print Schema features/options. Examples: • GPD: PaperSize, PPD: PageSize PrintSchema: PageMediaSize • GPD: Duplex, PPD: Duplex PrintSchema: JobDuplex
GPD/PPD PrintSchema Custom Mapping • Core driver automatically converts non-standard GPD/PPD features/options • Features/options scoped in a printer-model-name based private namespace URI • IHV has the option to specify custom mapping using new GPD/PPD keywords • Custom mapping allows IHV to specify: • public Print Schema keyword a GPD/PPD feature/option should be mapped to • a private namespace URI that replaces the default printer-model-name based private namespace URI • Provides flexibility for specification of non-standard feature/options • Map “foo” to a standard Print Schema feature or • Specify a private namespace URI for “foo”
Custom Mapping GPD/PPD Samples GPD *PrintSchemaPrivateNamespaceURI:“http://www.ihv.com/schema/2004” *Feature: IHVStapling { *PrintSchemaKeywordMap: “JobStaple" *Option: Enabled { *PrintSchemaKeywordMap: “StapleTopLeft" } *Option: Disabled { *PrintSchemaKeywordMap: “None“ } } PPD *MSPrintSchemaPrivateNamespaceURI: “http://www.ihv.com/schema/2004” *OpenUI *IHVStapling: PickOne *DefaultIHVStapling: Disabled *IHVStapling Enabled: “...” *IHVStapling Disabled: “...” *CloseUI: *IHVStapling *MSPrintSchemaKeywordMap: JobStaple *IHVStapling *MSPrintSchemaKeywordMap: JobStaple StapleTopLeft *IHVStapling Enabled *MSPrintSchemaKeywordMap: JobStaple None *IHVStapling Disabled
Support PT/PC in IHV Plugin • When to add PT/PC support in IHV plugin? • If you have capabilities, features or constraints that are not expressible in GPD/PPD • If you have plugin private DEVMODE settings • In general, if you want to customize core driver’s PT/PC provider behavior • How to add PT/PC support in IHV plugin? • Implement IPrintOemPrintTicketProvider interface (defined in oak\inc\prcomoem.h) DECLARE_INTERFACE_(IPrintOemPrintTicketProvider, IUnknown) { // IUnknown methods skipped STDMETHOD(GetSupportedVersions)(...) STDMETHOD(BindPrinter)(...) STDMETHOD(PublishPrintTicketHelperInterface)(...) STDMETHOD(QueryDeviceDefaultNamespace)(...) STDMETHOD(ConvertPrintTicketToDevMode)(...) STDMETHOD(ConvertDevModeToPrintTicket)(...) STDMETHOD(CompletePrintCapabilities)(...) STDMETHOD(ExpandIntentOptions)(...) STDMETHOD(ValidatePrintTicket)(...) };
Call To Action • Understand Longhorn Print Architecture • Identify strategic devices to target the Metro Print Path • Identify extension scenarios • Understand the Windows Color System • Review the Metro v.7 specification • http://www.microsoft.com/whdc/device/print/metro.mspx • Start implementation with Beta 1! • Convert GDI/DDI based drivers to MetroDrv drivers • Explore the sample filters in Longhorn Beta 1 WDK • Consider on-device rendering with a RIP implementation • A reference implementation is planned for Longhorn Beta 1 tools
Additional Resources • E-mail • For developer print questions: prninfo @ microsoft.com • For developer scan questions: wiainfo @ microsoft.com • For developer color questions: mscolor @ microsoft.com • Developer kit references: • SDK for Print Schema User Manual and Keywords: http://winfx.msdn.microsoft.com/library/en-us/printschema/PrintSchema/Overviews/PrintSchema_entry.asp • WDK for PT/PC interfaces: Reference\Printer Driver and Spooler Component Interfaces\Printer Driver Functions and Structures\Unidrv and Pscript Interfaces\Methods for PrintTicket Providers and Consumers • WinFX Print System Object • Documentation available in WinFX Beta 1 SDK
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.