20

Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Embed Size (px)

Citation preview

Page 1: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Printer Driver Development in Windows 7

Felix MaxaSoftware EngineerMicrosoft Corporation

Agenda

bull New API and features in Windows 7bull Print Driver Isolationbull XPS Print APIbull Plugin Execution Context API

bull Print filter pipelinebull Updatesbull Performance

bull Pointrsquonrsquoprint and Client Side Rendering

Print Driver Isolation

bull A driver can be loaded bull in the spooler process orbull in a shared sandbox or bull isolated sandbox

bull Driver attributes and group policybull A print processor is isolated based on the policy of the

driver that is associated with the queue that is printing the job

bull Isolation policies on client and server are unrelated

Print Driver Isolation

SANDBOX

Windows 7 ndash SSRWindows Vista

Windows Server 2003Windows XP

Client

Windows 7 ndash CSR

Windows VistaWindows Server 2003

Windows XP

Server

Windows 7

SANDBOX

CSR ndash Client Side RenderingSSR ndash Server Side Rendering

XPS Print API

bull Submits XPS documents to XPS and GDI printersbull Sends document events to driver

bull Parity with WPF and GDI drivers

bull Runs in client application processbull Wersquoll have a white paper about it ndash draft by WinHEC

Print Plug-in Context API

typedef enum PRINT_EXECUTION_CONTEXT_APPLICATION = 0 PRINT_EXECUTION_CONTEXT_SPOOLER_SERVICE = 1 PRINT_EXECUTION_CONTEXT_ISOLATION_HOST = 2 PRINT_EXECUTION_CONTEXT_FILTER_PIPELINE = 3 PRINT_EXECUTION_CONTEXT_WOW64 = 4PRINT_EXECUTION_CONTEXT

typedef struct PRINT_EXECUTION_CONTEXT context DWORD clientAppPIDPRINT_EXECUTION_DATA

BOOLWINAPIGetPrintExecutionData( __out PRINT_EXECUTION_DATA pData )

Print Filter Pipeline ndash Optional Service Providers

ltFiltersgt ltFilter dll = ldquoTestPrintFiltersdll hellip ltFiltergt

ltFilterServiceProvider dll=unidrvuidllgt ltOptionalFilterServiceProvider dll=ldquosomedlldllgtltFiltersgt

bull ldquoFilterServiceProviderrdquo tag introduced in Windows Vistabull ldquoOptionalFilterServiceProviderrdquo tag introduced in

Windows 7

Print Filter Pipeline - Updates

bull Property bag XPS_FP_OUTPUT_FILE LPrintOutputFileNamebull Bypass print filter pipeline

bull Use XPS_PASS data type

bull Windows 7 enabled loading dependent DLLs from drivers directory

m_hModule = LoadLibraryEx(pszFile NULL LOAD_WITH_ALTERED_SEARCH_PATH)

Print Filter Pipeline ndash Restricted Fonts

typedef enum Xps_Restricted_Font_Installable = 0x0000 Xps_Restricted_Font_NoEmbedding = 0x0002 Xps_Restricted_Font_PreviewPrint = 0x0004 Xps_Restricted_Font_Editable = 0x0008 EXpsFontRestriction

interface IPartFont2 IPartFont HRESULT GetFontRestriction( [out] EXpsFontRestriction pRestriction )

bull IPartFont interface introduced in Windows Vistabull IPartFont2 interface introduced in Windows 7

Print Filter Pipeline - Performance

bull Performance issues with various types of documentsbull Thousands of pagesbull 100 MB page or image associated with pagebull Pages with thousands of relationships

bull Fixed bugs in Vista SP1 and more in Windows 7bull Fewer disk IO operationsbull More efficient use of buffers and memorybull More than 100 performance improvement in certain

scenarios

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 2: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Agenda

bull New API and features in Windows 7bull Print Driver Isolationbull XPS Print APIbull Plugin Execution Context API

bull Print filter pipelinebull Updatesbull Performance

