Exercise 2: Generating Documents using Word Services
In this exercise you will be adding an Event Receiver to the State Reports document library that will convert all docx files submitted into XPS and PDF files. This is done using Word Services and a scheduled job that converts all registered documents every 15 minutes. To provide feedback to the user you will also be implementing a simple web part that will provide a summary of the jobs submitted to Word Services.
Task 1 – Create the Printable Document Library event receiver
In this task, you will define a List Item Event Receiver that will fire anytime an item a new file is added or updated in the document library. This Event Receiver will start a print job that will convert the added or updated docx file into an XPS and PDF document.
Task 2 – Build the PrintingStatus web part
In this task you will create a web part that will monitor the printing jobs started in a Printable Document Library. This web part will show the total number of jobs in action and the number of jobs in each state.
Task 3 – Place the Printing Status web part on the page
In this task, you will update the main site page by adding a Printing Status web part to the page.
Exercise 2 Verification
In order to verify that you have correctly performed all steps of exercise 2, proceed as follows:
Test the Event Handler and Web Part
Test your event handler and web part by generating a new state report and verifying an XPS and PDF file are generated as well by Word Services.