How to write custom Preview handler for XPS document

Hi,

I am new to Windows SDK. I wanted to develop my own preview handler for XPS document from scracth. I started with the Windows SDK sample installed on my vista machine.

I am unable to compile PreviewHandler SDK sample. I have followed the steps given in Winodws SDK release notes to compile the sample. i.e.

Build a .vcproj by typing vcbuild mysample.vcproj.

I am getting following erros while firing this command on Windows SDK command Shell.

1) midl\oleaut32.dll : error MIDL2020 : error generating type library : SaveAllChanges Failed : .\Debug/PreviewHandlerSDKSample.tlb (0x80070005)

2) midl\oleaut32.dll : error MIDL2020 : error generating type library : SaveAllChanges Failed : .\Release/PreviewHandlerSDKSample.tlb (0x80070005)

I did not find SDK Documentaiton and Readme file very useful.

Kindly guide me what to do to resolve this error?
Also let me know how do i start to create preview handler for XPS document.

Thanks in advance,
Kinnari

Kinnari

[991 byte] By [KinnariBhavsar] at [2008-1-10]
# 1

Kinnari,

I apologize that you are having difficulty building the PreviewHandler SDK sample. In the future we will try to be more explicit on how to get the samples built and running out of the box.

I did some investigation, and it looks like the issue that you are seeing is related to command line permissions. If you are building the sample in the SDK directory (i.e. Program Files\Microsoft SDKs\Windows\v6.0) then the default 'CMD Shell' build environment won't have permissions to bin place the files.

One of these solutions should solve your problem:

  • Copy the relevant sample to an unrestricted location (e.g. Documents) and build from here
  • Launch the CMD Shell build environment from an elevated command prompt (Right-click, Run as administrator)

Again, sorry about the difficulty. I hope that things work well moving forward...if not feel free to ask more questions

Thanks,
David

DavidWashington[MSFT] at 2007-10-3 > top of Msdn Tech,Software Development for Windows Vista,XML Paper Specification (XPS)...
# 2

Hi David,

Thanks for the reply.

I have used Previewhandler framework from this site.

http://blogs.claritycon.com/blogs/ryan_powers/default.aspx

I have created my own XPS Preview Handler which is file based. It internally generates web browser for rendering xps document.

Now I would like to convert develop Custom XPS Previw handler by deriving it from StreamBasedPreview handler instead of file based?

Can you guide me how I can achieve this ?

Thank you,

Kinnari Bhavsar

KinnariBhavsar at 2007-10-3 > top of Msdn Tech,Software Development for Windows Vista,XML Paper Specification (XPS)...

Software Development for Windows Vista

Site Classified