bull Pointrsquonrsquoprint and Client Side Rendering

Print Driver Isolation

bull A driver can be loaded bull in the spooler process orbull in a shared sandbox or bull isolated sandbox

bull Driver attributes and group policybull A print processor is isolated based on the policy of the

driver that is associated with the queue that is printing the job

bull Isolation policies on client and server are unrelated

Print Driver Isolation

SANDBOX

Windows 7 ndash SSRWindows Vista

Windows Server 2003Windows XP

Client

Windows 7 ndash CSR

Windows VistaWindows Server 2003

Windows XP

Server

Windows 7

SANDBOX

CSR ndash Client Side RenderingSSR ndash Server Side Rendering

XPS Print API

bull Submits XPS documents to XPS and GDI printersbull Sends document events to driver

bull Parity with WPF and GDI drivers

bull Runs in client application processbull Wersquoll have a white paper about it ndash draft by WinHEC

Print Plug-in Context API

typedef enum PRINT_EXECUTION_CONTEXT_APPLICATION = 0 PRINT_EXECUTION_CONTEXT_SPOOLER_SERVICE = 1 PRINT_EXECUTION_CONTEXT_ISOLATION_HOST = 2 PRINT_EXECUTION_CONTEXT_FILTER_PIPELINE = 3 PRINT_EXECUTION_CONTEXT_WOW64 = 4PRINT_EXECUTION_CONTEXT

typedef struct PRINT_EXECUTION_CONTEXT context DWORD clientAppPIDPRINT_EXECUTION_DATA

BOOLWINAPIGetPrintExecutionData( __out PRINT_EXECUTION_DATA pData )

Print Filter Pipeline ndash Optional Service Providers

ltFiltersgt ltFilter dll = ldquoTestPrintFiltersdll hellip ltFiltergt

ltFilterServiceProvider dll=unidrvuidllgt ltOptionalFilterServiceProvider dll=ldquosomedlldllgtltFiltersgt

bull ldquoFilterServiceProviderrdquo tag introduced in Windows Vistabull ldquoOptionalFilterServiceProviderrdquo tag introduced in

Windows 7

Print Filter Pipeline - Updates

bull Property bag XPS_FP_OUTPUT_FILE LPrintOutputFileNamebull Bypass print filter pipeline

bull Use XPS_PASS data type

bull Windows 7 enabled loading dependent DLLs from drivers directory

m_hModule = LoadLibraryEx(pszFile NULL LOAD_WITH_ALTERED_SEARCH_PATH)

Print Filter Pipeline ndash Restricted Fonts

typedef enum Xps_Restricted_Font_Installable = 0x0000 Xps_Restricted_Font_NoEmbedding = 0x0002 Xps_Restricted_Font_PreviewPrint = 0x0004 Xps_Restricted_Font_Editable = 0x0008 EXpsFontRestriction

interface IPartFont2 IPartFont HRESULT GetFontRestriction( [out] EXpsFontRestriction pRestriction )

bull IPartFont interface introduced in Windows Vistabull IPartFont2 interface introduced in Windows 7

Print Filter Pipeline - Performance

bull Performance issues with various types of documentsbull Thousands of pagesbull 100 MB page or image associated with pagebull Pages with thousands of relationships

bull Fixed bugs in Vista SP1 and more in Windows 7bull Fewer disk IO operationsbull More efficient use of buffers and memorybull More than 100 performance improvement in certain

scenarios

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 3: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Driver Isolation

bull A driver can be loaded bull in the spooler process orbull in a shared sandbox or bull isolated sandbox

bull Driver attributes and group policybull A print processor is isolated based on the policy of the

driver that is associated with the queue that is printing the job

bull Isolation policies on client and server are unrelated

Print Driver Isolation

SANDBOX

Windows 7 ndash SSRWindows Vista

Windows Server 2003Windows XP

Client

Windows 7 ndash CSR

Windows VistaWindows Server 2003

Windows XP

Server

Windows 7

SANDBOX

