1 / 50

Developing XPSDrv Print Drivers

Developing XPSDrv Print Drivers. Felix Maxa Software Design Engineer Digital Documents Platform and Solutions Feng Yue Development Lead Digital Documents Platform and Solutions. Agenda. XPSDrv Filter Pipeline XPSDrv Configuration GPD/PPD-Only Configuration

belisma
Download Presentation

Developing XPSDrv Print Drivers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Developing XPSDrv Print Drivers Felix MaxaSoftware Design EngineerDigital Documents Platform and SolutionsFeng YueDevelopment LeadDigital Documents Platform and Solutions

  2. Agenda • XPSDrv Filter Pipeline • XPSDrv Configuration • GPD/PPD-Only Configuration • Unidrv/PScript5 Plug-in Configuration • XPSDrv Setup and Installation • XPSDrv Logo Requirements Assumes basic familiarity with XPSDrv

  3. XPSDrv Overview • New print driver model in Window Vista • XPS Document format is the spool file • Advanced color and graphic support • Application content preserved to driver or device • Defines an extensible filter pipeline • Consolidated design for plug-ins • Shared common functionality • Allows flexible allocation of rendering between driver and device (scalable consumption) • Compatibility with Win32 and Windows Presentation Foundation (WPF) applications

  4. XPSDrv Filter Pipeline Felix MaxaSoftware Design EngineerDigital Documents Platform and Solutions

  5. Provided by Microsoft ISV IHV XPSDrv Filter Pipeline Architecture WPF App Win32 App ApplicationProcess SpoolerProcess Filter Pipeline Process Version 3Driver Filter Pipeline Config Module/Plug-in XPS Filter PipelineManager Filter 1 ConversionRender Module FPConfigXML Filter N PropertyBag

  6. Provided by Microsoft ISV IHV Print Paths SPOOLFILE Filter Pipeline Process SpoolerProcess Filter Pipeline Filter PipelineManager Filter 1 Print processor Filter N GDI FPConfigXML PropertyBag Printer Driver

  7. Filter Pipeline Manager • The Filter Pipeline Manager (FPM)is responsible for • Loading and initializing filters as describedby the filter configuration file to create the filter pipeline • Managing the data between filters as the print job is processed via the Inter-filter Communicators (IFC) • Unloading filters when the print job is finished

  8. Print Pipeline Filter Configuration File • XML file that defines • Filter ordering – Simple ordering of XML elements • Filter interfaces – Defined by XML attributes • Input/output formats for each filter – Defined by XML elements • Potential for modification by IT Admins to add filters • Be aware of functionality impact

  9. Pipeline Config File Sample • <Filters> • <Filter dll = "WdkPipelineFilter.dll" • clsid = "{8267d291-6ddd-4972-a94e-3ce88149a1fa}" • name = "add simple page"> • <Input guid = "{b8cf8530-5562-47c4-ab67-b1f69ecf961e}" • comment = "IID_IXpsDocumentProvider"/> • <Output guid = "{4368d8a2-4181-4a9f-b295-3d9a38bb9ba0}" • comment = "IID_IXpsDocumentConsumer"/> </Filter> <FilterServiceProvider dll = "providerA.dll"/> <FilterServiceProvider dll = "providerB.dll"/> • </Filters>

  10. Sharing data between Filters Pipeline manager and filters Pairs (string key, variant value) Examples ("PrinterName", VARIANT_BSTR) ("ProgressReport", VARIANT_IUNKNOWN) ("PrinterHandle", VARIANT_BYREF) ("UserSecurityToken", VARIANT_BYREF) ("PrintJobId", VARIANT_ULONG) Property Bag

  11. Filter Access To XPS Job • Stream • XPS high level interfaces [0].piece FONT-1 Resources\99bc59ed.ODTTF\ [0].piece IMAGE-1 Resources\8792381d.jpg\ [1].last.piece IMAGE-1 Resources\8792381d.jpg\ [0].piece FONT-2 Resources\6b2554d5.ODTFF\ [1].last.piece FONT-2 Resources\6b2554d5.ODTFF\ [0].piece IMAGE-2 Resources\42a30e86.jpg\ [1].last.piece IMAGE-2 Resources\42a30e86.jpg\ [0].last.piece PT-1 Metadata\Job_PT.xml\ [0].piece FDS FixedDocumentSequence.fdseq\ [1].piece FDS FixedDocumentSequence.fdseq\ [2].last.piece FDS FixedDocumentSequence.fdseq\ [0].piece FP Documents\1\Pages\3.fpage [1].last.piece FP Documents\1\Pages\3.fpage

  12. XPS Filter Pipeline

  13. XPS Filter Pipeline Notifications

  14. XPS Render Filter Notifications

  15. XPS Document Filter Interfaces • Filters can • Read and write Page markup • Read content for other parts • Create new parts and associate with pages • Create new documents and pages • Delete relationships • Enumerate resources for page • Mix of XPS and Stream based filters • The filter pipeline manager takes careof data conversion

  16. The Filter Interface Definition interface IPrintPipelineFilter : IUnknown { HRESULT InitializeFilter( [in] IInterFilterCommunicator *pICommunicator, [in] IPrintPipelinePropertyBag *pIPropertyBag, [in] IPrintPipelineManagerControl *pIPipelineControl ); HRESULT ShutdownOperation( void ); HRESULT StartOperation( void ); }

  17. Custom Filter Interfaces • <Filters> • <Filter dll = "CustomFilterA.dll" • clsid = "{33b32cf3-954c-4dfd-a016-6f05303fe65b}" • name = "read stream - write custom"> • <Input guid = "{4d47a67c-66cc-4430-850e-daf466fe5bc4}" • comment="IID_IPrintReadStream"/> • <Output guid = "{00000003-0000-0000-C000-000000000046}" • provider = "{a6686ae8-909f-42ee-9377-6fc6c815df61}" • dll = "CustInterfaceProvider.dll"/> </Filter> • <Filter dll = "CustomFilterB.dll" • clsid = "{f761761d-5467-409a-adff-91460ba008d9}" • name = "read custom - write stream"> • <Input guid = "{00000003-0000-0000-C000-000000000046}"/> • <Output guid = "{65bb7f1b-371e-4571-8ac7-912f510c1a38}" • comment="IID_IPrintWriteStream"/> </Filter> • </Filters>

  18. Custom Filter Interfaces

  19. Module which exports HRESULT DrvPopulateFilterServices( __in IPrintPipelinePropertyBag *pPropertyBag ); Registered in the pipeline config <FilterServiceProvider dll = “providerA.dll”/> Access to configuration module functionalityand data from filters Ex. IPrintCoreHelper Filter Service Providers

  20. Interleaving • Page level interleaving • Resources first • Mark up first • Interleaved at certain piece size • For some devices, filter must help • Ensure resources are available when needed • Enables consumption by memory constrained consumers • Use discard control • Send resources again

  21. Interleaving In Config File <Filter dll = "TestFilter.dll" clsid = "{e96f780a-5b6a-47d5-a433-fa0d4e52688d}" <Input guid = "{b8cf8530-5562-47c4-ab67-b1f69ecf961e}"/> <Output guid = "{4368d8a2-4181-4a9f-b295-3d9a38bb9ba0}"/> <Interleaving mode="MarkupFirst" pieceSize="0"/> <Interleaving mode="MarkupFirst" pieceSize="2000"/> <Interleaving mode="ResourcesFirst" pieceSize="30900"/> <Interleaving mode="MarkupFirst"/> <Interleaving mode="ResourcesFirst"/> </Filter>

  22. Filter Recommendations • Filters should not spawn separate processes or threads • If a separate process/thread is required fora filter, the filter MUST properly manage the process/thread lifetime • Stream filters – aware that not all datais correctly interleaved • Filters must be robust to non-interleavedand incorrectly interleaved content

  23. COM apartment model Driver packages – XML file changes PnPUtil.exe Debug help System\CurrentControlSet\Control\Print PipelineHostTimeout REG_DWORD miliseconds PipelineDebugLog REG_DWORD 0 or non-0 Common Implementation Challenges

  24. XPSDrv Configuration Feng YueDevelopment LeadDigital Documents Platform and Solutions

  25. Config Module XPSDrv Configuration Architecture Provided by Microsoft WPF App ISV Win32 App IHV XPSDrv Driver Version 3 Driver Unidrv Plug-in Unidrv ConfigModule GPD PScript5 Plug-in PScript5 ConfigModule PPD Filter Pipeline XPS Filter 1 MonolithicConfig Module Filter N ConversionRender Module

  26. GPD/PPD-Only Configuration

  27. GPD/PPD-Only Config • GPD/PPD-only configuration is supported for XPSDrv printer drivers • Smallest investment cost and short development time • No customization of Unidrv/PScript5 behavior • No UI customization • Best suited for XPSDrv passthrough or basic printer drivers • Primary changes are • Print Schema Mapping • XPSDrv Specific GPD/PPD Entries

  28. Standard GPD/PPD keywords automatically mapped to public Print Schema equivalents Non-standard keywords automatically mapped to private device namespace GPD/PPD To Print Schema Map • Example: • *Feature: PaperSize -> • <psf:Feature name=“psk:PageMediaSize”> • Example: • *Feature: IHVFoo -> • <psf:Feature name=“ns0001:IHVFoo”>

  29. GPD/PPD To Print Schema Map • Windows Vista GPD/PPD parsers will recognize new Print Schema mapping keywords • Specify IHV private namespace for automatically mapped keyword • Specify mapping from non-standard keywords to Print Schema equivalents • GPD Keywords • PrintSchemaPrivateNamespaceURI • PrintSchemaKeywordMap • PPD Keywords • MSPrintSchemaPrivateNamespaceURI • MSPrintSchemaKeywordMap

  30. New “Include” entry to reference XPSDrv standard contents msxpsinc.gpd msxpsinc.ppd Currently files include a new keyword to specify XPSDrv printer driver *IsXPSDriver?: TRUE (msxpsinc.gpd) *MSIsXPSDriver?: TRUE(msxpsinc.ppd) Keyword must be present to properly recognize XPSDrv drivers GPD/PPD XPSDrv Entries

  31. GPD Sample File *GPDFileVersion: "1.0" *Include: "StdNames.gpd” *Include:“MSXpsInc.gpd” *% *% IHV Private Namespace *% *PrintSchemaPrivateNamespaceURI:“http://www.ihv.com/schema/2006” *% *% IHV Private Feature *% *Feature: IHVStapling { *PrintSchemaKeywordMap: “JobStaple" *Option: Enabled { *PrintSchemaKeywordMap: “StapleTopLeft" } *Option: Disabled { *PrintSchemaKeywordMap: “None” } }

  32. Unidrv/PScript5 Plug-In Configuration

  33. Unidrv/PScript5 Plug-In Config • Unidrv/PScript5 Plug-in allows full customization of config module • Ability to modify, replace and add to system PrintTicket/PrintCapabilities (PT/PC) processing • Ability to fully replace system UI • Non-trivial investment cost and development time • Suited for all types of XPSDrv drivers • Primary changes are • Plug-in PT/PC provider: IPrintOemPrintTicketProvider • Helper interface for Unidrv/PScript5 settings: IPrintCoreHelper • XPSDrv document events and communicating with filters

  34. Enables plug-ins to customize PT/PC processing Results of Unidrv/PScript5 processing will be passed to plug-in to finalize processing DECLARE_INTERFACE_(IPrintOemPrintTicketProvider, IUnknown) { STDMETHOD(GetSupportedVersions)(…) STDMETHOD(BindPrinter)(…) STDMETHOD(PublishPrintTicketHelperInterface)(…) STDMETHOD(QueryDeviceDefaultNamespace)(…) STDMETHOD(ConvertPrintTicketToDevMode)(…) STDMETHOD(ConvertDevModeToPrintTicket)(…) STDMETHOD(CompletePrintCapabilities)(…) STDMETHOD(ExpandIntentOptions)(…) STDMETHOD(ValidatePrintTicket)(…) }; IPrintOemPrintTicketProvider

  35. COM interface that enables plug-ins to read and set the Unidrv and PScript5 private DEVMODE settings Enables functional parity for full-UI replacement DECLARE_INTERFACE_(IPrintCoreHelper, IUnknown) { // IUnknown methods skipped STDMETHOD(CreateInstanceOfMSXMLObject)(…) STDMETHOD(EnumConstrainedOptions)(…) STDMETHOD(EnumFeatures)(…) STDMETHOD(EnumOptions)(…) STDMETHOD(GetOption)(…) STDMETHOD(SetOptions)(…) STDMETHOD(WhyConstrained)(…) STDMETHOD(GetFontSubstitution)(…) STDMETHOD(SetFontSubstitution)(…) }; IPrintCoreHelper

  36. Two derived interfaces provide Unidrv and PScript5 specific functionality DECLARE_INTERFACE_(IPrintCoreHelperUni, IPrintCoreHelper) { STDMETHOD(CreateDefaultGDLSnapshot)(…) STDMETHOD(CreateGDLSnapshot)(…) }; DECLARE_INTERFACE_(IPrintCoreHelperPS, IPrintCoreHelper) { STDMETHOD(GetGlobalAttribute)(…) STDMETHOD(GetFeatureAttribute)(…) STDMETHOD(GetOptionAttribute)(…) }; IPrintCoreHelper

  37. XPSDrv will use the existing DrvDocumentEvent mechanism When printing from Win32 apps, existing GDI events will be used When printing from WPF apps,the following new XPS events will be used DOCUMENTEVENT_XPS_QUERYFILTER DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTSEQUENCEPRE/POST DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTPRE/POST DOCUMENTEVENT_XPS_ADDFIXEDPAGEEPRE/POST DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTSEQUENCEPRINTTICKETPRE/POST DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTPRINTTICKETPRE/POST DOCUMENTEVENT_XPS_ADDFIXEDPAGEPRINTTICKETPRE/POST DOCUMENTEVENT_XPS_CANCELJOB XPSDrv Document Events

  38. Configuration Recommendations • For Unidrv/PScript5 drivers, provide separate GPD/PPD for each filter • Contributes to the modularity of filters • Expose PT/PC keywords in the public Print Schema • Where possible, map driver features to public Print Schema keywords • Contributes to application use of features • Contributes to better synchronization of driver and application settings

  39. Setup And Installation

  40. INF Changes • XPSDrv drivers need to make a series of changes to be properly registered by the spooler • CopyFiles • Must include Filter Pipeline configuration file • Needs • Must include XPSDRV.OEM install directive • Unidrv/PScript5 drivers must include XPSGPD.OEM or XPSPPD.OEM install directives

  41. INF File Sample [Manufacturer] Microsoft [Microsoft] "XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS [INSTALL_XDSMPL_FILTERS] CopyFiles=XPSDrvSample,ConfigPlugin,COLORPROFILES DataFile=XDSmpl.GPD Include=NTPRINT.INF Needs=UNIDRV.OEM, XPSGPD.OEM, XPSDRV.OEM ICMProfiles=xdwscRGB.cdmp [XPSDrvSample] xdsmpl-pipelineconfig.xml ...

  42. Windows Logo Program Requirements

  43. Premium Logo Requirement • XPSDrv implementation is a requirement for the Premium Logo for print and multi-function devices • See DEV-PRNT-56 in the Windows Logo Program requirements for more information

  44. Configuration ModuleLogo Requirements • Must be a valid Version 3 printer driver configuration module • Must support PrintTicket and PrintCapabilities • All features configurable in the driver UI • Minimal set keywords are required for basic functionality

  45. Filter Pipeline Logo Requirements • The XPSDrv driver must include a valid Filter Pipeline Configuration File • Filters must conform to the rendering rules and PrintTicket processing rules defined in the XML Paper Specification • Filters must not have a dependency on the CLR or the WinFX Runtime Components • Filters in the XPSDrv driver filter pipeline must not display User Interface (UI) content

  46. Call To Action • Test for compatibility now! • Test the GDI Print Path, XPS Print Path, and compatibility print paths • Report problems immediately • Plan for XPSDrv support • Host-based printers • Pass-through XPSDrv drivers for XPS-capable devices (direct consumption) • Start implementation now • Aim for Windows Vista launch availability

  47. Call To Action • Review the Windows Vista Logo Program requirements • Basic and Premium • At WinHEC • Practice driver dev and testing skills in XPS Printing hands on labs • Ask the Experts at lunch today • Visit the Microsoft Pavilion to see XPS demos • Read XPSDrv Print Drivers and the Windows Color System on http://www.microsoft.com/whdc/device/print/default.mspx • Attend related sessions • PRI050 Inside Printer Installation on Windows Vista • PRI039 Using the Windows Color System in Device Drivers • PRI102 Using XPSDrv Print Drivers to Extend Windows Print Functionality • PRI077 Print Driver and XPSDrv Testing in Windows Vista

  48. Additional Resources • Technical advice • WDK and SDK • Online • XPS Portal http://www.microsoft.com/xps • Links to relevant blogs, whitepapers, specs • WHDC Printing documents http://www.microsoft.com/whdc/device/print/default.mspx • WHDC Color documentshttp://www.microsoft.com/whdc/device/display/color/default.mspx • Windows Digital Documents Platform Team Newsletter https://profile.microsoft.com/RegSysProfileCenter/subscriptionwizard.aspx?wizid=77d9786e-9500-40a4-ba20-a4c7504d83ca&lcid=1033 • XPSinfo @ microsoft.com • Prninfo @ microsoft.com • Mscolor @ microsoft.com

  49. © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related