CSR ndash Client Side RenderingSSR ndash Server Side Rendering

XPS Print API

bull Submits XPS documents to XPS and GDI printersbull Sends document events to driver

bull Parity with WPF and GDI drivers

bull Runs in client application processbull Wersquoll have a white paper about it ndash draft by WinHEC

Print Plug-in Context API

typedef enum PRINT_EXECUTION_CONTEXT_APPLICATION = 0 PRINT_EXECUTION_CONTEXT_SPOOLER_SERVICE = 1 PRINT_EXECUTION_CONTEXT_ISOLATION_HOST = 2 PRINT_EXECUTION_CONTEXT_FILTER_PIPELINE = 3 PRINT_EXECUTION_CONTEXT_WOW64 = 4PRINT_EXECUTION_CONTEXT

typedef struct PRINT_EXECUTION_CONTEXT context DWORD clientAppPIDPRINT_EXECUTION_DATA

BOOLWINAPIGetPrintExecutionData( __out PRINT_EXECUTION_DATA pData )

Print Filter Pipeline ndash Optional Service Providers

ltFiltersgt ltFilter dll = ldquoTestPrintFiltersdll hellip ltFiltergt

ltFilterServiceProvider dll=unidrvuidllgt ltOptionalFilterServiceProvider dll=ldquosomedlldllgtltFiltersgt

bull ldquoFilterServiceProviderrdquo tag introduced in Windows Vistabull ldquoOptionalFilterServiceProviderrdquo tag introduced in

Windows 7

Print Filter Pipeline - Updates

bull Property bag XPS_FP_OUTPUT_FILE LPrintOutputFileNamebull Bypass print filter pipeline

bull Use XPS_PASS data type

bull Windows 7 enabled loading dependent DLLs from drivers directory

m_hModule = LoadLibraryEx(pszFile NULL LOAD_WITH_ALTERED_SEARCH_PATH)

Print Filter Pipeline ndash Restricted Fonts

typedef enum Xps_Restricted_Font_Installable = 0x0000 Xps_Restricted_Font_NoEmbedding = 0x0002 Xps_Restricted_Font_PreviewPrint = 0x0004 Xps_Restricted_Font_Editable = 0x0008 EXpsFontRestriction

interface IPartFont2 IPartFont HRESULT GetFontRestriction( [out] EXpsFontRestriction pRestriction )

bull IPartFont interface introduced in Windows Vistabull IPartFont2 interface introduced in Windows 7

Print Filter Pipeline - Performance

bull Performance issues with various types of documentsbull Thousands of pagesbull 100 MB page or image associated with pagebull Pages with thousands of relationships

bull Fixed bugs in Vista SP1 and more in Windows 7bull Fewer disk IO operationsbull More efficient use of buffers and memorybull More than 100 performance improvement in certain

scenarios

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 4: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Driver Isolation

SANDBOX

Windows 7 ndash SSRWindows Vista

Windows Server 2003Windows XP

Client

Windows 7 ndash CSR

Windows VistaWindows Server 2003

Windows XP

Server

Windows 7

SANDBOX

CSR ndash Client Side RenderingSSR ndash Server Side Rendering

XPS Print API

bull Submits XPS documents to XPS and GDI printersbull Sends document events to driver

bull Parity with WPF and GDI drivers

bull Runs in client application processbull Wersquoll have a white paper about it ndash draft by WinHEC

Print Plug-in Context API

typedef enum PRINT_EXECUTION_CONTEXT_APPLICATION = 0 PRINT_EXECUTION_CONTEXT_SPOOLER_SERVICE = 1 PRINT_EXECUTION_CONTEXT_ISOLATION_HOST = 2 PRINT_EXECUTION_CONTEXT_FILTER_PIPELINE = 3 PRINT_EXECUTION_CONTEXT_WOW64 = 4PRINT_EXECUTION_CONTEXT

typedef struct PRINT_EXECUTION_CONTEXT context DWORD clientAppPIDPRINT_EXECUTION_DATA

BOOLWINAPIGetPrintExecutionData( __out PRINT_EXECUTION_DATA pData )

Print Filter Pipeline ndash Optional Service Providers

ltFiltersgt ltFilter dll = ldquoTestPrintFiltersdll hellip ltFiltergt

ltFilterServiceProvider dll=unidrvuidllgt ltOptionalFilterServiceProvider dll=ldquosomedlldllgtltFiltersgt

bull ldquoFilterServiceProviderrdquo tag introduced in Windows Vistabull ldquoOptionalFilterServiceProviderrdquo tag introduced in

Windows 7

Print Filter Pipeline - Updates

bull Property bag XPS_FP_OUTPUT_FILE LPrintOutputFileNamebull Bypass print filter pipeline

bull Use XPS_PASS data type

bull Windows 7 enabled loading dependent DLLs from drivers directory

m_hModule = LoadLibraryEx(pszFile NULL LOAD_WITH_ALTERED_SEARCH_PATH)

Print Filter Pipeline ndash Restricted Fonts

typedef enum Xps_Restricted_Font_Installable = 0x0000 Xps_Restricted_Font_NoEmbedding = 0x0002 Xps_Restricted_Font_PreviewPrint = 0x0004 Xps_Restricted_Font_Editable = 0x0008 EXpsFontRestriction

interface IPartFont2 IPartFont HRESULT GetFontRestriction( [out] EXpsFontRestriction pRestriction )

bull IPartFont interface introduced in Windows Vistabull IPartFont2 interface introduced in Windows 7

Print Filter Pipeline - Performance

bull Performance issues with various types of documentsbull Thousands of pagesbull 100 MB page or image associated with pagebull Pages with thousands of relationships

bull Fixed bugs in Vista SP1 and more in Windows 7bull Fewer disk IO operationsbull More efficient use of buffers and memorybull More than 100 performance improvement in certain

scenarios

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 5: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

XPS Print API

bull Submits XPS documents to XPS and GDI printersbull Sends document events to driver

bull Parity with WPF and GDI drivers

bull Runs in client application processbull Wersquoll have a white paper about it ndash draft by WinHEC

Print Plug-in Context API

typedef enum PRINT_EXECUTION_CONTEXT_APPLICATION = 0 PRINT_EXECUTION_CONTEXT_SPOOLER_SERVICE = 1 PRINT_EXECUTION_CONTEXT_ISOLATION_HOST = 2 PRINT_EXECUTION_CONTEXT_FILTER_PIPELINE = 3 PRINT_EXECUTION_CONTEXT_WOW64 = 4PRINT_EXECUTION_CONTEXT

typedef struct PRINT_EXECUTION_CONTEXT context DWORD clientAppPIDPRINT_EXECUTION_DATA

BOOLWINAPIGetPrintExecutionData( __out PRINT_EXECUTION_DATA pData )

Print Filter Pipeline ndash Optional Service Providers

ltFiltersgt ltFilter dll = ldquoTestPrintFiltersdll hellip ltFiltergt

ltFilterServiceProvider dll=unidrvuidllgt ltOptionalFilterServiceProvider dll=ldquosomedlldllgtltFiltersgt

bull ldquoFilterServiceProviderrdquo tag introduced in Windows Vistabull ldquoOptionalFilterServiceProviderrdquo tag introduced in

Windows 7

Print Filter Pipeline - Updates

bull Property bag XPS_FP_OUTPUT_FILE LPrintOutputFileNamebull Bypass print filter pipeline

bull Use XPS_PASS data type

bull Windows 7 enabled loading dependent DLLs from drivers directory

m_hModule = LoadLibraryEx(pszFile NULL LOAD_WITH_ALTERED_SEARCH_PATH)

Print Filter Pipeline ndash Restricted Fonts

typedef enum Xps_Restricted_Font_Installable = 0x0000 Xps_Restricted_Font_NoEmbedding = 0x0002 Xps_Restricted_Font_PreviewPrint = 0x0004 Xps_Restricted_Font_Editable = 0x0008 EXpsFontRestriction

interface IPartFont2 IPartFont HRESULT GetFontRestriction( [out] EXpsFontRestriction pRestriction )

bull IPartFont interface introduced in Windows Vistabull IPartFont2 interface introduced in Windows 7

Print Filter Pipeline - Performance

bull Performance issues with various types of documentsbull Thousands of pagesbull 100 MB page or image associated with pagebull Pages with thousands of relationships

bull Fixed bugs in Vista SP1 and more in Windows 7bull Fewer disk IO operationsbull More efficient use of buffers and memorybull More than 100 performance improvement in certain

scenarios

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 6: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Plug-in Context API

typedef enum PRINT_EXECUTION_CONTEXT_APPLICATION = 0 PRINT_EXECUTION_CONTEXT_SPOOLER_SERVICE = 1 PRINT_EXECUTION_CONTEXT_ISOLATION_HOST = 2 PRINT_EXECUTION_CONTEXT_FILTER_PIPELINE = 3 PRINT_EXECUTION_CONTEXT_WOW64 = 4PRINT_EXECUTION_CONTEXT

typedef struct PRINT_EXECUTION_CONTEXT context DWORD clientAppPIDPRINT_EXECUTION_DATA

BOOLWINAPIGetPrintExecutionData( __out PRINT_EXECUTION_DATA pData )

Print Filter Pipeline ndash Optional Service Providers

ltFiltersgt ltFilter dll = ldquoTestPrintFiltersdll hellip ltFiltergt

ltFilterServiceProvider dll=unidrvuidllgt ltOptionalFilterServiceProvider dll=ldquosomedlldllgtltFiltersgt

bull ldquoFilterServiceProviderrdquo tag introduced in Windows Vistabull ldquoOptionalFilterServiceProviderrdquo tag introduced in

Windows 7

Print Filter Pipeline - Updates

bull Property bag XPS_FP_OUTPUT_FILE LPrintOutputFileNamebull Bypass print filter pipeline

bull Use XPS_PASS data type

bull Windows 7 enabled loading dependent DLLs from drivers directory

m_hModule = LoadLibraryEx(pszFile NULL LOAD_WITH_ALTERED_SEARCH_PATH)

Print Filter Pipeline ndash Restricted Fonts

typedef enum Xps_Restricted_Font_Installable = 0x0000 Xps_Restricted_Font_NoEmbedding = 0x0002 Xps_Restricted_Font_PreviewPrint = 0x0004 Xps_Restricted_Font_Editable = 0x0008 EXpsFontRestriction

interface IPartFont2 IPartFont HRESULT GetFontRestriction( [out] EXpsFontRestriction pRestriction )

bull IPartFont interface introduced in Windows Vistabull IPartFont2 interface introduced in Windows 7

Print Filter Pipeline - Performance

bull Performance issues with various types of documentsbull Thousands of pagesbull 100 MB page or image associated with pagebull Pages with thousands of relationships

bull Fixed bugs in Vista SP1 and more in Windows 7bull Fewer disk IO operationsbull More efficient use of buffers and memorybull More than 100 performance improvement in certain

scenarios

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 7: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Filter Pipeline ndash Optional Service Providers

ltFiltersgt ltFilter dll = ldquoTestPrintFiltersdll hellip ltFiltergt

ltFilterServiceProvider dll=unidrvuidllgt ltOptionalFilterServiceProvider dll=ldquosomedlldllgtltFiltersgt

bull ldquoFilterServiceProviderrdquo tag introduced in Windows Vistabull ldquoOptionalFilterServiceProviderrdquo tag introduced in

Windows 7

Print Filter Pipeline - Updates

bull Property bag XPS_FP_OUTPUT_FILE LPrintOutputFileNamebull Bypass print filter pipeline

bull Use XPS_PASS data type

bull Windows 7 enabled loading dependent DLLs from drivers directory

m_hModule = LoadLibraryEx(pszFile NULL LOAD_WITH_ALTERED_SEARCH_PATH)

Print Filter Pipeline ndash Restricted Fonts

typedef enum Xps_Restricted_Font_Installable = 0x0000 Xps_Restricted_Font_NoEmbedding = 0x0002 Xps_Restricted_Font_PreviewPrint = 0x0004 Xps_Restricted_Font_Editable = 0x0008 EXpsFontRestriction

interface IPartFont2 IPartFont HRESULT GetFontRestriction( [out] EXpsFontRestriction pRestriction )

bull IPartFont interface introduced in Windows Vistabull IPartFont2 interface introduced in Windows 7

Print Filter Pipeline - Performance

bull Performance issues with various types of documentsbull Thousands of pagesbull 100 MB page or image associated with pagebull Pages with thousands of relationships

bull Fixed bugs in Vista SP1 and more in Windows 7bull Fewer disk IO operationsbull More efficient use of buffers and memorybull More than 100 performance improvement in certain

scenarios

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 8: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Filter Pipeline - Updates

bull Property bag XPS_FP_OUTPUT_FILE LPrintOutputFileNamebull Bypass print filter pipeline

bull Use XPS_PASS data type

bull Windows 7 enabled loading dependent DLLs from drivers directory

m_hModule = LoadLibraryEx(pszFile NULL LOAD_WITH_ALTERED_SEARCH_PATH)

Print Filter Pipeline ndash Restricted Fonts

typedef enum Xps_Restricted_Font_Installable = 0x0000 Xps_Restricted_Font_NoEmbedding = 0x0002 Xps_Restricted_Font_PreviewPrint = 0x0004 Xps_Restricted_Font_Editable = 0x0008 EXpsFontRestriction

interface IPartFont2 IPartFont HRESULT GetFontRestriction( [out] EXpsFontRestriction pRestriction )

bull IPartFont interface introduced in Windows Vistabull IPartFont2 interface introduced in Windows 7

Print Filter Pipeline - Performance

bull Performance issues with various types of documentsbull Thousands of pagesbull 100 MB page or image associated with pagebull Pages with thousands of relationships

bull Fixed bugs in Vista SP1 and more in Windows 7bull Fewer disk IO operationsbull More efficient use of buffers and memorybull More than 100 performance improvement in certain

scenarios

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 9: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Filter Pipeline ndash Restricted Fonts

typedef enum Xps_Restricted_Font_Installable = 0x0000 Xps_Restricted_Font_NoEmbedding = 0x0002 Xps_Restricted_Font_PreviewPrint = 0x0004 Xps_Restricted_Font_Editable = 0x0008 EXpsFontRestriction

interface IPartFont2 IPartFont HRESULT GetFontRestriction( [out] EXpsFontRestriction pRestriction )

bull IPartFont interface introduced in Windows Vistabull IPartFont2 interface introduced in Windows 7

Print Filter Pipeline - Performance

bull Performance issues with various types of documentsbull Thousands of pagesbull 100 MB page or image associated with pagebull Pages with thousands of relationships

bull Fixed bugs in Vista SP1 and more in Windows 7bull Fewer disk IO operationsbull More efficient use of buffers and memorybull More than 100 performance improvement in certain

scenarios

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 10: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Filter Pipeline - Performance

bull Performance issues with various types of documentsbull Thousands of pagesbull 100 MB page or image associated with pagebull Pages with thousands of relationships

bull Fixed bugs in Vista SP1 and more in Windows 7bull Fewer disk IO operationsbull More efficient use of buffers and memorybull More than 100 performance improvement in certain

scenarios

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 11: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Filter Pipeline - Discard Control

bull Microsoft XPS Document Converter (MXDC) produces discard control in Windows 7

bull Filters should be able to handle IPartDiscardControlbull The physical location of discard data ndash close to sentinel

pagebull Example of sequence of parts received by a filter when

printing an XPS doc with 3 pagesIXpsDocumentIFixedDocumentSequenceIFixedDocumentIFixedPageIPartDiscardControlIFixedPageIPartDiscardControlIPartDiscardControlIFixedPage

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 12: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Filter Pipeline - Best Practices Impersonation

bull Pipeline process runs a ldquolocal servicerdquobull Filters must impersonate when accessing user data

bull When using the printer handlebull PTOpenProviderEx PTMergeAndValidatePrintTicket etc

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 13: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Filter Pipeline - Best Practices Global Variables

bull The same filters can be used in multiple pipelines at the same time

bull Pipeline process can call InitializeFilter and StartOperation concurrently

bull Protect global variables

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 14: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Print Filter Pipeline ndash Best PracticesObfuscated Fonts

The Vista RTM WDK sample shows an unsupported method for using obfuscated fonts in the pipeline

This is what we recommend 1) Create the font and use a uniform resource identifier (URI) that

includes such as L21223d92-e614-48a5-925c-c6962b6a8124odtff (ldquordquo is not needed on

SP1 and later)

2) Call the SetFontOptions method on the IPartFont This method sets the appropriate content type and marks the font as obfuscated pFont-gtSetFontOptions(Font_Obfusticate)

3) Do not XOR manually the first bytes of the font data stream with the GUID which is part of the URI

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 15: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Client- and Server-Side Rendering

bull Filter pipeline is subject to client-side rendering (CSR)bull SetPrinterData values

bull ForceClientSideRenderingldquo in Windows 7bull EmfDespoolingSettingldquo in Vista and later

bull Client ndash Server connectivity problemsbull Connection is switched to server-side rendering (SSR) in Vistabull Connections stays CSR in Windows 7

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 16: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Client-Side Rendering ndash GUID names

bull CSR uses local printer objectsbull Name like CSR|serverGUIDbull Possible to retrieve the printer connection namebull Get the printer handle from the property bag

bull XPS_FP_PRINTER_HANDLE property

bull Key ldquodsspoolerrdquo and the value ldquoUNCNameldquo in GetPrinterDataEx

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 17: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Call To Action

bull Review and follow best practices discussed in this deckbull Continue adoption of new technologies in your driver and

device development XPS WSDbull Attend other print-related sessions

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 18: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Related Sessions

Session Day Time

Best Practices for Developing Printer Drivers Mon 830-930 and Tues 830-930

Printer Installation and Driver Management Mon 945-1045 andTues 245-345

Printer Verifier Tues 11-12

Printer Driver Testing Tools Tues 945-1045 andWed 830-930

Printer Driver Testing and the Windows Logo Kit Tues 130-230

XPS Rasterization Services in Windows 7 Mon 130-230 andTues 515-615

Discussion XPS Driver Development in Windows 7 Mon 4-5 and Wed 130-230

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources
Page 19: Printer Driver Development in Windows 7 Felix Maxa Software Engineer Microsoft Corporation

Additional Resources

bull E-mail aliases for developer support prninfo and xpsinfo

bull Print Devices on the WHDC Web Site httpwwwmicrosoftcomwhdcdeviceprintdefaultmspx

bull XPS on the Microsoft Web sitehttpwwwmicrosoftcomxps

  • Slide 1
  • Printer Driver Development in Windows 7
  • Agenda
  • Print Driver Isolation
  • Print Driver Isolation (2)
  • XPS Print API
  • Print Plug-in Context API
  • Print Filter Pipeline ndash Optional Service Providers
  • Print Filter Pipeline - Updates
  • Print Filter Pipeline ndash Restricted Fonts
  • Print Filter Pipeline - Performance
  • Print Filter Pipeline - Discard Control
  • Print Filter Pipeline - Best Practices Impersonation
  • Print Filter Pipeline - Best Practices Global Variables
  • Print Filter Pipeline ndash Best Practices Obfuscated Fonts
  • Client- and Server-Side Rendering
  • Client-Side Rendering ndash GUID names
  • Call To Action
  • Related Sessions
  • Additional Resources