<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:georss="http://www.georss.org/georss" xmlns:thr="http://purl.org/syndication/thread/1.0"><id>tag:blogger.com,1999:blog-5787751540548761056</id><updated>2010-09-02T18:34:27.554+01:00</updated><title type="text">Muhimbi's SharePoint Blog</title><subtitle type="html">Muhimbi Ltd is a provider of shrink wrapped solutions for the SharePoint market. All our products, such as PDF Converters and Audit Log management tools, are designed for both MOSS and WSS 3 and are available in a number of different languages.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default?start-index=26&amp;max-results=25" /><author><name>Si</name><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>94</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/MuhimbiBlog" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="muhimbiblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-1248011327793348044</id><published>2010-08-31T19:22:00.001+01:00</published><updated>2010-09-01T14:50:42.234+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="InfoPath" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><category scheme="http://www.blogger.com/atom/ns#" term="Beta" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Using SharePoint Forms Services to convert InfoPath forms to PDF format</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 5px 0px 5px 15px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="forms" border="0" alt="forms" align="right" src="http://lh5.ggpht.com/_bUq2JqpCltk/TH1IaH2zkZI/AAAAAAAAADI/RzldAPb5MRU/forms%5B6%5D.jpg?imgmax=800" width="123" height="106" /&gt; Our popular &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;PDF Converter for SharePoint&lt;/a&gt; has been able to convert InfoPath document to PDF format for quite some time and, even though we are continuously improving it with new functionality such as &lt;a href="http://blog.muhimbi.com/2010/08/controlling-which-views-to-export-to.html"&gt;Dynamic View Selection&lt;/a&gt; and the ability to &lt;a href="http://blog.muhimbi.com/2010/08/converting-infopath-forms-including-all.html"&gt;convert InfoPath attachments&lt;/a&gt;, you just can’t please everyone all the time. &lt;/p&gt;  &lt;p&gt;For example, to achieve the best possible conversion fidelity our product requires InfoPath to be installed on the conversion server. This works great, but in some (mainly externally hosted) environments, this is not always possible. Fortunately the 4.0 version of the PDF Converter for SharePoint now comes with support for converting InfoPath forms to PDF format using InfoPath Forms Services, which is included with the Enterprise version of SharePoint 2007 &amp;amp; 2010. &lt;/p&gt;  &lt;p&gt;This can be very useful for some environments, but there are some limitations with this technique:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;InfoPath Forms services is required so it doesn’t run on the base &lt;em&gt;WSS3&lt;/em&gt; or &lt;em&gt;SharePoint Foundation&lt;/em&gt; versions. &lt;/li&gt;    &lt;li&gt;It only works with Forms that are &lt;em&gt;Browser enabled&lt;/em&gt;. &lt;/li&gt;    &lt;li&gt;Dynamic View Selection and conversion of Attachments features are not available, although it is possible to specify the name of the View to convert. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;Our traditional approach that uses InfoPath on the server does not have these limitations. &lt;/p&gt;  &lt;p&gt;The upcoming release will be a big one so keep an eye on the other posts in this series. You may also want to consider subscribing to our &lt;a href="http://feeds.feedburner.com/MuhimbiBlog"&gt;RSS feed&lt;/a&gt; or &lt;a href="http://twitter.com/Muhimbi"&gt;following us on Twitter&lt;/a&gt;. If you are interested in participating in the beta program then please &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;drop us a line&lt;/a&gt;.    &lt;br /&gt;&amp;#160;&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://www.muhimbi.com/Images---Files/Blog/FormToHTML.aspx"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_bUq2JqpCltk/TH5aMbiTuDI/AAAAAAAAADQ/Nog-o-UxEKE/image%5B10%5D.png?imgmax=800" width="688" height="444" /&gt;&lt;/a&gt;&lt;em&gt; From Browser based form (left) to PDF Document (right). Click image to open the full PDF file.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;Let’s show how to use Form Services in combination with the PDF Converter for SharePoint to convert InfoPath Documents. Some familiarity with both InfoPath and SharePoint is assumed. If you have any questions after reading this then leave a message in the comments section at the end of this post or &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us&lt;/a&gt;. &lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;&lt;a href="http://www.muhimbi.com/contact.aspx"&gt;Request the latest beta version&lt;/a&gt; of the PDF Converter for SharePoint and install it.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Make sure you have the appropriate privileges to create workflows on a site collection.        &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Start InfoPath, select &lt;em&gt;Customize a Sample&lt;/em&gt; and double click on &lt;em&gt;Sample – Expense Report&lt;/em&gt;.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;From the &lt;em&gt;File&lt;/em&gt; menu select &lt;em&gt;Publish&lt;/em&gt; and go through the usual steps to publish the form to a new SharePoint Library named &lt;em&gt;Expenses&lt;/em&gt;.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;In the new &lt;em&gt;Expenses&lt;/em&gt; document library, fill out a form and save it as Form1.xml.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Create a new workflow using SharePoint Designer.        &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;On the Workflow definition screen associate the workflow with the new &lt;em&gt;Expenses&lt;/em&gt; list, tick the boxes next to both ‘Automatically start….’ options and proceed to the next screen.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Add the &lt;em&gt;Convert HTML to PDF&lt;/em&gt; action, click &lt;em&gt;this url / html&lt;/em&gt; and enter the path to your site collection followed by Muhimbi’s InfoPathPrint.aspx page, e.g. &lt;em&gt;http:/moss/sites/Finance/_layouts/Muhimbi.PDFConverter/InfoPathPrint.aspx&lt;/em&gt;         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Don’t close the String Builder dialog yet. Add the &lt;em&gt;xmlLocation&lt;/em&gt; querystring parameter, click the &lt;em&gt;Add Lookup&lt;/em&gt; button and select the &lt;em&gt;Server Relative URL &lt;/em&gt;field for the Current Item. The final result should look like the following screenshot.         &lt;br /&gt;        &lt;br /&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_bUq2JqpCltk/TH1Iai9eCkI/AAAAAAAAADM/1uNkl2fM-qk/image_thumb%5B3%5D.png?imgmax=800" width="596" height="294" /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Close the String Builder and click the &lt;em&gt;this file&lt;/em&gt; option. Assuming we want to write the converted PDF file to the &lt;em&gt;Shared Documents&lt;/em&gt; library enter Shared Documents/&lt;u&gt;[%Expenses:Name%]&lt;/u&gt;.pdf. (Insert the underlined text using the &lt;em&gt;Lookup&lt;/em&gt; button. Just typing it in will not work).         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Optionally change the orientation of the page to &lt;em&gt;Landscape&lt;/em&gt;. There should be no need to specify the username and password as by default the credentials the Document Conversion Service runs under will be used for authentication with the aspx page.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Close the workflow to save and activate it. &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Add a new form to, or update an existing one in, the Expenses library. After a few seconds the Workflow Status should change to &lt;em&gt;Completed&lt;/em&gt;. Once complete the converted PDF document can be opened from the Shared Documents library.&lt;/p&gt;  &lt;p&gt;If your InfoPath form contains multiple views then you can select which view to convert by concatenating &lt;em&gt;&amp;amp;ViewName=your_view_name&lt;/em&gt; to the URL of InfoPathPrint.aspx.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In summary, if it is not possible to install InfoPath on the server in your environment, or if your forms look better in Forms Services compared to the full InfoPath client (it does happen), then use the technique described in this post to convert InfoPath documents to PDF format using InfoPath Forms Services.&lt;/p&gt;  &lt;p&gt;As always, upgrades are completely free. Don’t hesitate to leave a comment below if you have any questions or &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us&lt;/a&gt; to participate in the beta program&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-1248011327793348044?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/1248011327793348044/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/using-sharepoint-forms-services-to.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/1248011327793348044" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/1248011327793348044" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/using-sharepoint-forms-services-to.html" title="Using SharePoint Forms Services to convert InfoPath forms to PDF format" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-2236226347383028712</id><published>2010-08-31T16:52:00.001+01:00</published><updated>2010-08-31T17:04:40.490+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><category scheme="http://www.blogger.com/atom/ns#" term="Beta" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Converting SharePoint Lists to PDF format using a SharePoint Designer Workflow</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 5px 0px 5px 10px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="List" border="0" alt="List" align="right" src="http://lh3.ggpht.com/_bUq2JqpCltk/TH0lKldvz1I/AAAAAAAAAC8/fz77FJA93Qc/List%5B5%5D.png?imgmax=800" width="128" height="128" /&gt; As one of the leading vendor in the SharePoint PDF Conversion market, we are frequently asked about how our products can be used to convert a SharePoint List into a PDF file. Up until now we have never had a good answer to this question as we mainly deal with the conversion of Office Documents and InfoPath forms. &lt;/p&gt;  &lt;p&gt;However, as the upcoming version 4.0 of the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;PDF Converter for SharePoint&lt;/a&gt; and &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;PDF Converter Services&lt;/a&gt; support the conversion of HTML based content we can now export any SharePoint page, including ones that contain all entries in a list, to a PDF Document. This article shows how to put this together.&lt;/p&gt;  &lt;p&gt;The upcoming release will be a big one so keep an eye on the other posts in this series. You may also want to consider subscribing to our &lt;a href="http://feeds.feedburner.com/MuhimbiBlog"&gt;RSS feed&lt;/a&gt; or &lt;a href="http://twitter.com/Muhimbi"&gt;following us on Twitter&lt;/a&gt;. If you are interested in participating in the beta program then please &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;drop us a line&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;OK, let’s get going. In this example we use a simple Tasks list, so open your SharePoint site and create a Tasks lists if one doesn’t already exists.&lt;/p&gt;  &lt;p&gt;Next up we need to create a page that displays all items in the list with as little of the SharePoint User Interface around it as possible. We could just use the list’s default view, but that would convert the Quick Launch menu to PDF as well, which doesn’t look very clean. To create a new page without the Quick Launch menu follow these steps:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Navigate to the &lt;em&gt;View All Site Content&lt;/em&gt; screen and click the &lt;em&gt;Create&lt;/em&gt; button.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;In the &lt;em&gt;Web Pages&lt;/em&gt; column select &lt;em&gt;Web Part Page.&lt;/em&gt;       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Name the page &lt;em&gt;PDFTasks.aspx&lt;/em&gt;, choose the &lt;em&gt;Full Page, Vertical&lt;/em&gt; template and click the &lt;em&gt;Create&lt;/em&gt; button.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;On the newly created page click &lt;em&gt;Add a Web Part&lt;/em&gt; and add the &lt;em&gt;Tasks&lt;/em&gt; list.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Click the newly inserted Web Part’s &lt;em&gt;Edit&lt;/em&gt; button and select the &lt;em&gt;Modify Shared Web Part&lt;/em&gt; option.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Click &lt;em&gt;Edit the current View&lt;/em&gt; and select the columns you want to be included in the PDF file. For example &lt;em&gt;% Complete, Due Data, Start Date &lt;/em&gt;and &lt;em&gt;Status. &lt;/em&gt;Do not close the screen yet.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Under the &lt;em&gt;Item Limit&lt;/em&gt; section set the limit to an appropriately large number. We don’t want to page through the data in batches as we want to include all items in the PDF file.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Click OK to save the changes.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Save the page’s URL as we need it later. E.g. http://moss/sites/Management/FormServerTemplates/PDFTasks.aspx. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This new page will be used as the underlying layout of the PDF document. Feel free to modify it further in SharePoint designer / JQuery and remove more parts of the SharePoint user interface. You could also consider creating a minimalistic master page and applying that to the new PDFTasks page.    &lt;br /&gt;&amp;#160; &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_bUq2JqpCltk/TH0lLHn-GMI/AAAAAAAAADA/5fPrI0abv4s/image%5B20%5D.png?imgmax=800" width="658" height="325" /&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;With the page in place the next thing we need to do is setup the automatic PDF Conversion using a SharePoint Designer workflow. In this example we generate a PDF file whenever the Tasks list is modified. The generated PDF file is stored in the Shared Documents library. Create the workflow as follows:&lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;&lt;a href="http://www.muhimbi.com/contact.aspx"&gt;Request the beta version&lt;/a&gt; of the PDF Converter for SharePoint and install it.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Make sure you have the appropriate privileges to create workflows on a site collection.        &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Create a new workflow using SharePoint Designer.        &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;On the Workflow definition screen associate the workflow with the Tasks list, tick the boxes next to both ‘&lt;em&gt;Automatically start….&lt;/em&gt;’ options and proceed to the next screen.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Add the &lt;em&gt;Convert HTML to PDF&lt;/em&gt; action and click on &lt;em&gt;this url &lt;/em&gt;and enter the URL to the page that was created in a previous step, e.g. http://moss/sites/Management/FormServerTemplates/PDFTasks.aspx.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Click &lt;em&gt;this file&lt;/em&gt; and enter the path and file name where the PDF file will be generated, e.g. &lt;em&gt;Shared Documents/Tasks.pdf.          &lt;br /&gt;&amp;#160;&lt;/em&gt; &lt;/li&gt;      &lt;li&gt;Optionally change the generated page’s orientation from &lt;em&gt;Portrait&lt;/em&gt; to &lt;em&gt;Landscape&lt;/em&gt;.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;The user name and password are optional. By default the credentials the &lt;em&gt;Muhimbi Conversion Service&lt;/em&gt; runs under will be used to open the web page. For now leave it empty.         &lt;br /&gt;&amp;#160; &lt;/li&gt;      &lt;li&gt;Click the Finish button to activate the workflow. &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_bUq2JqpCltk/TH0lMFrWD7I/AAAAAAAAADE/YgmKcOO9v0o/image%5B19%5D.png?imgmax=800" width="680" height="256" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;As a test enter one or more tasks. Every time a task is added or updated a PDF file is written to &lt;em&gt;Shared Documents/Tasks.pdf. &lt;/em&gt;Open the PDF file to see the results.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In summary, the HTML conversion capability of the new version opens up a whole array of new possibilities.&amp;#160; As always, upgrades are completely free. Don’t hesitate to leave a comment below if you have any questions or &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us&lt;/a&gt; to participate in the beta program&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-2236226347383028712?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/2236226347383028712/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/converting-sharepoint-lists-to-pdf.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/2236226347383028712" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/2236226347383028712" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/converting-sharepoint-lists-to-pdf.html" title="Converting SharePoint Lists to PDF format using a SharePoint Designer Workflow" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-3140229352267858167</id><published>2010-08-20T15:08:00.001+01:00</published><updated>2010-08-23T11:10:55.045+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="InfoPath" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="Beta" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Controlling which views to export to PDF format in InfoPath</title><content type="html">&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="View" border="0" alt="View" align="right" src="http://lh6.ggpht.com/_bUq2JqpCltk/TG6MVkiFE2I/AAAAAAAAACs/OEvclQmQ0F4/View%5B5%5D.jpg?imgmax=800" width="132" height="124" /&gt;   &lt;p&gt;Next up in our series about new features in the upcoming release of the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;PDF Converter for SharePoint&lt;/a&gt; and &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;PDF Converter Services&lt;/a&gt;, we’ll showcase some of the new &lt;em&gt;Export to PDF View Selection&lt;/em&gt; capabilities of our InfoPath converter.&lt;/p&gt;  &lt;p&gt;The upcoming release will be a big one so keep an eye on the other posts in this series. You may also want to consider subscribing to our &lt;a href="http://feeds.feedburner.com/MuhimbiBlog"&gt;RSS feed&lt;/a&gt; or &lt;a href="http://twitter.com/Muhimbi"&gt;following us on Twitter&lt;/a&gt;. If you are interested in participating in the beta program then please &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;drop us a line&lt;/a&gt;.     &lt;br /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Being able to select which views to export is very useful as quite often different views are used for exporting a form to PDF. Sometimes using the &lt;em&gt;Print View&lt;/em&gt; is good enough, but other times you need to export a different view or multiple views to PDF format. There are even occasions where different views are exported depending on the state of the data entered in the form.&lt;/p&gt;  &lt;p&gt;As always, the best way to illustrate this is by example.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Use a special view for exporting to PDF&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In this scenario we have an Employee Review form with the following 3 views:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;Data entry view&lt;/strong&gt;: A view used for populating data using the InfoPath client or Forms Services. This is the default view. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Print View&lt;/strong&gt;: A special view that is optimised for printing to a network laser printer. This is specified as &lt;em&gt;View 1&lt;/em&gt;’s Print View. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;PDF Export view:&lt;/strong&gt; A separate view that is used to export the InfoPath form to PDF format as it contains some information that should only show up in exported PDF files. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;   &lt;br /&gt;As &lt;em&gt;View 1&lt;/em&gt; is the default view and &lt;em&gt;View 2&lt;/em&gt; is the Print View for &lt;em&gt;View 1&lt;/em&gt;, under normal circumstance the 2nd view is used for exporting to PDF. However, we want to use View 3 for this purpose. We can achieve this by starting the name of View 3 with “_MuhimbiView”. The Muhimbi PDF Converter will automatically detect all views that start with this name, export them all and merge them together into a single PDF file. Naturally these views can be hidden from the end user by marking them as such.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="InfoPath-Views" border="0" alt="InfoPath-Views" src="http://lh4.ggpht.com/_bUq2JqpCltk/TG6MWQrYE5I/AAAAAAAAACw/lAbo0hgx3sg/InfoPath-Views%5B7%5D.png?imgmax=800" width="170" height="286" /&gt;&amp;#160;&amp;#160; &lt;br /&gt;This is a great solution if you know beforehand that you will always be exporting the same view(s) to PDF format.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Determine at runtime which views to export&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The previous solution, using view names that start with “_MuhimbiView”, works great. However, sometimes you need to export a different view depending on the state of the data.&lt;/p&gt;  &lt;p&gt;For example, our Expense Claim form consists of the following Views:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;Data Entry View 1&lt;/strong&gt;: Used by the employee to report expenses. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Data Entry View 2&lt;/strong&gt;: Used by the manager to add comments and additional information. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;PDF Export View 1&lt;/strong&gt;: The view that is used to export the form to PDF format &lt;em&gt;before&lt;/em&gt; the manager has reviewed the form. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;PDF Export View 2&lt;/strong&gt;: The view that is used to export the form to PDF format &lt;em&gt;after&lt;/em&gt; the manager has reviewed the form. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;OK, so how are we going to deal with this? Well, here comes the Muhimbi PDF Converter to the rescue! By adding a (hidden) text box named “_MuhimbiViews” (case sensitive) to any of the views and populating it with the name of one or more comma separated view names, the Muhimbi PDF Converter will automatically pick up these names and export them to PDF format. If multiple views are specified then they are automatically concatenated together.&lt;/p&gt;  &lt;p&gt;In addition to adding the “_MuhimbiViews” text field to the form, all the developer of the form needs to do is to add a little bit of logic to the Submit event of the 2 data entry views that specify the correct view name to export in the “_MuhimbiViews” field.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;View prioritisation rules&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;To determine which view or views to export, the Muhimbi PDF Converter uses the following prioritisation rules:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;If a field named “_MuhimbiViews” is found anywhere in the InfoPath form then the content of this field is used to determine which views to export. &lt;/li&gt;    &lt;li&gt;If the previous field does not exist, is empty or the specified view name does not exist then the converter looks at all view names that start with “_MuhimbiView”. &lt;/li&gt;    &lt;li&gt;If none of the previous options apply then the view marked as the &lt;em&gt;Default View&lt;/em&gt; is exported. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Regardless of how a view or views are selected for export, if the selected view has a Print View specified than that view is given priority.    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;InfoPath's 'Print multiple views' option is not used when exporting views to PDF. This is by design as the views defined in this setting may already be used for other (non PDF) based printing purposes.&lt;/p&gt;  &lt;p&gt;When all elements are combined into the final PDF file then all views are copied first followed by any &lt;a href="http://blog.muhimbi.com/2010/08/converting-infopath-forms-including-all.html"&gt;converted attachments&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In summary, the new version of the PDF Converter adds flexible View selection features to make the life of InfoPath developers easier. As always, upgrades are completely free. Don’t hesitate to leave a comment below if you have any questions or &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us&lt;/a&gt; to participate in the beta program&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-3140229352267858167?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/3140229352267858167/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/controlling-which-views-to-export-to.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/3140229352267858167" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/3140229352267858167" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/controlling-which-views-to-export-to.html" title="Controlling which views to export to PDF format in InfoPath" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-8605709602819741954</id><published>2010-08-19T15:12:00.001+01:00</published><updated>2010-09-01T08:47:32.180+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="Beta" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Convert SharePoint HTML pages to PDF format</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 5px 0px 5px 15px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="html" border="0" alt="html" align="right" src="http://lh4.ggpht.com/_bUq2JqpCltk/TG07r8yfkMI/AAAAAAAAACk/KO6d6HFv1Rc/html%5B5%5D.png?imgmax=800" width="128" height="128" /&gt; &lt;/p&gt;  &lt;p&gt;As part of our ongoing series about new features in the upcoming release of the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;PDF Converter for SharePoint&lt;/a&gt; and &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;PDF Converter Services&lt;/a&gt;, we would like to showcase our exciting new HTML to PDF conversion functionality.&lt;/p&gt;  &lt;p&gt;The upcoming release will be a big one so keep an eye on the other posts in this series. You may also want to consider subscribing to our &lt;a href="http://feeds.feedburner.com/MuhimbiBlog"&gt;RSS feed&lt;/a&gt; or &lt;a href="http://twitter.com/Muhimbi"&gt;following us on Twitter&lt;/a&gt;. If you are interested in participating in the beta program then please &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;drop us a line&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;We anticipate that most of our customers will use this functionality to convert SharePoint pages, including lists, to PDF format. However, rather than displaying a boring old SharePoint site, let’s show how well this works with a real website, in this case &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;one of our landing pages&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: A &lt;a href="http://blog.muhimbi.com/2010/08/using-sharepoint-forms-services-to.html"&gt;workflow activity is now available as well&lt;/a&gt; for converting HTML to PDF&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;The following image shows the original HTML page on the left hand side and the converted PDF file on the right. As you can see this works very well.    &lt;br /&gt;&amp;#160;&lt;/p&gt;  &lt;p align="center"&gt;&lt;a title="Click to see the original" href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="HTML-to-PDF" border="0" alt="HTML-to-PDF" src="http://lh4.ggpht.com/_bUq2JqpCltk/TG07s0PjfBI/AAAAAAAAACo/NOLvJuxZsI4/HTML-to-PDF%5B10%5D.jpg?imgmax=800" width="675" height="400" /&gt;&lt;/a&gt; &lt;i&gt;Example of the original web page (left) and the converted PDF file (right)&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;A summary of the new HTML features are as follows. Although this new functionality is available in both the PDF Converter Services as well as the PDF Converter for SharePoint, some of the more SharePoint centric features in the list are obviously exclusive to the SharePoint version.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Built on top of Muhimbi’s rock solid service platform. No need to worry about runaway or orphaned processes. Everything is nicely controlled and scales over multiple CPUs and conversion servers.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Integrates with the full feature set of Muhimbi’s PDF Conversion platform including full control over &lt;a href="http://blog.muhimbi.com/2010/01/adding-watermark-to-pdf-file-from.html"&gt;watermarks&lt;/a&gt; as well as &lt;a href="http://blog.muhimbi.com/2010/01/configure-pdf-security-from-sharepoint.html"&gt;PDF Security settings&lt;/a&gt;.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;High fidelity conversion (See image above) including multi page documents and JavaScript output. The generated PDF file contains real (searchable) text and is not just a low resolution screenshot of the converted web page.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Supports conversion by URL as well as manually specified HTML fragments. Ideal for creating PDF based reports using generated HTML tables.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Convert HTML documents stored inside SharePoint document libraries.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Convert SharePoint pages to PDF format from the user’s &lt;em&gt;Personal Actions&lt;/em&gt; menu.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Convert web pages to PDF format from SharePoint workflows. Works great in combination with publishing sites. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;HTML to PDF Conversion is accessible via the web services based interface as well. Listed below is a simple C# example of how to carry out a conversion from your own code. The code is not complete as it calls into some shared functions from our &lt;a href="http://blog.muhimbi.com/2009/12/converting-office-files-to-pdf-format.html"&gt;main C# example&lt;/a&gt; to keep things short.&lt;/p&gt;  &lt;p&gt;Our existing &lt;a href="http://blog.muhimbi.com/2010/04/convert-office-files-to-pdf-format-from.html"&gt;Java based examples&lt;/a&gt; can easily be extended to carry out the same type of conversions. &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;Contact us&lt;/a&gt; if you need a hand, we love to help and are very responsive.     &lt;br /&gt;&amp;#160;&lt;/p&gt;  &lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; margin-bottom: 20px; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;   &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Simple sample to convert either a URL or HTML code fragment to PDF format&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param name=&amp;quot;htmlOnly&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;A flag indicating if an HTML Code fragment (true)&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; or URL (false) should be converted.&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;private&lt;/span&gt; &lt;span style="color: #cc7832"&gt;void&lt;/span&gt; ConvertHTML(&lt;span style="color: #cc7832"&gt;bool&lt;/span&gt; htmlOnly)&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;DocumentConverterServiceClient&lt;/span&gt; client = &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;try&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt; sourceFileName = &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;byte&lt;/span&gt;[] sourceFile = &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; client = OpenService(&lt;span style="color: #a5c25c"&gt;&amp;quot;http://localhost:41734/Muhimbi.DocumentConverter.WebService/&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;OpenOptions&lt;/span&gt; openOptions = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;OpenOptions&lt;/span&gt;();&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;//** Specify optional authentication settings for the web page&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; openOptions.UserName = &lt;span style="color: #a5c25c"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; openOptions.Password = &lt;span style="color: #a5c25c"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (htmlOnly == &lt;span style="color: #cc7832"&gt;true&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;//** Specify the HTML to convert&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sourceFile = System.Text.&lt;span style="color: #ffc66d"&gt;Encoding&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.UTF8.GetBytes(&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;&amp;quot;Hello &amp;lt;b&amp;gt;world&amp;lt;/b&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Specify the URL to convert&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; openOptions.OriginalFileName = &lt;span style="color: #a5c25c"&gt;&amp;quot;http://www.muhimbi.com/&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; openOptions.FileExtension = &lt;span style="color: #a5c25c"&gt;&amp;quot;html&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;//** Generate a temp file name that is later used to write the PDF to&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sourceFileName = &lt;span style="color: #ffc66d"&gt;Path&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.GetTempFileName();&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;File&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Delete(sourceFileName);&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Enable JavaScript on the page to convert. &lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; openOptions.AllowMacros = &lt;span style="color: #6897bb"&gt;MacroSecurityOption&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.All;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Set the various conversion settings&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;ConversionSettings&lt;/span&gt; conversionSettings = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;ConversionSettings&lt;/span&gt;();&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; conversionSettings.Fidelity = &lt;span style="color: #6897bb"&gt;ConversionFidelities&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Full;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; conversionSettings.PDFProfile = &lt;span style="color: #6897bb"&gt;PDFProfile&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.PDF_1_5;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; conversionSettings.PageOrientation = &lt;span style="color: #6897bb"&gt;PageOrientation&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Portrait;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; conversionSettings.Quality = &lt;span style="color: #6897bb"&gt;ConversionQuality&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.OptimizeForPrint;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Carry out the actual conversion&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;byte&lt;/span&gt;[] convertedFile = client.Convert(sourceFile, openOptions, conversionSettings);&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Write the PDF file to the local file system.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt; destinationFileName = &lt;span style="color: #ffc66d"&gt;Path&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.GetDirectoryName(sourceFileName) + &lt;/span&gt;&lt;span style="color: #eb6767; font-weight: normal"&gt;@&amp;quot;\&amp;quot;&lt;/span&gt; + &lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Path&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.GetFileNameWithoutExtension(sourceFileName) + &lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #a5c25c"&gt;&amp;quot;.&amp;quot;&lt;/span&gt; + conversionSettings.Format;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;using&lt;/span&gt; (&lt;span style="color: #ffc66d"&gt;FileStream&lt;/span&gt; fs = &lt;span style="color: #ffc66d"&gt;File&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Create(destinationFileName))&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; fs.Write(convertedFile, &lt;span style="color: #6897bb"&gt;0&lt;/span&gt;, convertedFile.Length);&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; fs.Close();&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Display the converted file in a PDF viewer.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; NavigateBrowser(destinationFileName);&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;finally&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CloseService(client);&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;All in all some pretty exciting functionality. Don’t hesitate to leave a comment below if you have any questions or &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us&lt;/a&gt; to participate in the beta program.&lt;/p&gt;

&lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-8605709602819741954?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/8605709602819741954/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/convert-sharepoint-html-pages-to-pdf.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/8605709602819741954" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/8605709602819741954" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/convert-sharepoint-html-pages-to-pdf.html" title="Convert SharePoint HTML pages to PDF format" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-2098144589734331897</id><published>2010-08-19T11:15:00.001+01:00</published><updated>2010-08-23T11:11:41.806+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="InfoPath" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="Beta" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Converting InfoPath forms including all attachments to a single PDF file</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 5px 0px 5px 25px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Attachment" border="0" alt="Attachment" align="right" src="http://lh6.ggpht.com/_bUq2JqpCltk/TG0EKnzmXeI/AAAAAAAAACc/GMLBzoRYoH8/Attachment%5B5%5D.png?imgmax=800" width="128" height="128" /&gt; Over the next few days I will be writing about the new features in our upcoming release of the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;PDF Converter for SharePoint&lt;/a&gt; and &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;PDF Converter Services&lt;/a&gt;. As this release will be a big one it won’t all fit in one post, so stay tuned and consider subscribing to our &lt;a href="http://feeds.feedburner.com/MuhimbiBlog"&gt;RSS feed&lt;/a&gt; or &lt;a href="http://twitter.com/Muhimbi"&gt;follow us on Twitter&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;If you are interested in participating in the beta program then please &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;drop us a line&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;In today’s post I will explain the new functionality that allows files attached to InfoPath forms using the &lt;em&gt;File Attachment&lt;/em&gt; control to be converted to PDF together with the main InfoPath form. All files will be merged into a single PDF file that contains both the InfoPath form and all attachments.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This all works amazingly well and some of the people in our beta program are already using this feature successfully. In summary the functionality is as follows:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Automatic attachment conversion is enabled by default. Change the &lt;em&gt;InfoPathConverterFullFidelity.ConvertAttachments&lt;/em&gt; setting in the Muhimbi service’s config file to &lt;em&gt;False&lt;/em&gt; to disable conversion of attachments.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;You don’t need to know anything about the form that is being converted, nor do you need any programming knowledge, this functionality is truly universal. All attachments are automatically picked up, including attachments in &lt;em&gt;Repeating Sections&lt;/em&gt; and &lt;em&gt;Repeating Tables&lt;/em&gt;.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;All document types supported by the Muhimbi PDF Conversion engine are recognised. Files that are not supported are automatically skipped. For a full list of supported file formats see the &lt;em&gt;Specification&lt;/em&gt; tab on the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint.aspx"&gt;main product page&lt;/a&gt;.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Naturally attached PDF files are merged in as well, which is great for such attachments as scanned receipts or received faxes.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Do not attempt to attach an InfoPath form inside another form. This will result in an error.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;This functionality works hand-in-hand with the new &lt;em&gt;Export Multiple Views&lt;/em&gt; functionality that I will outline in an upcoming post.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;As all this work is carried out inside Muhimbi’s core conversion engine, any additional conversion settings such as &lt;a href="http://blog.muhimbi.com/2010/01/adding-watermark-to-pdf-file-from.html"&gt;watermarks&lt;/a&gt; and &lt;a href="http://blog.muhimbi.com/2010/01/configure-pdf-security-from-sharepoint.html"&gt;security settings&lt;/a&gt; are automatically applied to all pages of the combined PDF file. &lt;/li&gt; &lt;/ol&gt;  &lt;p align="center"&gt;&amp;#160;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_bUq2JqpCltk/TG0EK0jwynI/AAAAAAAAACg/KOr8inECGFY/image_thumb%5B3%5D.png?imgmax=800" width="420" height="476" /&gt; &lt;i&gt;Convert Expense Reports with attached receipts to a single PDF      &lt;br /&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;So, a very useful new feature that provides powerful new functionality to our customers. As always, upgrades are completely free. Don’t hesitate to leave a comment below if you have any questions or &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us&lt;/a&gt; to participate in the beta program.&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-2098144589734331897?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/2098144589734331897/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/converting-infopath-forms-including-all.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/2098144589734331897" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/2098144589734331897" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/converting-infopath-forms-including-all.html" title="Converting InfoPath forms including all attachments to a single PDF file" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-9163426243059482365</id><published>2010-08-18T18:58:00.001+01:00</published><updated>2010-08-18T18:58:42.849+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="InfoPath" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Dealing with hyperlinks when converting InfoPath files to PDF format</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 5px 0px 5px 10px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="infopath_logo" border="0" alt="infopath_logo" align="right" src="http://lh4.ggpht.com/_bUq2JqpCltk/TGwfUv_V1EI/AAAAAAAAACY/7bbyI8utBB8/infopath_logo%5B5%5D.jpg?imgmax=800" width="140" height="140" /&gt; We get a lot of questions from customers about what happens to hyperlinks in InfoPath documents when the documents are converted to PDF format using the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;Muhimbi PDF Converter for SharePoint&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;We ran the possible combinations through some tests with the following results:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;InfoPath TextBox elements with the type set to 'text' become hyperlinks when a URL is entered in it (or at least the PDF Reader navigates to that URL when clicked).      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;InfoPath TextBox elements with the type set to 'URL' become hyperlinks when a URL is entered in it (or at least the PDF Reader navigates to that URL when clicked).     &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Entering a URL in an InfoPath Rich Text Box and pressing the &lt;em&gt;Enter&lt;/em&gt; key automatically generates a blue hyperlink. When a document containing this link is converted to PDF format then the link can be clicked in the converted document as well.&amp;#160; &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Entering text in an InfoPath Rich Text Box, selecting it and using the &lt;em&gt;Insert Hyperlink&lt;/em&gt; command creates a clickable link in the InfoPath Document. However, after converting this document to PDF format this link is &lt;strong&gt;&lt;u&gt;not&lt;/u&gt;&lt;/strong&gt; clickable.&amp;#160; &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;InfoPath Hyperlink Fields are correctly converted and remain hyperlinks in the PDF document. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I hope this clarifies the situation.&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-9163426243059482365?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/9163426243059482365/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/dealing-with-hyperlinks-when-converting.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/9163426243059482365" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/9163426243059482365" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/dealing-with-hyperlinks-when-converting.html" title="Dealing with hyperlinks when converting InfoPath files to PDF format" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-8817417086529431358</id><published>2010-08-18T11:45:00.001+01:00</published><updated>2010-08-18T11:45:12.177+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="WPP" /><category scheme="http://www.blogger.com/atom/ns#" term="SP2010" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><title type="text">Workflow Power Pack 1.2.0.6 – Patch release for SharePoint 2010</title><content type="html">&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="WPPBox" border="0" alt="WPPBox" align="right" src="http://lh3.ggpht.com/_bUq2JqpCltk/TGu5t8aoAcI/AAAAAAAAACU/1smwkiNWbps/WPPBox%5B5%5D.jpg?imgmax=800" width="200" height="183" /&gt;   &lt;p&gt;We just &lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint/Download.aspx"&gt;published a patch release&lt;/a&gt; of the &lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint/summary.aspx"&gt;Workflow Power Pack for SharePoint&lt;/a&gt;. No new functionality, just a fix to deal with what we believe to be a bug in the way SharePoint 2010 deals with custom Workflow Activity Validators.&lt;/p&gt;  &lt;p&gt;Due to the manner SharePoint 2010 deals with lookup fields in custom activity validators, any custom code that contains lookup values (e.g. [%Current Item:Transaction Date%]) will not be validated when a workflow is published. We believe this to be a bug in SharePoint 2010 as this works fine in SharePoint 2007.&lt;/p&gt;  &lt;p&gt;If this is a big problem for you then consider passing in the lookup field as either &lt;em&gt;parameter 1&lt;/em&gt; or &lt;em&gt;parameter 2&lt;/em&gt; and refer to it using &lt;em&gt;MyWorkflow.Parameter1&lt;/em&gt;. For details on how to use the MyWorkflow object in your own code, see the &lt;a href="http://blog.muhimbi.com/2009/12/workflow-power-pack-user-guide-language.html"&gt;User Guide Series&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Code that does not contain lookup fields is validated properly. Regardless of the scenario, the code does execute correctly.&lt;/p&gt;  &lt;p&gt;SharePoint 2007 environments are not affected by this bug.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint/Download.aspx"&gt;Download the latest version&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-8817417086529431358?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/8817417086529431358/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/workflow-power-pack-1206-patch-release.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/8817417086529431358" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/8817417086529431358" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/workflow-power-pack-1206-patch-release.html" title="Workflow Power Pack 1.2.0.6 – Patch release for SharePoint 2010" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-1621084425712263504</id><published>2010-08-11T08:30:00.001+01:00</published><updated>2010-08-11T08:30:57.271+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MuSH" /><category scheme="http://www.blogger.com/atom/ns#" term="WPP" /><category scheme="http://www.blogger.com/atom/ns#" term="Infuser" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><category scheme="http://www.blogger.com/atom/ns#" term="Streaming Demo" /><title type="text">SharePoint Infuser, URL Shortener &amp; Workflow Power Pack Webinar recording</title><content type="html">&lt;p&gt;The 3rd recording in our series of SharePoint webinars is now available for download / streaming. This final recording discusses and demonstrates the free &lt;a href="http://www.muhimbi.com/Products/SharePoint-Infuser-(Free).aspx"&gt;Muhimbi SharePoint Infuser&lt;/a&gt; in addition to the &lt;a href="http://www.muhimbi.com/Products/SharePoint-URL-Shortener/summary.aspx"&gt;URL Shortener for SharePoint&lt;/a&gt; and the &lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint/summary.aspx"&gt;Workflow Power Pack&lt;/a&gt;.&amp;#160; &lt;/p&gt;  &lt;p&gt;The other 2 recordings, dealing with our popular &lt;a href="http://blog.muhimbi.com/2010/08/pdf-converter-for-sharepoint-recorded.html"&gt;PDF Converter for SharePoint&lt;/a&gt; and the &lt;a href="http://blog.muhimbi.com/2010/08/sharepoint-audit-suite-recorded-webinar.html"&gt;SharePoint Audit Suite&lt;/a&gt;, are available for viewing as well. 3 Webinars in one week….. I am knackered.     &lt;br /&gt;&amp;#160;&lt;/p&gt; &lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_bUq2JqpCltk/TGJRsIdRSsI/AAAAAAAAACQ/G29XBrrZNKQ/image%5B6%5D.png?imgmax=800" width="404" height="304" /&gt;   &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.muhimbi.com/media/2010-08-10%2014.07%20Workflow%20Power%20Pack,%20URL%20Shortener,%20SharePoint%20Infuser.wmv"&gt;Download / stream the presentation in WMV format&lt;/a&gt;. The slides are also &lt;a href="http://www.muhimbi.com/media/Muhimbi%20Infuser,%20URL%20Shortener,%20WPP%20Webinar.pdf"&gt;available in PDF format&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Some of the demos featured in the presentation are also available as separate blog posts:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Workflow Power Pack&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/12/workflow-power-pack-user-guide-language.html"&gt;SharePoint Workflow Power Pack User Guide&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/12/automatically-synchronise-sharepoint.html"&gt;Synchronise SharePoint Lists (Calendar/Tasks)&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/12/send-rich-emails-with-attachments-from.html"&gt;Send rich emails with attachments from a SharePoint Designer Workflow&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/05/combining-multiple-pdf-files-using.html"&gt;Combining multiple PDF files using a SharePoint Designer Workflow&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;&lt;strong&gt;URL Shortener for SharePoint&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/02/create-shortened-tinyurl-links-from.html"&gt;Create Shortened (‘TinyURL’) links from your SharePoint Workflow&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;&lt;strong&gt;SharePoint Infuser&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/07/massage-sharepoint-into-submission.html"&gt;‘Massage’ SharePoint into submission using Muhimbi’s SharePoint Infuser&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/07/automatically-add-search-as-you-type-to.html"&gt;Automatically add ‘Search As You Type’ to every SharePoint page using Infuser&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/08/fixing-sharepoints-wiki-by-adding-home.html"&gt;Fixing SharePoint’s Wiki by adding a home button and repairing the breadcrumb&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/08/how-to-float-sharepoint-quick-launch.html"&gt;How to Float the SharePoint Quick Launch menu with the location of the scroll bar&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/09/opening-sharepoint-site-settings-screen.html"&gt;Opening the SharePoint Site Settings screen instantly using a keyboard shortcut&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/09/add-real-time-filtering-to-all-lists.html"&gt;Add real-time filtering to all lists and libraries in a SharePoint Site Collection&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;   &lt;br /&gt;Enjoy watching it. As always, if you have any questioned then don’t hesitate to &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us&lt;/a&gt;. We are very helpful and answer any questions as quickly as we can.&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-1621084425712263504?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/1621084425712263504/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/sharepoint-infuser-url-shortener.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/1621084425712263504" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/1621084425712263504" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/sharepoint-infuser-url-shortener.html" title="SharePoint Infuser, URL Shortener &amp;amp; Workflow Power Pack Webinar recording" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-3520355809367749104</id><published>2010-08-10T18:51:00.001+01:00</published><updated>2010-08-10T20:18:14.753+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="Audit" /><category scheme="http://www.blogger.com/atom/ns#" term="Streaming Demo" /><title type="text">SharePoint Audit Suite recorded Webinar now available for live streaming</title><content type="html">&lt;p&gt;We carried out a live webinar the other day to talk about and demonstrate our &lt;a href="http://www.muhimbi.com/Products/SharePoint-Audit/summary.aspx"&gt;SharePoint Audit Suite&lt;/a&gt;. Based on the feedback, and the number of attendees, it was a great success. A similar presentation about our popular PDF Converter for SharePoint &lt;a href="http://blog.muhimbi.com/2010/08/pdf-converter-for-sharepoint-recorded.html"&gt;is available as well&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Fortunately for those who did not attend, we recorded the whole event, which is now available for real-time streaming. It is worth watching as it contains a lot of information, including some details about our upcoming ‘2.0’ version.&amp;#160; &lt;br /&gt;&amp;#160;&lt;/p&gt; &lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_bUq2JqpCltk/TGGRvjltbkI/AAAAAAAAACM/DdG2PdS4O5k/image%5B6%5D.png?imgmax=800" width="404" height="305" /&gt;   &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.muhimbi.com/media/2010-08-05%2014.05%20SharePoint%20Audit.wmv"&gt;Download / stream the presentation in WMV format&lt;/a&gt;. The slides are also &lt;a href="http://www.muhimbi.com/media/Muhimbi%20SharePoint%20Audit%20Presentation.pdf"&gt;available in PDF format&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Enjoy watching it. As always, if you have any questioned then don’t hesitate to &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us&lt;/a&gt;. We are very helpful and answer any questions as quickly as we can.&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-3520355809367749104?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/3520355809367749104/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/sharepoint-audit-suite-recorded-webinar.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/3520355809367749104" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/3520355809367749104" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/sharepoint-audit-suite-recorded-webinar.html" title="SharePoint Audit Suite recorded Webinar now available for live streaming" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-2618714767015850038</id><published>2010-08-09T17:50:00.001+01:00</published><updated>2010-08-09T17:52:44.337+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="Infuser" /><title type="text">Maintenance release for SharePoint Infuser 1.0.1.2</title><content type="html">&lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 5px 0px 5px 5px; display: inline; float: right; border-top: 0px; border-right: 0px" title="Syringe" border="0" alt="Syringe" align="right" src="http://lh3.ggpht.com/_bUq2JqpCltk/TGAxylWwhQI/AAAAAAAAACA/69qIjFXu1tE/Syringe%5B9%5D.jpg?imgmax=800" width="91" height="113" /&gt; Just a quick note to announce the availability of a maintenance release of the free &lt;a href="http://www.muhimbi.com/Products/SharePoint-Infuser-(Free).aspx"&gt;Muhimbi SharePoint Infuser&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Nothing too exciting, just a bug fix that affects solutions where a user may have access to a sub site without having access to the root site. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.muhimbi.com/Products/SharePoint-Infuser-(Free).aspx"&gt;Download it here&lt;/a&gt;, check out &lt;a href="http://blog.muhimbi.com/search/label/Infuser"&gt;examples here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Shortest Muhimbi Blog post Ever!&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-2618714767015850038?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/2618714767015850038/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/maintenance-release-for-sharepoint.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/2618714767015850038" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/2618714767015850038" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/maintenance-release-for-sharepoint.html" title="Maintenance release for SharePoint Infuser 1.0.1.2" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-865851628420170425</id><published>2010-08-04T11:20:00.001+01:00</published><updated>2010-08-11T08:21:29.395+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="WPP" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="InfoPath" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Streaming Demo" /><title type="text">PDF Converter for SharePoint recorded Webinar now available for live streaming</title><content type="html">&lt;p&gt;Yesterday we carried out a live webinar to talk about and demonstrate our popular &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;PDF Converter for SharePoint&lt;/a&gt;. Based on the feedback, and the number of attendees that stayed on till the very last minute, it was a great success. &lt;/p&gt;  &lt;p&gt;Fortunately for those who did not attend, we recorded the whole event, which is now available for real-time streaming. It is worth watching as it contains lots and lots of demos including PDF Conversion using Web Services, use in combination with SharePoint Designer workflows, conversions using InfoPath, Watermarking, use in combination with the &lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint/summary.aspx"&gt;Workflow Power Pack&lt;/a&gt; etc etc.     &lt;br /&gt;&amp;#160;&lt;/p&gt; &lt;a href="http://www.muhimbi.com/media/2010-08-03%2014.05%20SharePoint%20PDF%20Converter.wmv"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="PDF-Converter-Webinar" border="0" alt="PDF-Converter-Webinar" src="http://lh5.ggpht.com/_bUq2JqpCltk/TFk--_FkSFI/AAAAAAAAABU/xsCQXbNdlp0/PDF-Converter-Webinar%5B10%5D.jpg?imgmax=800" width="402" height="302" /&gt;&lt;/a&gt;   &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.muhimbi.com/media/2010-08-03%2014.05%20SharePoint%20PDF%20Converter.wmv"&gt;Download / stream the presentation in WMV format&lt;/a&gt;. The presentation is available on this &lt;a href="https://www1.gotomeeting.com/register/821033816"&gt;secondary (streaming only) link&lt;/a&gt; as well. The slides are also &lt;a href="http://www.muhimbi.com/media/PDF%20Converter%20for%20SharePoint%20Presentation.pdf"&gt;available in PDF format&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Some of the demos featured in the presentation are also available as separate blog posts:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/04/using-pdf-converter-from-sharepoint.html"&gt;Using the PDF Converter from a SharePoint workflow&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/09/inserting-sharepoint-list-data-into-pdf.html"&gt;Inserting SharePoint List data into a PDF document using a workflow&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/01/adding-watermark-to-pdf-file-from.html"&gt;Adding a watermark to a PDF file from a SharePoint Workflow&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/12/converting-office-files-to-pdf-format.html"&gt;Converting Office files to PDF Format using a Web Services based interface&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2009/12/batch-print-infopath-forms-using-pdf.html"&gt;Batch print InfoPath Forms using the PDF Converter for SharePoint&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;Enjoy watching it. As always, if you have any questioned then don’t hesitate to &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us&lt;/a&gt;. We are very helpful and answer any questions as quickly as we can.&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-865851628420170425?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/865851628420170425/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/08/pdf-converter-for-sharepoint-recorded.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/865851628420170425" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/865851628420170425" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/08/pdf-converter-for-sharepoint-recorded.html" title="PDF Converter for SharePoint recorded Webinar now available for live streaming" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-7348869963345936458</id><published>2010-06-28T10:23:00.003+01:00</published><updated>2010-06-28T11:26:41.716+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><title type="text">PDF Converter Services 3.5 – Adds watermarking and pluggable converters</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="PDFConverterServicesBox" border="0" alt="PDFConverterServicesBox" align="right" src="http://lh5.ggpht.com/_IgJp5HQ80aU/TChpE3elkfI/AAAAAAAAATA/jTYgZplmCsQ/PDFConverterServicesBox5.jpg?imgmax=800" width="200" height="183" /&gt; &lt;/p&gt;  &lt;p&gt;It is that time of the month again where we release new versions of our server based PDF Conversion products. Today’s release of the &lt;em&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;Muhimbi PDF Converter Services&lt;/a&gt;&lt;/em&gt; adds native support for the much requested Watermarking functionality as well as the ability to add custom converters using a new plug-in architecture. &lt;/p&gt;  &lt;p&gt;A quick introduction for those not familiar with the product: &lt;em&gt;The Muhimbi PDF Converter Services is a server based SDK that allows software developers to convert typical Office files to PDF format using a robust, scalable but friendly Web Services interface from Java and .NET based solutions. It supports a large number of file types including MS-Office and ODF file formats and is used by some of the largest organisations in the world for mission critical document conversions. A separate &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;SharePoint specific version&lt;/a&gt; is available as well.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;For details about the new functionality as well as a breaking change see the following posts:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/06/adding-custom-converters-to-muhimbis.html"&gt;Adding custom Converters to Muhimbi’s range of PDF Conversion products&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/06/using-awesome-new-watermarking-features.html"&gt;Using the awesome new watermarking features of the Muhimbi PDF Converter Services&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/06/using-pdf-watermarking-features-from.html"&gt;Using the PDF Watermarking features from Java based environments&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/06/breaking-changes-in-pdf-converter-35.html"&gt;Breaking changes in the PDF Converter 3.5 Web Services interface&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p align="center"&gt;&lt;em&gt;&lt;font size="1"&gt;&lt;a href="http://lh6.ggpht.com/_IgJp5HQ80aU/TChpFeb0QbI/AAAAAAAAATE/OkUI4TMYpMg/s1600-h/ClassDiagramWatermarking5.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="ClassDiagram-Watermarking" border="0" alt="ClassDiagram-Watermarking" src="http://lh4.ggpht.com/_IgJp5HQ80aU/TChpGNj7JWI/AAAAAAAAATI/ht0kr5a1T10/ClassDiagramWatermarking_thumb3.png?imgmax=800" width="644" height="427" /&gt;&lt;/a&gt;New Web Services classes related to watermarking. Click to enlarge&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;The main changes in version 3.5 are as follows:&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="700"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="31"&gt;&lt;font size="2"&gt;865&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="667"&gt;&lt;font size="2"&gt;New – Add support for watermarks, headers &amp;amp; footers using the Web Services interface.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;837&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;New – Add support for custom converters using a plug-in architecture.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;878&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Improved – Allow server side Exception details to be (optionally) passed to WS Clients .&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;883&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Improved – Include watermarking in the Java based sample code.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;874&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Improved – Include watermarking in the .NET based sample code.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;876&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Improved – Update documentation with details about watermarking and custom converters.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;For more information check out the following resources:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services.aspx"&gt;Product Page&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/Images---Files/PDFConverterServices/PDF-Converter-Services-Brochure.aspx"&gt;Brochure&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/Release-Notes.aspx"&gt;Release Notes&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/Administration-Guide.aspx"&gt;Administration Guide&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/User---Developer-Guide.aspx"&gt;User &amp;amp; Developer Guide&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/faqs.aspx"&gt;FAQ&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/forum.aspx?ForumID=7"&gt;Discussion Forum&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/search/label/PDF%20Converter%20Services"&gt;All PDF Converter Services related Blog postings&lt;/a&gt;. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;As always, feel free to &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us using Twitter, our Blog, regular email&lt;/a&gt; or &lt;a href="http://eepurl.com/b6A7"&gt;subscribe to our newsletter&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/Free-Trial.aspx"&gt;Download your free trial here&lt;/a&gt; (5MB). &lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-7348869963345936458?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/7348869963345936458/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/06/pdf-converter-services-35-adds.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/7348869963345936458" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/7348869963345936458" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/06/pdf-converter-services-35-adds.html" title="PDF Converter Services 3.5 – Adds watermarking and pluggable converters" /><author><name>Muhimbi</name><uri>http://www.blogger.com/profile/00157302110307291964</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="03078084175490311146" /></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-495889469284425423</id><published>2010-06-15T17:23:00.001+01:00</published><updated>2010-06-15T17:24:35.598+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Breaking changes in the PDF Converter 3.5 Web Services interface</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Oh no, we broke something" border="0" alt="Oh no! We broke something" align="right" src="http://lh4.ggpht.com/_IgJp5HQ80aU/TBepCMIACSI/AAAAAAAAAQI/T4W5XJzTMYg/Broken-Egg%5B5%5D.jpg?imgmax=800" width="140" height="98" /&gt;In preparation of the upcoming 3.5 release of the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;Muhimbi PDF Converter Services&lt;/a&gt; we are making sure that all required documentation is readily available on our website (See previous posts on &lt;a href="http://blog.muhimbi.com/2010/06/using-awesome-new-watermarking-features.html"&gt;watermarking&lt;/a&gt; and &lt;a href="http://blog.muhimbi.com/2010/06/adding-custom-converters-to-muhimbis.html"&gt;custom converters&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;Unfortunately, today I am documenting something I had hoped I would never need to document, a breaking change in our Web Services interface that may require our existing customers to refresh their web service proxies. Fortunately the change is isolated to a little used configuration interface, the main &lt;em&gt;Convert&lt;/em&gt; method will continue to work fine….. pfew.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Our range of PDF Conversion products all share the same core engine, which runs as a Windows Service and can be accessed via an industry standard Web Services interface. However, this core engine originally started out as part of a &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;SharePoint based product&lt;/a&gt; with a fixed number of hardcoded converters. The SharePoint user interface retrieves the list of converters via the &lt;em&gt;GetConfiguration&lt;/em&gt; Web Service call and locally stores some settings against each converter. The same user interface uses the &lt;em&gt;GetDiagnostics&lt;/em&gt; method on one or more converters to see if everything has been installed and configured correctly.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh5.ggpht.com/_IgJp5HQ80aU/TBepCcbwIZI/AAAAAAAAAQM/RhDl9XRitR8/s1600-h/ClassDiagram-Configuration%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="ClassDiagram-Configuration" border="0" alt="ClassDiagram-Configuration" src="http://lh5.ggpht.com/_IgJp5HQ80aU/TBepC3seEgI/AAAAAAAAAQQ/O6Ee15wQbuc/ClassDiagram-Configuration_thumb%5B3%5D.png?imgmax=800" width="644" height="427" /&gt;&lt;/a&gt;&lt;em&gt;Configuration / Diagnostics related classes&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The change&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Both the &lt;em&gt;GetConfiguration&lt;/em&gt; and &lt;em&gt;GetDiagnostics&lt;/em&gt; methods return objects that used to contain a &lt;em&gt;ConverterType&lt;/em&gt; property, which holds an element of the following enumeration:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; private enum ConverterType        &lt;br /&gt;&lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;{         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;WordProcessing,         &lt;br /&gt;&lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&amp;#160;&amp;#160;&amp;#160; SpreadSheets,         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;Presentations,         &lt;br /&gt;&lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&amp;#160;&amp;#160;&amp;#160; InfoPath,         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;Vector,         &lt;br /&gt;&lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&amp;#160;&amp;#160;&amp;#160; OneNote,         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;MicrosoftPublisher,         &lt;br /&gt;&lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&amp;#160;&amp;#160;&amp;#160; HTML         &lt;br /&gt;&lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;} &lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;As it is now possible to &lt;a href="http://blog.muhimbi.com/2010/06/adding-custom-converters-to-muhimbis.html"&gt;add custom converters to the conversion engine&lt;/a&gt;, we can no longer rely on a fixed list of converters. As a result we have dropped the &lt;em&gt;ConverterType&lt;/em&gt; property in favour of the new &lt;em&gt;ConverterName&lt;/em&gt; property, which&amp;#160; holds a string that identifies the converter. This identifier is identical to the &lt;em&gt;key&lt;/em&gt; field used by the config file to describe the converter.&lt;/p&gt;  &lt;p&gt;In addition to this change we have also dropped the &lt;em&gt;ConversionFidelity&lt;/em&gt; property from the &lt;em&gt;DiagnosticRequestItem&lt;/em&gt;. This value is now read from the config file for the specified &lt;em&gt;ConverterName&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;We are fairly confident that very few people are using these specific interfaces. However, if you are and you need further information or assistance then please &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;let us know&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-495889469284425423?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/495889469284425423/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/06/breaking-changes-in-pdf-converter-35.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/495889469284425423" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/495889469284425423" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/06/breaking-changes-in-pdf-converter-35.html" title="Breaking changes in the PDF Converter 3.5 Web Services interface" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-6249629591425726113</id><published>2010-06-11T11:20:00.001+01:00</published><updated>2010-06-11T11:25:48.657+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Using the PDF Watermarking features from Java based environments</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Java-Logo" border="0" alt="Java-Logo" align="right" src="http://lh3.ggpht.com/_IgJp5HQ80aU/TBIN-xUJclI/AAAAAAAAAP8/ERrmXcMmTOw/Java-Logo%5B6%5D.jpg?imgmax=800" width="58" height="108" /&gt; As an ever increasing number of customers are using our &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;PDF Conversion Services&lt;/a&gt; from Java based environments we have decided to make our sample code and tutorials available in Java in addition to C# / .NET. Have a look at &lt;a href="http://blog.muhimbi.com/2010/04/convert-office-files-to-pdf-format-from.html"&gt;this post&lt;/a&gt; for an introduction to using the PDF Conversion Web Services from Java based environments.&lt;/p&gt;  &lt;p&gt;The C# / .net version of this post ‘&lt;a href="http://blog.muhimbi.com/2010/06/using-awesome-new-watermarking-features.html"&gt;Using the awesome new watermarking features of the Muhimbi PDF Converter Services&lt;/a&gt;’ provides a good introduction to the watermarking capabilities of our PDF Conversion products. I recommend reading it, even if you know nothing about C#, as the fundamental principles and object model are exactly the same. &lt;/p&gt;  &lt;div align="center"&gt;   &lt;hr style="width: 200px" /&gt;&lt;/div&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;The Muhimbi Document Conversion Service contains a very flexible system for applying watermarks to documents. Multiple watermarks can be applied to the same page and watermarks can be applied to page ranges or certain page types such as &lt;em&gt;odd&lt;/em&gt;,&lt;em&gt;even&lt;/em&gt;, &lt;em&gt;portrait&lt;/em&gt; or &lt;em&gt;landscape&lt;/em&gt;. In addition you can add field codes such as {PAGE} and {NUMPAGES} to dynamically add page numbers, headers and footers to PDF documents.&lt;/p&gt;  &lt;p&gt;Watermarks are passed as part of the &lt;em&gt;ConversionSettings&lt;/em&gt; object, a parameter of the &lt;em&gt;Convert&lt;/em&gt; method. An overview of the watermarking related Web Services interface is provided below. For full details see the full &lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/User---Developer-Guide.aspx"&gt;User &amp;amp; Developer Guide&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_IgJp5HQ80aU/TBIN_sD3plI/AAAAAAAAAQA/2opyvwKWAOs/s1600-h/ClassDiagram-Watermarking%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="ClassDiagram-Watermarking" border="0" alt="ClassDiagram-Watermarking" src="http://lh5.ggpht.com/_IgJp5HQ80aU/TBIOAUbhe-I/AAAAAAAAAQE/ALoaBO6W1P4/ClassDiagram-Watermarking_thumb%5B3%5D.png?imgmax=800" width="644" height="427" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The following Java based sample code is identical to a &lt;a href="http://blog.muhimbi.com/2010/04/convert-office-files-to-pdf-format-from.html"&gt;previous sample&lt;/a&gt;, with the exception that the &lt;em&gt;Watermarks&lt;/em&gt; property in the &lt;em&gt;ConversionSettings&lt;/em&gt; class is populated with a simple watermark that prints the word ‘Confidential’ on the front page in combination with the current date. Note that this sample code is automatically installed with the conversion service.&lt;/p&gt;  &lt;p&gt;For details on how to setup your Java environment and generate the Web Service proxies see &lt;a href="http://blog.muhimbi.com/2010/04/convert-office-files-to-pdf-format-from.html"&gt;this post&lt;/a&gt;.    &lt;br /&gt;&amp;#160;&lt;/p&gt; &lt;style type="text/css"&gt;


	code { font-family: consolas, courier new, courier; font-size: 8pt; margin: 0px; }&lt;/style&gt;&lt;meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" /&gt;  &lt;div class="java" align="left"&gt;   &lt;table border="0" cellspacing="0" cellpadding="3" bgcolor="#ffffff"&gt;&lt;tbody&gt;       &lt;tr&gt;&lt;!-- start source code --&gt;         &lt;td valign="top" nowrap="nowrap" align="left"&gt;&lt;code&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;package &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;com.muhimbi.app;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;com.muhimbi.ws.*;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;java.io.*;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;java.net.URL;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;java.util.List;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;javax.xml.bind.JAXBElement;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;javax.xml.namespace.QName;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public class &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;WsClient &lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;private final static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;String DOCUMENTCONVERTERSERVICE_WSDL_LOCATION = &lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;http://localhost:41734/Muhimbi.DocumentConverter.WebService/?wsdl&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;void &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;main&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;String&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;args&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;try &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;if &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;args.length != &lt;/font&gt;&lt;font color="#990000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out&lt;/font&gt;&lt;font color="#000000"&gt;.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Please specify a single file name on the command line.&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&amp;#160; &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;} &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;else &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Process command line parameters&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String sourceDocumentPath = args&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#990000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;File file = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;File&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;sourceDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String fileName = getFileName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String fileExt = getFileExtension&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Converting file &amp;quot; &lt;/font&gt;&lt;font color="#000000"&gt;+ sourceDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Initialise Web Service&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterService_Service dcss = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterService_Service&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;URL&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;DOCUMENTCONVERTERSERVICE_WSDL_LOCATION&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;, &lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;QName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;http://tempuri.org/&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;, &lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;DocumentConverterService&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterService dcs = dcss.getBasicHttpBindingDocumentConverterService&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Only call conversion if file extension is supported&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;if &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;isFileExtensionSupported&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileExt, dcs&lt;/font&gt;&lt;font color="#000000"&gt;)) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Read source file from disk&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;fileContent = readFile&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;sourceDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Converting the file&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;OpenOptions openOptions = getOpenOptions&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileName, fileExt&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ConversionSettings conversionSettings = getConversionSettings&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;convertedFile = dcs.convert&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileContent, openOptions, conversionSettings&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Writing converted file to file system&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String destinationDocumentPath = getPDFDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;writeFile&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;convertedFile, destinationDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;File converted sucessfully to &amp;quot; &lt;/font&gt;&lt;font color="#000000"&gt;+ destinationDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;} &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;else &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;The file extension is not supported.&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;} &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;catch &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;IOException e&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;e.getMessage&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;} &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;catch &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterServiceGetConfigurationWebServiceFaultExceptionFaultFaultMessage e&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;printException&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;e.getFaultInfo&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;} &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;catch &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterServiceConvertWebServiceFaultExceptionFaultFaultMessage e&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;printException&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;e.getFaultInfo&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;OpenOptions getOpenOptions&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;String fileName, String fileExtension&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ObjectFactory objectFactory = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ObjectFactory&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;OpenOptions openOptions = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;OpenOptions&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Set the minimum required open options. Additional options are available&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;openOptions.setOriginalFileName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createOpenOptionsOriginalFileName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileName&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;openOptions.setFileExtension&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createOpenOptionsFileExtension&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileExtension&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;openOptions;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ConversionSettings getConversionSettings&lt;/font&gt;&lt;font color="#000000"&gt;() {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ConversionSettings conversionSettings = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ConversionSettings&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Set the minimum required conversion settings. Additional settings are available&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings.setQuality&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ConversionQuality.OPTIMIZE_FOR_PRINT&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings.setRange&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ConversionRange.ALL_DOCUMENTS&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings.getFidelity&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;.add&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Full&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings.setFormat&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;OutputFormat.PDF&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings.setWatermarks&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;getWatermarks&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;JAXBElement&amp;lt;ArrayOfWatermark&amp;gt; getWatermarks&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ObjectFactory objectFactory = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ObjectFactory&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ArrayOfWatermark watermarks = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ArrayOfWatermark&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Specify some of the default settings for properties&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;Defaults wmDefaults = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;Defaults&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;wmDefaults.setFillColor&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createDefaultsFillColor&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;#FF0000&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;wmDefaults.setFontFamilyName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createDefaultsFontFamilyName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Arial&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** 'Confidential' watermark for front page&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;Watermark confidential = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;Watermark&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setDefaults&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createContainerDefaults&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;wmDefaults&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setStartPage&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setEndPage&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setRotation&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createElementRotation&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;-15&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setWidth&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createElementWidth&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;500&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setHeight&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createElementHeight&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;250&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setHPosition&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;HPosition.CENTER&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setVPosition&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;VPosition.ABSOLUTE&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setY&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createElementY&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;275&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setZOrder&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;-&lt;/font&gt;&lt;font color="#990000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Create a new Text element that goes inside the watermark&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;Text cfText = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;Text&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;cfText.setContent&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createTextContent&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Confidential - {DATE}&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;cfText.setFontSize&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createTextFontSize&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;40&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;cfText.getFontStyle&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;.add&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Bold&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;cfText.getFontStyle&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;.add&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Italic&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;cfText.setWidth&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createElementWidth&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;500&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;cfText.setHeight&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createElementHeight&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;250&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;cfText.setTransparency&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createElementTransparency&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;0.10&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** And add it to the list of watermark elements.&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ArrayOfElement cfElements = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ArrayOfElement&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;cfElements.getElement&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;.add&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;cfText&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;confidential.setElements&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createContainerElements&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;cfElements&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** And add the watermark to the list of watermarks&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;watermarks.getWatermark&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;.add&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;confidential&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createConversionSettingsWatermarks&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;watermarks&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;String getFileName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;File file&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String fileName = file.getName&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;fileName.substring&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;, fileName.lastIndexOf&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;'.'&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;String getFileExtension&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;File file&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String fileName = file.getName&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;fileName.substring&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileName.lastIndexOf&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;'.'&lt;/font&gt;&lt;font color="#000000"&gt;) &lt;/font&gt;&lt;font color="#000000"&gt;+ &lt;/font&gt;&lt;font color="#990000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;, fileName.length&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;String getPDFDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;File file&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String fileName = getFileName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String folder = file.getParent&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;if &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;folder == &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;folder = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;File&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file.getAbsolutePath&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;.getParent&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;folder + File.separatorChar + fileName + &lt;/font&gt;&lt;font color="#990000"&gt;'.'&lt;/font&gt;&amp;#160;&lt;font color="#000000"&gt;+ OutputFormat.PDF.value&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;readFile&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;String filepath&lt;/font&gt;&lt;font color="#000000"&gt;) &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;throws &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;IOException &lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;File file = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;File&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;filepath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;InputStream is = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;FileInputStream&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;long &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;length = file.length&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;bytes = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[(&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;) &lt;/font&gt;&lt;font color="#000000"&gt;length&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;int &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;offset = &lt;/font&gt;&lt;font color="#990000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;int &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;numRead;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;while &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;offset &amp;lt; bytes.length&lt;/font&gt;&amp;#160;&lt;font color="#000000"&gt;&amp;amp;&amp;amp; &lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;numRead = is.read&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;bytes, offset, bytes.length - offset&lt;/font&gt;&lt;font color="#000000"&gt;)) &lt;/font&gt;&lt;font color="#000000"&gt;&amp;gt;= &lt;/font&gt;&lt;font color="#990000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;offset += numRead;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;if &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;offset &amp;lt; bytes.length&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;throw new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;IOException&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Could not completely read file &amp;quot; &lt;/font&gt;&lt;font color="#000000"&gt;+ file.getName&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;is.close&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;bytes;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;void &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;writeFile&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;fileContent, String filepath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&amp;#160;&lt;font color="#7f0055"&gt;&lt;b&gt;throws &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;IOException &lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;OutputStream os = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;FileOutputStream&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;filepath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;os.write&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileContent&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;os.close&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;boolean &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;isFileExtensionSupported&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;String extension, DocumentConverterService dcs&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;throws &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterServiceGetConfigurationWebServiceFaultExceptionFaultFaultMessage &lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;Configuration configuration = dcs.getConfiguration&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;final &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;JAXBElement&amp;lt;ArrayOfConverterConfiguration&amp;gt; converters = configuration.getConverters&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;final &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ArrayOfConverterConfiguration ofConverterConfiguration = converters.getValue&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;final &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;List&amp;lt;ConverterConfiguration&amp;gt; cList = ofConverterConfiguration.getConverterConfiguration&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;for &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ConverterConfiguration cc : cList&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;final &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;List&amp;lt;String&amp;gt; supportedExtension = cc.getSupportedFileExtensions&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;.getValue&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;.getString&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;if &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;supportedExtension.contains&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;extension&lt;/font&gt;&lt;font color="#000000"&gt;)) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return true&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;void &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;printException&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;WebServiceFaultException serviceFaultException&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;serviceFaultException.getExceptionType&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;JAXBElement&amp;lt;ArrayOfstring&amp;gt; element = serviceFaultException.getExceptionDetails&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ArrayOfstring value = element.getValue&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;for &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;String msg : value.getString&lt;/font&gt;&lt;font color="#000000"&gt;()) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;msg&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt; &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-6249629591425726113?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/6249629591425726113/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/06/using-pdf-watermarking-features-from.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/6249629591425726113" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/6249629591425726113" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/06/using-pdf-watermarking-features-from.html" title="Using the PDF Watermarking features from Java based environments" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-740385864845707853</id><published>2010-06-09T14:54:00.001+01:00</published><updated>2010-06-11T11:36:23.164+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Using the awesome new watermarking features of the Muhimbi PDF Converter Services</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="confidential" border="0" alt="confidential" align="right" src="http://lh4.ggpht.com/_IgJp5HQ80aU/TA-dIFNIvRI/AAAAAAAAAPc/XB8K1k1FwFI/confidential%5B5%5D.jpg?imgmax=800" width="140" height="150" /&gt; As I mentioned in a previous post about &lt;a href="http://blog.muhimbi.com/2010/06/adding-custom-converters-to-muhimbis.html"&gt;adding your own converters using our fancy new plug-in architecture&lt;/a&gt;, we prioritise new functionality based on the number of customers requesting a particular feature. The feature I will be discussing today is one that has been on our radar for a long time, &lt;em&gt;Watermarking&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;We have previously provided some &lt;a href="http://blog.muhimbi.com/2010/01/adding-watermark-to-pdf-file-from.html"&gt;sample code to watermark documents using our Workflow Power Pack&lt;/a&gt; and although that solution is working well for many of our customers, it was only an interim solution that doesn’t come close to providing the functionality in our new watermarking engine, which is totally awesome&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Note that at this moment we have only added native support for watermarking to the back-end conversion engine. Although it can be accessed using the Workflow Power Pack, we have not yet released a dedicated Workflow Action to control watermarking from SharePoint, which will be released in the next version.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Right, so back to the topic at hand. Listed below is an overview of our new Watermarking architecture as well as some sample code. More information and a full description of the object model can be found in the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;PDF Converter Services&lt;/a&gt;’ comprehensive &lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/User---Developer-Guide.aspx"&gt;User &amp;amp; Developer Guide&lt;/a&gt;. Note that you need version 3.5 or newer to make use of the new watermarking functionality.     &lt;br /&gt;&amp;#160; &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div align="center"&gt;   &lt;hr style="width: 200px" /&gt;&lt;/div&gt;  &lt;div align="center"&gt;&amp;#160;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The Muhimbi Document Conversion Service contains a very flexible system for applying watermarks to documents. Multiple watermarks can be applied to the same page and watermarks can be applied to page ranges or certain page types such as &lt;em&gt;odd&lt;/em&gt;, &lt;em&gt;even&lt;/em&gt;, &lt;em&gt;portrait&lt;/em&gt; or &lt;em&gt;landscape&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;Watermarks are passed as part of the &lt;em&gt;ConversionSettings&lt;/em&gt; object, a parameter of the &lt;em&gt;Convert&lt;/em&gt; method. An overview of the watermarking related Web Services interface is provided below. For full details see the full &lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/User---Developer-Guide.aspx"&gt;User &amp;amp; Developer Guide&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_IgJp5HQ80aU/TA-dJCXccGI/AAAAAAAAAPs/jZEuZKG65Vc/s1600-h/ClassDiagram-Watermarking%5B7%5D.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="ClassDiagram-Watermarking" border="0" alt="ClassDiagram-Watermarking" src="http://lh4.ggpht.com/_IgJp5HQ80aU/TA-dJtpOJYI/AAAAAAAAAPw/kUPhDGrlrJM/ClassDiagram-Watermarking_thumb%5B5%5D.png?imgmax=800" width="644" height="427" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Individual Element Types&lt;/strong&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;As all individual elements / shapes inherit from the &lt;em&gt;Element&lt;/em&gt; class, they largely share the same properties. &lt;/p&gt;  &lt;p&gt;The supported element types are as follows.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Line:&lt;/strong&gt; Represents a single line.&amp;#160; &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Rectangle:&lt;/strong&gt; Represents a rectangle..       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Ellipse:&lt;/strong&gt; Represents an ellipse.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Rtf:&lt;/strong&gt; Represents a piece of text encoded in RTF format.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Image:&lt;/strong&gt; Represents an image. The following image types are supported: BMP, JPG, GIF, PNG, TIFF, WMF, EMF and EMF+.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Pdf:&lt;/strong&gt; Represents an existing PDF file that is used as the watermark.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Text:&lt;/strong&gt; Represents a text box that allows plain text to be specified with full control over horizontal and vertical alignment, font face and size as well as word wrapping. This field also allows field codes such as page number to be embedded (see below). &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Embedding field codes in the Text element&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The Text element allows field codes to be embedded such as the &lt;em&gt;number of pages&lt;/em&gt; or the &lt;em&gt;current date&lt;/em&gt;. This makes it very simple to use watermarks to automatically generate headers and footers on each page, while taking orientation and page interval (Odd / Even pages) into account.&lt;/p&gt;  &lt;p&gt;The following field codes are available for use: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;{LONG_DATE}:&lt;/strong&gt; The long representation of the current date. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;{LONG_TIME}:&lt;/strong&gt; The long representation of the current time. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;{DATE}:&lt;/strong&gt; The short representation of the current date. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;{TIME}:&lt;/strong&gt; The short representation of the current time. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;{PAGE}:&lt;/strong&gt; The number of the current page in the PDF file. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;{NUMPAGES}:&lt;/strong&gt; The total number of pages in the PDF file. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Date and time fields are formatted using the locale used by the account the &lt;em&gt;Document Conversion Service&lt;/em&gt; is running under. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Sample Code&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;As described previously, the PDF Conversion Service contains a powerful watermarking engine that can be used to add visible and invisible watermarks to pages as well as adding headers, footers and other recurring items. &lt;/p&gt;  &lt;p&gt;The following C# example (&lt;a href="http://blog.muhimbi.com/2010/06/using-pdf-watermarking-features-from.html"&gt;Java sample available here&lt;/a&gt;) shows how to decorate a document with the following watermarks: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Add the word ‘Confidential’ in the background of the cover page. &lt;/li&gt;    &lt;li&gt;Add page numbers in the right-hand side of the footer as well as a horizontal line to all even pages. &lt;/li&gt;    &lt;li&gt;Add page numbers in the left-hand side of the footer as well as a horizontal line to all odd pages. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Watermarking" border="0" alt="Watermarking" src="http://lh5.ggpht.com/_IgJp5HQ80aU/TA-dKFulPlI/AAAAAAAAAPo/yzC4T41uBzQ/Watermarking%5B5%5D.png?imgmax=800" width="644" height="282" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The sample code expects the path of the PDF file on the command line. If the path is omitted then the first MS-Word file found in the current directory will be used. &lt;/p&gt;  &lt;p&gt;Follow the steps described below to create the sample watermarking application. Please note that this sample code is also available via the Windows Start Menu.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Create a new Visual Studio C# Console application named &lt;em&gt;Watermarking&lt;/em&gt;.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Add a Service Reference to the following URL and specify &lt;em&gt;ConversionService&lt;/em&gt; as the namespace       &lt;br /&gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; http://localhost:41734/Muhimbi.DocumentConverter.WebService/?wsdl       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Paste the following code into &lt;em&gt;Program.cs&lt;/em&gt;.&amp;#160; &lt;br /&gt;&amp;#160; &lt;div style="padding-bottom: 4px; padding-left: 4px; padding-right: 4px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 4px"&gt;       &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; System.Diagnostics;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; System.IO;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; System.ServiceModel;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; Watermarking.ConversionService;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;namespace&lt;/span&gt; Watermarking&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;class&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Program&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** The URL where the Web Service is located. Amend host name if needed.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;static&lt;/span&gt; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt; SERVICE_URL = &lt;span style="color: #a5c25c"&gt;&amp;quot;http://localhost:41734/Muhimbi.DocumentConverter.WebService/&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;static&lt;/span&gt; &lt;span style="color: #cc7832"&gt;void&lt;/span&gt; Main(&lt;span style="color: #cc7832"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;DocumentConverterServiceClient&lt;/span&gt; client = &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;try&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Determine the source file and read it into a byte array.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt; sourceFileName = &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (args.Length == &lt;span style="color: #6897bb"&gt;0&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt;[] sourceFiles = &lt;span style="color: #ffc66d"&gt;Directory&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.GetFiles(&lt;br /&gt;                                                   &lt;/span&gt;&lt;span style="color: #ffc66d"&gt;Directory&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.GetCurrentDirectory(), &lt;/span&gt;&lt;span style="color: #a5c25c"&gt;&amp;quot;*.doc&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (sourceFiles.Length &amp;gt; &lt;span style="color: #6897bb"&gt;0&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sourceFileName = sourceFiles[&lt;span style="color: #6897bb"&gt;0&lt;/span&gt;];&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Console&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.WriteLine(&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;&amp;quot;Please specify a document to convert and watermark.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Console&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.ReadKey();&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;return&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sourceFileName = args[&lt;span style="color: #6897bb"&gt;0&lt;/span&gt;];&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;byte&lt;/span&gt;[] sourceFile = &lt;span style="color: #ffc66d"&gt;File&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.ReadAllBytes(sourceFileName);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Open the service and configure the bindings&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; client = OpenService(SERVICE_URL);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;//** Set the absolute minimum open options&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;OpenOptions&lt;/span&gt; openOptions = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;OpenOptions&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; openOptions.OriginalFileName = &lt;span style="color: #ffc66d"&gt;Path&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.GetFileName(sourceFileName);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; openOptions.FileExtension = &lt;span style="color: #ffc66d"&gt;Path&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.GetExtension(sourceFileName);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Set the absolute minimum conversion settings.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;ConversionSettings&lt;/span&gt; conversionSettings = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;ConversionSettings&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; conversionSettings.Fidelity = &lt;span style="color: #6897bb"&gt;ConversionFidelities&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Full;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; conversionSettings.Quality = &lt;span style="color: #6897bb"&gt;ConversionQuality&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.OptimizeForPrint;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Get the list of watermarks to apply.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; conversionSettings.Watermarks = CreateWatermarks();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Carry out the conversion.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Console&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.WriteLine(&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;&amp;quot;Converting file &amp;quot;&lt;/span&gt; + sourceFileName);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;byte&lt;/span&gt;[] convFile = client.Convert(sourceFile, openOptions, conversionSettings);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Write the converted file back to the file system with a PDF extension.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt; destinationFileName = &lt;span style="color: #ffc66d"&gt;Path&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.GetDirectoryName(sourceFileName) + &lt;/span&gt;&lt;span style="color: #eb6767; font-weight: normal"&gt;@&amp;quot;\&amp;quot;&lt;/span&gt; +&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Path&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.GetFileNameWithoutExtension(sourceFileName) +&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #a5c25c"&gt;&amp;quot;.&amp;quot;&lt;/span&gt; + conversionSettings.Format;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;using&lt;/span&gt; (&lt;span style="color: #ffc66d"&gt;FileStream&lt;/span&gt; fs = &lt;span style="color: #ffc66d"&gt;File&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Create(destinationFileName))&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; fs.Write(convFile, &lt;span style="color: #6897bb"&gt;0&lt;/span&gt;, convFile.Length);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; fs.Close();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Console&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.WriteLine(&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;&amp;quot;File converted to &amp;quot;&lt;/span&gt; + destinationFileName);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Open the generated PDF file in a PDF Reader&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Process&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Start(destinationFileName);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;catch&lt;/span&gt; (&lt;span style="color: #ffc66d"&gt;FaultException&lt;/span&gt;&lt;span style="font-weight: normal"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #ffc66d"&gt;WebServiceFaultException&lt;/span&gt;&lt;span style="font-weight: normal"&gt;&amp;gt; ex)&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Console&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.WriteLine(&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;&amp;quot;FaultException occurred: ExceptionType: &amp;quot;&lt;/span&gt; +&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ex.Detail.ExceptionType.ToString());&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;catch&lt;/span&gt; (&lt;span style="color: #ffc66d"&gt;Exception&lt;/span&gt; ex)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Console&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.WriteLine(ex.ToString());&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;finally&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CloseService(client);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Console&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.ReadKey();&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Create the watermarks.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;An array of watermarks to apply&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;public&lt;/span&gt; &lt;span style="color: #cc7832"&gt;static&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Watermark&lt;/span&gt;[] CreateWatermarks()&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;List&lt;/span&gt;&lt;span style="font-weight: normal"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #ffc66d"&gt;Watermark&lt;/span&gt;&lt;span style="font-weight: normal"&gt;&amp;gt; watermarks = &lt;/span&gt;&lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;List&lt;/span&gt;&lt;span style="font-weight: normal"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #ffc66d"&gt;Watermark&lt;/span&gt;&lt;span style="font-weight: normal"&gt;&amp;gt;();&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Specify the default settings for properties&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Defaults&lt;/span&gt; wmDefaults = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Defaults&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; wmDefaults.FillColor = &lt;span style="color: #a5c25c"&gt;&amp;quot;#000000&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; wmDefaults.LineColor = &lt;span style="color: #a5c25c"&gt;&amp;quot;#000000&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; wmDefaults.FontFamilyName = &lt;span style="color: #a5c25c"&gt;&amp;quot;Arial&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; wmDefaults.FontSize = &lt;span style="color: #a5c25c"&gt;&amp;quot;10&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// **************** 'Confidential' Text ***************&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** 'Confidential' watermark for front page&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Watermark&lt;/span&gt; confidential = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Watermark&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; confidential.Defaults = wmDefaults;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; confidential.StartPage = &lt;span style="color: #6897bb"&gt;1&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; confidential.EndPage = &lt;span style="color: #6897bb"&gt;1&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; confidential.Rotation = &lt;span style="color: #a5c25c"&gt;&amp;quot;-45&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; confidential.Width = &lt;span style="color: #a5c25c"&gt;&amp;quot;500&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; confidential.Height = &lt;span style="color: #a5c25c"&gt;&amp;quot;500&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; confidential.HPosition = &lt;span style="color: #6897bb"&gt;HPosition&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Center;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; confidential.VPosition = &lt;span style="color: #6897bb"&gt;VPosition&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Middle;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; confidential.ZOrder = -&lt;span style="color: #6897bb"&gt;1&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Create a new Text element that goes inside the watermark&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Text&lt;/span&gt; cfText = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Text&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cfText.Content = &lt;span style="color: #a5c25c"&gt;&amp;quot;Confidential&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cfText.FontSize = &lt;span style="color: #a5c25c"&gt;&amp;quot;40&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cfText.FontStyle = &lt;span style="color: #6897bb"&gt;FontStyle&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Bold | &lt;/span&gt;&lt;span style="color: #6897bb"&gt;FontStyle&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Italic;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cfText.Width = &lt;span style="color: #a5c25c"&gt;&amp;quot;500&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cfText.Height = &lt;span style="color: #a5c25c"&gt;&amp;quot;500&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cfText.Transparency = &lt;span style="color: #a5c25c"&gt;&amp;quot;0.10&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** And add it to the list of watermark elements.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; confidential.Elements = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Element&lt;/span&gt;[] { cfText };&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** And add the watermark to the list of watermarks&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; watermarks.Add(confidential);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// **************** Watermark for Odd pages ***************&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Watermark&lt;/span&gt; oddPages = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Watermark&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddPages.Defaults = wmDefaults;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddPages.StartPage = &lt;span style="color: #6897bb"&gt;3&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddPages.PageInterval = &lt;span style="color: #6897bb"&gt;2&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddPages.Width = &lt;span style="color: #a5c25c"&gt;&amp;quot;600&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddPages.Height = &lt;span style="color: #a5c25c"&gt;&amp;quot;50&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddPages.HPosition = &lt;span style="color: #6897bb"&gt;HPosition&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Right;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddPages.VPosition = &lt;span style="color: #6897bb"&gt;VPosition&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Bottom;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Add a horizontal line&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Line&lt;/span&gt; line = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Line&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; line.X = &lt;span style="color: #a5c25c"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; line.Y = &lt;span style="color: #a5c25c"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; line.EndX = &lt;span style="color: #a5c25c"&gt;&amp;quot;600&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; line.EndY = &lt;span style="color: #a5c25c"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; line.Width = &lt;span style="color: #a5c25c"&gt;&amp;quot;5&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Add a page counter&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Text&lt;/span&gt; oddText = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Text&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddText.Content = &lt;span style="color: #a5c25c"&gt;&amp;quot;Page: {PAGE} of {NUMPAGES}&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddText.Width = &lt;span style="color: #a5c25c"&gt;&amp;quot;100&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddText.Height = &lt;span style="color: #a5c25c"&gt;&amp;quot;20&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddText.X = &lt;span style="color: #a5c25c"&gt;&amp;quot;475&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddText.Y = &lt;span style="color: #a5c25c"&gt;&amp;quot;15&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddText.LineWidth = &lt;span style="color: #a5c25c"&gt;&amp;quot;-1&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddText.FontStyle = &lt;span style="color: #6897bb"&gt;FontStyle&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Regular;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddText.HAlign = &lt;span style="color: #6897bb"&gt;HAlign&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Right;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** And add it to the list of watermark elements&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; oddPages.Elements = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Element&lt;/span&gt;[] { line, oddText };&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** And add the watermark to the list of watermarks&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; watermarks.Add(oddPages);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// **************** Watermark for Even pages ***************&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Watermark&lt;/span&gt; evenPages = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Watermark&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenPages.Defaults = wmDefaults;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenPages.StartPage = &lt;span style="color: #6897bb"&gt;2&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenPages.PageInterval = &lt;span style="color: #6897bb"&gt;2&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenPages.Width = &lt;span style="color: #a5c25c"&gt;&amp;quot;600&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenPages.Height = &lt;span style="color: #a5c25c"&gt;&amp;quot;50&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenPages.HPosition = &lt;span style="color: #6897bb"&gt;HPosition&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Left;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenPages.VPosition = &lt;span style="color: #6897bb"&gt;VPosition&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Bottom;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** No need to create an additional line,re-use the previous one&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Add a page counter&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Text&lt;/span&gt; evenText = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Text&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenText.Content = &lt;span style="color: #a5c25c"&gt;&amp;quot;Page: {PAGE} of {NUMPAGES}&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenText.Width = &lt;span style="color: #a5c25c"&gt;&amp;quot;100&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenText.Height = &lt;span style="color: #a5c25c"&gt;&amp;quot;20&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenText.X = &lt;span style="color: #a5c25c"&gt;&amp;quot;25&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenText.Y = &lt;span style="color: #a5c25c"&gt;&amp;quot;15&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenText.LineWidth = &lt;span style="color: #a5c25c"&gt;&amp;quot;-1&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenText.FontStyle = &lt;span style="color: #6897bb"&gt;FontStyle&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Regular;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenText.HAlign = &lt;span style="color: #6897bb"&gt;HAlign&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Left;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** And add it to the list of watermark elements&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; evenPages.Elements = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Element&lt;/span&gt;[] { line, evenText };&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** And add the watermark to the list of watermarks&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; watermarks.Add(evenPages);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;return&lt;/span&gt; watermarks.ToArray();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Configure the Bindings, endpoints and open the service using the specified address.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;An instance of the Web Service.&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;public&lt;/span&gt; &lt;span style="color: #cc7832"&gt;static&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;DocumentConverterServiceClient&lt;/span&gt; OpenService(&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; address)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;DocumentConverterServiceClient&lt;/span&gt; client = &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;try&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;BasicHttpBinding&lt;/span&gt; binding = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;BasicHttpBinding&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Use standard Windows Security.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; binding.Security.Mode = &lt;span style="color: #6897bb"&gt;BasicHttpSecurityMode&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.TransportCredentialOnly;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; binding.Security.Transport.ClientCredentialType =&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #6897bb"&gt;HttpClientCredentialType&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Windows;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Increase the client Timeout to deal with (very) long running requests.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; binding.SendTimeout = &lt;span style="color: #6897bb"&gt;TimeSpan&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.FromMinutes(&lt;/span&gt;&lt;span style="color: #6897bb"&gt;30&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; binding.ReceiveTimeout = &lt;span style="color: #6897bb"&gt;TimeSpan&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.FromMinutes(&lt;/span&gt;&lt;span style="color: #6897bb"&gt;30&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Set the maximum document size to 50MB&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; binding.MaxReceivedMessageSize = &lt;span style="color: #6897bb"&gt;50&lt;/span&gt; * &lt;span style="color: #6897bb"&gt;1024&lt;/span&gt; * &lt;span style="color: #6897bb"&gt;1024&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; binding.ReaderQuotas.MaxArrayLength = &lt;span style="color: #6897bb"&gt;50&lt;/span&gt; * &lt;span style="color: #6897bb"&gt;1024&lt;/span&gt; * &lt;span style="color: #6897bb"&gt;1024&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; binding.ReaderQuotas.MaxStringContentLength = &lt;span style="color: #6897bb"&gt;50&lt;/span&gt; * &lt;span style="color: #6897bb"&gt;1024&lt;/span&gt; * &lt;span style="color: #6897bb"&gt;1024&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Specify an identity (any identity) in order to get it past .net3.5 sp1&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;EndpointIdentity&lt;/span&gt; epi = &lt;span style="color: #ffc66d"&gt;EndpointIdentity&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.CreateUpnIdentity(&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;&amp;quot;unknown&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;EndpointAddress&lt;/span&gt; epa = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;EndpointAddress&lt;/span&gt;(&lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Uri&lt;/span&gt;(address), epi);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; client = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;DocumentConverterServiceClient&lt;/span&gt;(binding, epa);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; client.Open();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;return&lt;/span&gt; client;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;catch&lt;/span&gt; (&lt;span style="color: #ffc66d"&gt;Exception&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CloseService(client);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;throw&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Check if the client is open and then close it.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param name=&amp;quot;client&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;The client to close&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;public&lt;/span&gt; &lt;span style="color: #cc7832"&gt;static&lt;/span&gt; &lt;span style="color: #cc7832"&gt;void&lt;/span&gt; CloseService(&lt;span style="color: #ffc66d"&gt;DocumentConverterServiceClient&lt;/span&gt; client)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (client != &lt;span style="color: #cc7832"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; client.State == &lt;span style="color: #6897bb"&gt;CommunicationState&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Opened)&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; client.Close();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;
    &lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Make sure the output folder contains an MS-Word file. 
    &lt;br /&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Compile and execute the application. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;As all this functionality is exposed via a Web Services interface, it works equally well from Java and other web services enabled environments.&lt;/p&gt;

&lt;p&gt;This code is merely an example of what is possible, feel free to adapt it to you own needs, add more complex watermarks or your company logo to each page. The possibilities are endless.&lt;/p&gt;

&lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-740385864845707853?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/740385864845707853/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/06/using-awesome-new-watermarking-features.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/740385864845707853" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/740385864845707853" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/06/using-awesome-new-watermarking-features.html" title="Using the awesome new watermarking features of the Muhimbi PDF Converter Services" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-537054216302857007</id><published>2010-06-03T12:13:00.003+01:00</published><updated>2010-06-27T21:49:42.251+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Adding custom Converters to Muhimbi’s range of PDF Conversion products</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 0px 15px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="plug_in" border="0" alt="plug_in" align="right" src="http://lh5.ggpht.com/_IgJp5HQ80aU/TAeORpYrtCI/AAAAAAAAAPY/msRLnCfKKX4/plug_in5.jpg?imgmax=800" width="130" height="130" /&gt; At Muhimbi we are continuously improving our range of PDF Conversion products such as the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;PDF Converter for SharePoint&lt;/a&gt; and the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;Muhimbi PDF Converter Services&lt;/a&gt;. The way we prioritise new features is simple, we take the list of our customers’ feature requests, order it by &lt;em&gt;number of times requested&lt;/em&gt; and we develop away. It really is that simple.&lt;/p&gt;  &lt;p&gt;We recently delivered our #1 feature request, which is &lt;a href="http://blog.muhimbi.com/2010/05/pdf-converter-for-sharepoint-34.html"&gt;compatibility with SharePoint 2010 and Office 2010&lt;/a&gt;. Next up is native support for watermarking (more about that in a future post) and the ability for our customers to add custom converters that fit their exact needs. This post provides an example of how to create your own Custom Converter and add it to the Document Conversion Service. Note that you need version 3.5 or newer to make use of custom converters.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div align="center"&gt;   &lt;hr style="width: 200px" /&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The Muhimbi PDF Conversion Service allows custom converters to be added with relative ease. This is useful for converting file types specific to your organisation or for file types that have not (yet) been implemented by Muhimbi in the main product.    &lt;br /&gt;The following example shows how to replace the existing MS-Word converter, which relies on MS-Word being present, with a simple third party converter that works well enough for simple documents. Some programming knowledge is required. &lt;/p&gt;  &lt;p&gt;The steps are as follows: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Create a new Visual Studio project, select &lt;em&gt;Class Library (C#, .net 3.0)&lt;/em&gt; as the template and give the project an appropriate name, e.g. &lt;em&gt;CustomConverters&lt;/em&gt;.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Add references to the following DLLs. They are located in the folder the Muhimbi Document Conversion Service has been installed in, usually c:\Program Files\Muhimbi….      &lt;br /&gt;&amp;#160; &lt;br /&gt;•&amp;#160;&amp;#160;&amp;#160; Muhimbi.dll       &lt;br /&gt;•&amp;#160;&amp;#160;&amp;#160; Muhimbi.DocumentConverter.WebService.dll       &lt;br /&gt;•&amp;#160;&amp;#160;&amp;#160; Muhimbi.DocumentConverter.WebService.Data.dll       &lt;br /&gt;•&amp;#160;&amp;#160;&amp;#160; System.Runtime.Serialization (Add reference from the .NET tab, you can’t ‘Browse’ for this DLL)       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Change your project’s Assembly name and default namespace to something sensible, e.g. &lt;em&gt;Muhimbi.DocumentConverter.WebService.CustomConverters&lt;/em&gt;. This can be done by &lt;em&gt;right-clicking&lt;/em&gt; on your project and selecting &lt;em&gt;Properties&lt;/em&gt;. The &lt;em&gt;Application&lt;/em&gt; tab allows these settings to be changed.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Delete the automatically generated class1.cs file and add a new class named &lt;em&gt;WordConverter.cs&lt;/em&gt;. &lt;strong&gt;Make sure the class definition is public&lt;/strong&gt;.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Inherit &lt;em&gt;Muhimbi.DocumentConverter.WebService.AbstractDocumentConverter&lt;/em&gt; in the &lt;em&gt;WordConverter&lt;/em&gt; class and implement the members (&lt;em&gt;right-click&lt;/em&gt; on the base class name and select &lt;em&gt;Implement Abstract Class&lt;/em&gt;).       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Add the following 2 constructors and make sure they call the base constructors.&amp;#160; &lt;br /&gt;&amp;#160; &lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;       &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;public&lt;/span&gt; WordConverter()&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; : &lt;span style="color: #cc7832"&gt;base&lt;/span&gt;()&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{ }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;public&lt;/span&gt; WordConverter(&lt;span style="color: #ffc66d"&gt;Stream&lt;/span&gt; sourceFile, &lt;span style="color: #ffc66d"&gt;OpenOptions&lt;/span&gt; openOptions,&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;ConversionSettings&lt;/span&gt; conversionSettings)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; : &lt;span style="color: #cc7832"&gt;base&lt;/span&gt;(sourceFile, openOptions, conversionSettings)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{ }&lt;/pre&gt;
    &lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Next up, we need to implement the &lt;em&gt;RunDiagnostics&lt;/em&gt; method. This method is normally used to carry out an internal end-to-end conversion to verify that the converter and all prerequisites have been installed correctly. In this test we simply return a new &lt;em&gt;DiagnosticResultItem&lt;/em&gt; with the &lt;em&gt;Valid&lt;/em&gt; property set to &lt;em&gt;true&lt;/em&gt;.&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160; &lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;
      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;public&lt;/span&gt; &lt;span style="color: #cc7832"&gt;override&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;DiagnosticResultItem&lt;/span&gt; RunDiagnostics()&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;DiagnosticResultItem&lt;/span&gt; dri = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;DiagnosticResultItem&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; dri.Valid = &lt;span style="color: #cc7832"&gt;true&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;return&lt;/span&gt; dri;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;
    &lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;If we need to look further than just the file extension to determine the file type then we can optionally override the &lt;em&gt;CanConvert&lt;/em&gt; method and look inside the stream (available in the &lt;em&gt;_sourceFile&lt;/em&gt; member variable). This is not necessary for this sample converter, but an example is provided below. 

    &lt;br /&gt;&amp;#160; &lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;
      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;public&lt;/span&gt; &lt;span style="color: #cc7832"&gt;override&lt;/span&gt; &lt;span style="color: #cc7832"&gt;bool&lt;/span&gt; CanConvert(&lt;span style="color: #cc7832"&gt;string&lt;/span&gt;[] fileExtensions)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Do we know anything about this extension&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (&lt;span style="color: #cc7832"&gt;base&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.CanConvert(fileExtensions) == &lt;/span&gt;&lt;span style="color: #cc7832"&gt;false&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;return&lt;/span&gt; &lt;span style="color: #cc7832"&gt;false&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Investigate in more detail&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160; ...implement your own...&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;
    &lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;The next and final method to implement is the actual &lt;em&gt;Convert&lt;/em&gt; method, which is where all the magic happens. As it is not feasible to develop an MS-Word to PDF converter from scratch, the sensible thing to do is to use a third party library such as &lt;a href="http://www.syncfusion.com/products/reporting-edition/docio"&gt;SyncFusion DocIO&lt;/a&gt; or &lt;a href="http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx"&gt;Aspose.Words&lt;/a&gt; (download the archive that contains just the DLLs). In this example we are going to use Aspose's library for processing MS-Word files. It is not perfect, but for some documents such as forms and simple text documents it works very well. 

    &lt;br /&gt;&amp;#160; &lt;br /&gt;Copy &lt;em&gt;Aspose.Words.dll&lt;/em&gt; into the project directory and add a reference to it. Copy the following code into the &lt;em&gt;WordConverter&lt;/em&gt; class. 

    &lt;br /&gt;&amp;#160; &lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;
      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;public&lt;/span&gt; &lt;span style="color: #cc7832"&gt;override&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Stream&lt;/span&gt; Convert()&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;try&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Validate as certain options are not supported by this converter&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (_openOptions.AllowMacros != &lt;span style="color: #6897bb"&gt;MacroSecurityOption&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.None)&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Logger&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Warn(&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;&amp;quot;Macros are not supported by this converter.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Set the licences for Aspose.Words. &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Aspose.Words.&lt;span style="color: #ffc66d"&gt;License&lt;/span&gt; wordLicence = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; Aspose.Words.&lt;span style="color: #ffc66d"&gt;License&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;//wordLicence.SetLicense(&amp;quot;Enter your license in here.&amp;quot;);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Document&lt;/span&gt; asposeDocument = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;Document&lt;/span&gt;(_sourceFile, &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;,&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #6897bb"&gt;LoadFormat&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Auto, _openOptions.Password);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Do we need to refresh the fields etc?&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (_openOptions.RefreshContent == &lt;span style="color: #cc7832"&gt;true&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; asposeDocument.Range.UpdateFields();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Convert the Document to PDF and save it as a memory stream.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (_conversionSettings.Format == &lt;span style="color: #6897bb"&gt;OutputFormat&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.PDF)&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;MemoryStream&lt;/span&gt; convertedStream = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;MemoryStream&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;PdfOptions&lt;/span&gt; options = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;PdfOptions&lt;/span&gt;();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Specify the PDF Profile&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (_conversionSettings.PDFProfile == &lt;span style="color: #6897bb"&gt;PDFProfile&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.PDF_1_5)&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; options.Compliance = &lt;span style="color: #6897bb"&gt;PdfCompliance&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Pdf15;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; options.Compliance = &lt;span style="color: #6897bb"&gt;PdfCompliance&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.PdfA1b;&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** How to deal with bookmarks&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (_conversionSettings.GenerateBookmarks == &lt;span style="color: #6897bb"&gt;BookmarkGenerationOption&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Automatic)&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; options.HeadingsOutlineLevels = &lt;span style="color: #6897bb"&gt;9&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;else&lt;/span&gt; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (_conversionSettings.GenerateBookmarks == &lt;span style="color: #6897bb"&gt;BookmarkGenerationOption&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Custom)&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; options.BookmarksOutlineLevel = &lt;span style="color: #6897bb"&gt;9&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Correct the start and end pages if needed&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;int&lt;/span&gt; startPage = _conversionSettings.StartPage != &lt;span style="color: #6897bb"&gt;0&lt;/span&gt; ?&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; _conversionSettings.StartPage - &lt;span style="color: #6897bb"&gt;1&lt;/span&gt; : &lt;span style="color: #6897bb"&gt;0&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;int&lt;/span&gt; pageCount = asposeDocument.PageCount - startPage;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (_conversionSettings.EndPage != &lt;span style="color: #6897bb"&gt;0&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; pageCount = &lt;span style="color: #ffc66d"&gt;Math&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Min(_conversionSettings.EndPage - startPage, &lt;/span&gt;pageCount);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Carry out the actual conversion&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; asposeDocument.SaveToPdf(startPage, pageCount, convertedStream, options);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;return&lt;/span&gt; convertedStream;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;throw&lt;/span&gt; &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;NotSupportedException&lt;/span&gt;(&lt;span style="color: #a5c25c"&gt;&amp;quot;Outputformat '&amp;quot;&lt;/span&gt; + _conversionSettings.Format +&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #a5c25c"&gt;&amp;quot;' not supported by this Converter.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;catch&lt;/span&gt; (&lt;span style="color: #ffc66d"&gt;UnsupportedFileFormatException&lt;/span&gt; ex)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;throw&lt;/span&gt; &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;WebServiceInternalException&lt;/span&gt;(&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #6897bb"&gt;WebServiceExceptionType&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.FileFormatNotSupported, ex.Message);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;catch&lt;/span&gt; (&lt;span style="color: #ffc66d"&gt;Exception&lt;/span&gt; ex)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt; message = &lt;span style="color: #a5c25c"&gt;&amp;quot;An error occurred while converting a file&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (_openOptions != &lt;span style="color: #cc7832"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; _openOptions.OriginalFileName != &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; message += &lt;span style="color: #a5c25c"&gt;&amp;quot; - &amp;quot;&lt;/span&gt; + _openOptions.OriginalFileName;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #ffc66d"&gt;Logger&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Error(message, ex);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;throw&lt;/span&gt; &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;WebServiceInternalException&lt;/span&gt;(&lt;span style="color: #6897bb"&gt;WebServiceExceptionType&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.InternalError, message);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;
    &lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Compile the project and copy the output DLL as well as &lt;em&gt;Aspose.Words.dll&lt;/em&gt; to the directory that holds the Muhimbi Document Conversion Service. 

    &lt;br /&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Edit the service's config file and make the following changes:&amp;#160; &lt;br /&gt;&amp;#160; &lt;br /&gt;•&amp;#160;&amp;#160;&amp;#160; If the file extensions for the new converter are currently handled by a different converter then remove these extensions 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from the existing converter. 

    &lt;br /&gt;&amp;#160; &lt;br /&gt;•&amp;#160;&amp;#160;&amp;#160; Add the definition for the new converter to the config file as per the following example.&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160; &lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;
      &lt;pre style="margin: 0px"&gt;&amp;lt;&lt;span style="color: #cc7832"&gt;add&lt;/span&gt; key=&amp;quot;&lt;span style="color: #a5c25c"&gt;CustomWordConverter&lt;/span&gt;&amp;quot;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; description=&amp;quot;&lt;span style="color: #a5c25c"&gt;Custom MS-Word Converter&lt;/span&gt;&amp;quot;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; fidelity=&amp;quot;&lt;span style="color: #a5c25c"&gt;Full&lt;/span&gt;&amp;quot;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; supportedExtensions=&amp;quot;&lt;span style="color: #a5c25c"&gt;doc,docx&lt;/span&gt;&amp;quot;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; type=&amp;quot;&lt;span style="color: #a5c25c"&gt;Muhimbi.DocumentConverter.WebService.CustomConverters.WordConverter,&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Muhimbi.DocumentConverter.WebService.CustomConverters,&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&lt;/span&gt;&amp;quot; /&amp;gt;&lt;/pre&gt;
    &lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Restart the service to activate the changes. 
    &lt;br /&gt;&amp;#160; &lt;br /&gt;&lt;font size="2" face="Consolas"&gt;&amp;#160; Net stop &amp;quot;Muhimbi Document Converter Service&amp;quot; 
      &lt;br /&gt;&amp;#160; Net start &amp;quot;Muhimbi Document Converter Service&amp;quot;&lt;/font&gt; 

    &lt;br /&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Finally test if everything is working correctly, either from: 
    &lt;br /&gt;&amp;#160; &lt;br /&gt;•&amp;#160;&amp;#160; &lt;strong&gt;SharePoint:&lt;/strong&gt; Open &lt;em&gt;Central Administration / Application Management / Muhimbi Document Converter Settings&lt;/em&gt;, verify 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; that the new converter is added to the list, check the tick box and click &lt;em&gt;Validate Settings&lt;/em&gt;. If everything is working 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; correctly then don’t forget to save the changes using the &lt;em&gt;OK&lt;/em&gt; button. 

    &lt;br /&gt;&amp;#160; &lt;br /&gt;•&amp;#160;&amp;#160; &lt;strong&gt;Winforms Diagnostics Tool:&lt;/strong&gt; Launch the &lt;em&gt;Diagnostics Tool&lt;/em&gt; from the Windows Start Menu, navigate to the &lt;em&gt;WS Diagnose &lt;/em&gt;

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Tab and click the &lt;em&gt;Request Diagnostics&lt;/em&gt; button. Verify the new converter is listed and &lt;em&gt;Valid = True&lt;/em&gt;. 

    &lt;br /&gt;&amp;#160; &lt;br /&gt;Any errors are logged to the Windows Application Event Log. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Congratulations, you have created your first custom converter. The source code for the WordConverter.cs class &lt;a href="http://www.muhimbi.com/Images---Files/PDFConverter/wordconverter.aspx"&gt;can be downloaded here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exception handling 
    &lt;br /&gt;&amp;#160;&lt;/strong&gt; 

  &lt;br /&gt;Although you can let exceptions bubble up, we recommend catching any exceptions, looking at the root cause of the problem and then throw a specific &lt;em&gt;WebServiceInternalException&lt;/em&gt; using one of the following exception types. &lt;/p&gt;

&lt;p&gt;&lt;font size="2" face="Consolas"&gt;public enum WebServiceExceptionType 
    &lt;br /&gt;{ 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// Unknown error 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Unknown, 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// File format not supported 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; FileFormatNotSupported, 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// File corrupt 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; CorruptDocument, 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// An error occurred while opening the file 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ErrorOpeningFile, 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// Conversion process timeout 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ConversionTimeOut, 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// Application hang. Can happen when document is password protected 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ConverterNotResponding, 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// The underlying converter has not been installed or not correctly installed. 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ConverterNotInstalled, 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// Internal Validation (Should only happen during development) 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt; 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; InternalError 

    &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-537054216302857007?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/537054216302857007/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/06/adding-custom-converters-to-muhimbis.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/537054216302857007" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/537054216302857007" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/06/adding-custom-converters-to-muhimbis.html" title="Adding custom Converters to Muhimbi’s range of PDF Conversion products" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-5102253161468534474</id><published>2010-05-26T23:23:00.001+01:00</published><updated>2010-06-02T15:31:53.149+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="WPP" /><category scheme="http://www.blogger.com/atom/ns#" term="SP2010" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Combining multiple PDF files using a SharePoint Designer Workflow</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="workflow" border="0" alt="workflow" align="right" src="http://lh6.ggpht.com/_IgJp5HQ80aU/S6oNwgz1UuI/AAAAAAAAAOE/31DD4etEA0I/workflow%5B5%5D.jpg?imgmax=800" width="153" height="141" /&gt; Hi I’m Nicolas and today I will show how to merge multiple PDF files using a SharePoint Designer workflow using the &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;PDF Converter for SharePoint&lt;/a&gt; and the &lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint/summary.aspx"&gt;Workflow Power Pack&lt;/a&gt;. &lt;/p&gt; &lt;!--
&lt;script type="text/javascript"&gt;tweetmeme_url = 'http://www.muhimbi.com/blog/2010/03/adding-dynamic-watermark-to-pdf-file.html';&lt;/script&gt;&lt;span style="margin-top: 3px; float: left; margin-right: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt;
--&gt;  &lt;p&gt;A quick introduction for those not familiar with the product: &lt;i&gt;The Muhimbi Workflow Power Pack for SharePoint allows custom C# or VB.NET code to be embedded in SharePoint Designer Workflows without the need to resort to complex Visual Studio based workflows, the development of bespoke Workflow Activities or long development cycles.&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;The solution presented below shows how to create a SharePoint Designer workflow and attach it to a document library. This workflow is triggered when adding or modifying an item in the library, for example after converting a document using the PDF Converter. This example is particularly useful when you want to automatically add a cover page or Appendix to each and every PDF file in the system.    &lt;br /&gt;    &lt;br /&gt;The workflow checks if the file extension for the current item is “pdf”. If this is the case then it uses the &lt;em&gt;Workflow Power Pack&lt;/em&gt; to execute some C# code that carries out the actual appending of PDF files. The solution provided in this post works in SharePoint 2007 as well as 2010.&lt;/p&gt;  &lt;p align="center"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Append PDF content from one file to another" border="0" alt="Append PDF content from one file to another" src="http://lh5.ggpht.com/_b01wc628OdE/S_2fU4kEeZI/AAAAAAAAAA0/eDtd37dQjso/AppendFiles%5B1%5D.jpg?imgmax=800" width="644" height="264" /&gt; &lt;/p&gt;  &lt;p&gt;Create the workflow as follows:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint.aspx"&gt;Download and install the Muhimbi Workflow Power Pack for SharePoint&lt;/a&gt;       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint.aspx"&gt;Download and install the Muhimbi PDF Converter for SharePoint&lt;/a&gt;&amp;#160; &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;We need to be able to access functionality in the &lt;i&gt;Muhimbi.SharePoint.DocumentConverter.PDF&lt;/i&gt; assembly. Add this reference to the relevant Web Application using the &lt;i&gt;Workflow Power Pack Central Administration screens&lt;/i&gt; as described in the &lt;a href="http://www.muhimbi.com/support/documentation/Workflow-Power-Pack/Administration-Guide.aspx"&gt;Administration Guide&lt;/a&gt;.       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/li&gt;    &lt;li&gt;Make sure you have the appropriate privileges to create workflows on a site collection.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Create a new workflow using SharePoint Designer.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;On the Workflow definition screen associate the workflow with the &lt;i&gt;Shared Documents&lt;/i&gt; library, tick the boxes next to both “&lt;i&gt;Automatically start….”&lt;/i&gt; options and proceed to the next screen.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;We only want to act on files of type PDF. Although we could have put this validation in the code, in this example we use a workflow condition for it so add a &lt;i&gt;Compare Any Data Source&lt;/i&gt; condition and:       &lt;br /&gt;&amp;#160; &lt;br /&gt;a. Click on the first &lt;i&gt;value&lt;/i&gt; followed by the &lt;i&gt;display data binding&lt;/i&gt; (fx) button.       &lt;br /&gt;b. Select &lt;i&gt;Current Item&lt;/i&gt; as the Source and select &lt;i&gt;File Type&lt;/i&gt; in the Field. Click the OK button to continue.       &lt;br /&gt;c. Click on the second value and enter pdf. (Use lower case as the &lt;em&gt;compare&lt;/em&gt; option is case sensitive).       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Click the &lt;i&gt;Actions&lt;/i&gt; button and insert the &lt;i&gt;Execute Custom Code &lt;/i&gt;action.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Click &lt;i&gt;&lt;u&gt;parameter 1&lt;/u&gt;&lt;/i&gt; and enter a relative or absolute path to the PDF file you want to append to the current workflow item. For example &lt;em&gt;/sites/PDFConversion/Shared%20Documents/appendix.pdf&amp;#160; or Shared%20Documents/appendix.pdf&lt;/em&gt;       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Optionally, click &lt;i&gt;&lt;u&gt;parameter 2&lt;/u&gt;&lt;/i&gt; to specify a second PDF file to append.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Insert the C# based code listed below by clicking &lt;em&gt;&lt;u&gt;this code&lt;/u&gt;&lt;/em&gt; in the workflow designer.&amp;#160; &lt;em&gt;Note that copying this code using Internet Explorer may remove line breaks. Preferably use Chrome or Firefox to copy the code or alternatively paste it from Internet Explorer into Windows Wordpad and then copy it from there into SharePoint Designer.&lt;/em&gt;       &lt;br /&gt;&amp;#160; &lt;div style="padding-bottom: 10px; padding-left: 10px; padding-right: 10px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 10px"&gt;       &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;/*********************************************************************************************&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Muhimbi PDF Converter - Combining Multiple PDF Files&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Copyright 2010, Muhimbi Ltd - www.muhimbi.com - All rights reserved&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;The following code shows a simple way to merge PDF content from one or more files&lt;/span&gt;&lt;span style="color: gray"&gt;.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;Error and permission checking as well as other minor features have been omitted for the &lt;/span&gt;&lt;span style="color: gray"&gt;sake&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;of brevity and clarity.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;This code requires Muhimbi’s PDF Converter and Workflow Power Pack to be installed.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;****************************************************************************************&lt;/span&gt;&lt;span style="color: gray"&gt;******/&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; Syncfusion.Pdf.Parsing;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; System.IO;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Some variables we're going to use&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #ffc66d"&gt;SPFile&lt;/span&gt; spDocument1ToAppend = &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #ffc66d"&gt;SPFile&lt;/span&gt; spDocument2ToAppend = &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #ffc66d"&gt;PdfLoadedDocument&lt;/span&gt; document1ToAppend = &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #ffc66d"&gt;PdfLoadedDocument&lt;/span&gt; document2ToAppend = &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Get and load current pdf document (the one which triggered the workflow)&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #ffc66d"&gt;SPFile&lt;/span&gt; spSourceDocument = MyWorkflow.Item.File;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #ffc66d"&gt;PdfLoadedDocument&lt;/span&gt; sourcePdfDocument = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;PdfLoadedDocument&lt;/span&gt;(spSourceDocument.OpenBinary());&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** If supplied, get and load 1st pdf document to append to&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; document1ToAppendPath = MyWorkflow.Parameter1 &lt;span style="color: #cc7832"&gt;as&lt;/span&gt; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (!&lt;span style="color: #cc7832"&gt;string&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.IsNullOrEmpty(document1ToAppendPath))&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; spDocument1ToAppend = MyWorkflow.Web.GetFile(document1ToAppendPath);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; document1ToAppend = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;PdfLoadedDocument&lt;/span&gt;(spDocument1ToAppend.OpenBinary());&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** If supplied, get and load 2nd pdf document to append to&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; document2ToAppendPath = MyWorkflow.Parameter2 &lt;span style="color: #cc7832"&gt;as&lt;/span&gt; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (!&lt;span style="color: #cc7832"&gt;string&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.IsNullOrEmpty(document2ToAppendPath))&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; spDocument2ToAppend = MyWorkflow.Web.GetFile(document2ToAppendPath);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; document2ToAppend = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;PdfLoadedDocument&lt;/span&gt;(spDocument2ToAppend.OpenBinary());&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Get destination file and folder&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; destinationFolderUrl = spSourceDocument.ParentFolder.Url;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #ffc66d"&gt;SPFolder&lt;/span&gt; spDestinationFolder = MyWorkflow.Web.GetFolder(destinationFolderUrl);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; destinationFileName = spSourceDocument.Name;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; destinationFilePath = &lt;span style="color: #cc7832"&gt;string&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Format(&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;&amp;quot;{0}/{1}&amp;quot;&lt;/span&gt;, destinationFolderUrl,
                             destinationFileName);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #ffc66d"&gt;SPWeb&lt;/span&gt; spDestinationWeb = spDestinationFolder.ParentWeb;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #ffc66d"&gt;SPFile&lt;/span&gt; spDestinationFile = spDestinationWeb.GetFile(destinationFilePath);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** If a document library requires manual checkout and the file is not checked out,&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** then check the file out before uploading&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (spDestinationFile.Exists &amp;amp;&amp;amp; spDestinationFile.Item.ParentList.ForceCheckout &amp;amp;&amp;amp;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; spDestinationFile.CheckOutStatus == &lt;span style="color: #ffc66d"&gt;SPFile&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.&lt;/span&gt;&lt;span style="color: #6897bb"&gt;SPCheckOutStatus&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.None)&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; spDestinationFile.CheckOut();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Add the file to the site including the meta data&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; (&lt;span style="color: #ffc66d"&gt;MemoryStream&lt;/span&gt; mergedDocument = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;MemoryStream&lt;/span&gt;())&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Append files to destination document&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (document1ToAppend != &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sourcePdfDocument.Append(document1ToAppend);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (document2ToAppend != &lt;span style="color: #cc7832"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sourcePdfDocument.Append(document2ToAppend);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Save merged file and overwrite in document library&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; sourcePdfDocument.Save(mergedDocument);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; spDestinationFile = spDestinationWeb.Files.Add(destinationFilePath, mergedDocument,
                        spSourceDocument.Item.Properties, &lt;span style="color: #cc7832"&gt;true&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Check the file back in if this script was responsible for checking it out&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (spDestinationFile.Item.ParentList.ForceCheckout)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; spDestinationFile.CheckIn(&lt;span style="color: #a5c25c"&gt;&amp;quot;Auto check-in after PDF document appending.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
    &lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Click the &lt;i&gt;Actions&lt;/i&gt; button, select &lt;i&gt;Log to History List&lt;/i&gt;, click &lt;i&gt;&lt;u&gt;this message&lt;/u&gt;&lt;/i&gt; and enter &lt;em&gt;PDF content appended to current item&lt;/em&gt;. 

    &lt;br /&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Close the Workflow Designer. 
    &lt;br /&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Update an existing PDF or add a new PDF file to your document library to trigger the workflow and append contents from the files defined in &lt;i&gt;&lt;u&gt;parameter 1&lt;/u&gt;&lt;/i&gt; and &lt;i&gt;&lt;u&gt;parameter 2&lt;/u&gt;&lt;/i&gt;. 

    &lt;br /&gt;&amp;#160; &lt;br /&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Files to append" border="0" alt="Files to append" src="http://lh5.ggpht.com/_b01wc628OdE/S_2fVr7xbfI/AAAAAAAAAA8/CYKk4hDo-wE/FilesToAppend%5B4%5D.png?imgmax=800" width="626" height="314" /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160; &lt;a href="http://lh6.ggpht.com/_IgJp5HQ80aU/S6oNxG4He6I/AAAAAAAAAOI/2ZsxbqDRWJs/s1600-h/WaterMarkScript%5B3%5D.jpg"&gt;&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;The workflow should look something like this. 
    &lt;br /&gt;

    &lt;br /&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Workflow" border="0" alt="Workflow" src="http://lh4.ggpht.com/_b01wc628OdE/S_2fWaX1zQI/AAAAAAAAABA/eE3rlSEixVc/Workflow%5B12%5D.png?imgmax=800" width="644" height="454" /&gt;&amp;#160; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
  &lt;br /&gt;Of course this is just a sample, feel free to play around with the code, change which parameters are passed into the workflow, use different document libraries as source and destination of PDF documents, change the sequence in which documents are appended, etc.&lt;/p&gt;

&lt;p&gt;Please leave a comment if you’re trying to do anything specific or if you want to share your experience with this approach.&lt;/p&gt;

&lt;p&gt;As always, feel free to &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us using Twitter, our Blog, regular email&lt;/a&gt; or &lt;a href="http://eepurl.com/b6A7"&gt;subscribe to our newsletter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-5102253161468534474?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/5102253161468534474/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/05/combining-multiple-pdf-files-using.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/5102253161468534474" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/5102253161468534474" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/05/combining-multiple-pdf-files-using.html" title="Combining multiple PDF files using a SharePoint Designer Workflow" /><author><name>Nicolas</name><uri>http://www.blogger.com/profile/10222292744941998518</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="04981840472237833584" /></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-2710752562001245730</id><published>2010-05-24T11:57:00.001+01:00</published><updated>2010-05-24T12:17:19.580+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="WPP" /><category scheme="http://www.blogger.com/atom/ns#" term="SP2010" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><title type="text">Workflow Power Pack 1.2 - Embed C#/VB in SharePoint 2007 / 2010 Designer Workflows</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="WPPBox" border="0" alt="WPPBox" align="right" src="http://lh6.ggpht.com/_IgJp5HQ80aU/S_pboPRzIoI/AAAAAAAAAPQ/uAuEX6tNMKc/WPPBox%5B5%5D.jpg?imgmax=800" width="200" height="183" /&gt;If you are a loyal follower of this blog then you may have noticed that we are adding SharePoint 2010 compatibility to our entire Product Line. We started with our best-selling &lt;a href="http://blog.muhimbi.com/2010/05/pdf-converter-for-sharepoint-34.html"&gt;PDF Converter for SharePoint&lt;/a&gt; and, with the &lt;a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder.html"&gt;experience gained&lt;/a&gt; during that project, moved on to the &lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint/summary.aspx"&gt;Workflow Power Pack&lt;/a&gt;. &lt;/p&gt; &lt;script type="text/javascript"&gt;tweetmeme_url = 'http://blog.muhimbi.com/2010/05/workflow-power-pack-12-embed-cvb-in.html';&lt;/script&gt;&lt;span style="margin-top: 3px; float: left; margin-right: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt;  &lt;p&gt;A quick introduction for those not familiar with the product: &lt;em&gt;The Muhimbi Workflow Power Pack for SharePoint allows custom C# or VB.NET code to be embedded in SharePoint Designer Workflows without the need to resort to complex Visual Studio based workflows, the development of bespoke Workflow Activities or long development cycles.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;In addition to SharePoint 2010 support we have also made it possible to localise the Workflow Power Pack for the non-English market. Support for the Dutch language has already been added and more languages will follow shortly. If you would like to see support for your language then please &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;drop us a line&lt;/a&gt;.     &lt;br /&gt;&amp;#160;&lt;/p&gt; &lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="SP2010-WPP" border="0" alt="SP2010-WPP" src="http://lh4.ggpht.com/_IgJp5HQ80aU/S_pbom6v_YI/AAAAAAAAAPU/jt6vDyB_0Es/SP2010-WPP%5B7%5D.png?imgmax=800" width="670" height="404" /&gt;   &lt;div style="text-align: center; font-size: 8pt"&gt;&lt;i&gt;Look at the fancy support for the Shiny new SharePoint Designer 2010 Workflow Editor&lt;/i&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;The main changes in version 1.2 are as follows: &lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="700"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="31"&gt;&lt;font size="2"&gt;859&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="667"&gt;&lt;font size="2"&gt;Added support for SharePoint 2010.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="31"&gt;&lt;font size="2"&gt;723&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="667"&gt;&lt;font size="2"&gt;Made it possible to create localised versions.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="31"&gt;&lt;font size="2"&gt;862&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="667"&gt;&lt;font size="2"&gt;Added support for the Dutch language.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="31"&gt;&lt;font size="2"&gt;856&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="667"&gt;&lt;font size="2"&gt;Added support for Server and Enterprise license models.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="31"&gt;&lt;font size="2"&gt;858&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="667"&gt;&lt;font size="2"&gt;Improved support for deploying resource files in Farm environments.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;For more information check out the following resources:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint.aspx"&gt;Product Page&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/Workflow-Power-Pack/Release-Notes.aspx"&gt;Release Notes&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/Workflow-Power-Pack/Administration-Guide.aspx"&gt;Administration Guide&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/Workflow-Power-Pack/User-Guide.aspx"&gt;User Guide&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/Workflow-Power-Pack/Screenshots.aspx"&gt;Screenshots&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/faqs.aspx"&gt;FAQ&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/forum.aspx?ForumID=6"&gt;Support Forum&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/search/label/WPP"&gt;All Workflow Power Pack related Blog postings&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;As always, feel free to &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us using Twitter, our Blog, regular email&lt;/a&gt; or &lt;a href="http://eepurl.com/b6A7"&gt;subscribe to our newsletter&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint/Download.aspx"&gt;Download your free trial here&lt;/a&gt; (1.5MB). &lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-2710752562001245730?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/2710752562001245730/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/05/workflow-power-pack-12-embed-cvb-in.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/2710752562001245730" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/2710752562001245730" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/05/workflow-power-pack-12-embed-cvb-in.html" title="Workflow Power Pack 1.2 - Embed C#/VB in SharePoint 2007 / 2010 Designer Workflows" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-690982254189423739</id><published>2010-05-07T15:43:00.001+01:00</published><updated>2010-05-07T15:48:10.911+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MuSH" /><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><title type="text">New release of MuSH – Workflow Enabled ‘TinyURL’ for SharePoint v2</title><content type="html">&lt;p&gt;Today we are releasing a small and incremental upgrade to the &lt;a href="http://www.muhimbi.com/Products/SharePoint-URL-Shortener/summary.aspx"&gt;Muhimbi URL Shortener for SharePoint&lt;/a&gt;. No major new features, just bug fixes, deployment improvements and changes to the License Manager to manage our new type of &lt;a href="http://blog.muhimbi.com/2010/01/how-we-license-our-products-make-sure.html"&gt;Server and Enterprise licenses&lt;/a&gt;. Oh the excitement….&lt;/p&gt; &lt;script type="text/javascript"&gt;tweetmeme_url = 'http://blog.muhimbi.com/2010/05/new-release-of-mush-workflow-enabled.html';&lt;/script&gt;&lt;span style="margin-top: 3px; float: left; margin-right: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt;  &lt;p&gt;&lt;em&gt;For those not familiar with the product&lt;/em&gt;&lt;em&gt;, the Muhimbi URL Shortener for SharePoint, aka MuSH, can be used to shorten URLs for typical web applications and SharePoint in particular. It integrates tightly with both WSS and MOSS and allows short URLs to be created directly from a list item’s context menu, workflows and web services. For details &lt;a href="http://blog.muhimbi.com/2009/06/reducing-size-of-urls-using-mush.html"&gt;see the original announcement&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The main changes and improvements are as follows:&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="670"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="31"&gt;&lt;font size="2"&gt;848&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="637"&gt;&lt;font size="2"&gt;Error when first ever shortened URL is given a manual short name.            &lt;br /&gt;&lt;em&gt;&lt;font color="#ff0000"&gt;If you deployed a previous version and experienced problems then please contact use before downloading this new version as some manual steps are involved. This only affects a small number of users.&lt;/font&gt;&lt;/em&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="31"&gt;&lt;font size="2"&gt;852&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="637"&gt;&lt;font size="2"&gt;Added support for new licensing model.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="31"&gt;&lt;font size="2"&gt;854&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="637"&gt;&lt;font size="2"&gt;Added new resource deployment libraries.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160; &lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Workflow-690" border="0" alt="Workflow-690" src="http://lh3.ggpht.com/_IgJp5HQ80aU/S-QnGM_WN8I/AAAAAAAAAPM/J77jP7D79Ek/Workflow-690%5B6%5D.png?imgmax=800" width="674" height="289" /&gt; &lt;/p&gt;  &lt;p&gt;For more information check out the:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.muhimbi.com/Products/SharePoint-URL-Shortener.aspx"&gt;Product Page&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/URL-Shortener/Release-Notes.aspx"&gt;Release Notes&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/URL-Shortener/Administration-Guide.aspx"&gt;User &amp;amp; Administration Guide&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/URL-Shortener/Screenshots.aspx"&gt;More Screenshots&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/forum.aspx?ForumID=4"&gt;Discussion Forum&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/search/label/MuSH"&gt;All MuSH related Blog Postings&lt;/a&gt;. &lt;/li&gt; &lt;/ul&gt; &lt;script type="text/javascript"&gt;tweetmeme_url = 'http://blog.muhimbi.com/2010/05/new-release-of-mush-workflow-enabled.html';&lt;/script&gt;&lt;span style="float: right; margin-left: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt;  &lt;p&gt;As always, feel free to &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us using Twitter, our Blog or regular email&lt;/a&gt; or &lt;a href="http://eepurl.com/b6A7"&gt;subscribe to our newsletter&lt;/a&gt;.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://www.muhimbi.com/Products/SharePoint-URL-Shortener/Free-Trial.aspx"&gt;Download your free trial here&lt;/a&gt; (1MB).&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-690982254189423739?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/690982254189423739/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/05/new-release-of-mush-workflow-enabled.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/690982254189423739" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/690982254189423739" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/05/new-release-of-mush-workflow-enabled.html" title="New release of MuSH – Workflow Enabled ‘TinyURL’ for SharePoint v2" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-1872263537552164227</id><published>2010-05-06T15:58:00.001+01:00</published><updated>2010-05-07T11:24:35.337+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="SP2010" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><title type="text">PDF Converter for SharePoint 3.4 – SharePoint 2010 &amp; Office 2010 RTM Compatible</title><content type="html">&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="PDFBox" border="0" alt="PDFBox" align="right" src="http://lh3.ggpht.com/_IgJp5HQ80aU/S-LZJYlXnrI/AAAAAAAAAPE/0zw1cbowm0c/PDFBox%5B5%5D.jpg?imgmax=800" width="200" height="183" /&gt;   &lt;p&gt;Although it has only been 2 weeks since the RTM version of SharePoint 2010 was released, our team has been working flat out to make the popular &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/Summary.aspx"&gt;Muhimbi PDF Converter for SharePoint&lt;/a&gt; compatible with both SharePoint 2007 and SharePoint 2010. &lt;/p&gt;  &lt;p&gt;As we were going through a full QA cycle anyway we also validated the software with the RTM version of Office 2010 to make sure our customers can make use of the latest and greatest innovations such as Excel &lt;em&gt;Spark lines&lt;/em&gt; when generating PDF files.&lt;/p&gt; &lt;script type="text/javascript"&gt;tweetmeme_url = 'http://blog.muhimbi.com/2010/05/pdf-converter-for-sharepoint-34.html';&lt;/script&gt;&lt;span style="margin-top: 3px; float: left; margin-right: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt;  &lt;p&gt;&lt;em&gt;For those not familiar with the product, the PDF Converter for SharePoint is a lightweight solution that allows end-users to convert common document types to PDF format from within SharePoint using a friendly user interface, workflows or a web service call without the need to install any client side software or Adobe Acrobat. It integrates at a deep level with SharePoint and leverages facilities such as the Audit log, localisation, security and tracing. It runs on WSS 3, MOSS as well as SharePoint 2010 and is available in English, German, Dutch, French, Traditional Chinese and Japanese. For detailed information check out the &lt;/em&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint.aspx"&gt;&lt;em&gt;product page&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p align="center"&gt;&amp;#160;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="PDF-Converter-Doclib" border="0" alt="PDF-Converter-Doclib" src="http://lh4.ggpht.com/_IgJp5HQ80aU/S-LZKXeAIlI/AAAAAAAAAPI/9Q2pVR7KuDk/PDF-Converter-Doclib%5B10%5D.jpg?imgmax=800" width="602" height="277" /&gt; &lt;/p&gt;  &lt;div style="position: relative; text-align: center; font-size: 8pt; top: -20px"&gt;&lt;i&gt;New support for the Ribbon in SharePoint 2010&lt;/i&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The main changes in version 3.4 are as follows:&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="700"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="31"&gt;&lt;font size="2"&gt;792&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="667"&gt;&lt;font size="2"&gt;New - Added support for SharePoint 2010 RTM&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;845&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;New - Added Taiwanese translations (Traditional Chinese)&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;827&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Fix - MS-Word Paragraph borders are not rendered correctly when saved as PDF&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;782&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Fix - Excel 2010 has problems converting ODS files&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;483&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Fix - Resources not deployed on farms where 'Timer Account' is not local administrator&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;524&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Fix - STSADM and Timerjob are fighting over access to layouts.sitemap&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;787&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Fix - Resources don't deploy when SharePoint 2010 Timer service account is not local Admin&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;797&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;New - Make license manager SP2010 compatible&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;840&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Fix - Convert to PDF is not present on Folder Context Menu in SP2010 &amp;amp; SP2007&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;841&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Fix - PDF Converter loads slowly on very big (100K+ items) Document Libraries&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;833&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;Fix - Too much logging during anonymous requests&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;808&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;New - Added support for Server and Enterprise Licenses&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;821&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;New - Added Sample Java code to Setup Project&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;822&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;New - Added Sample .net code to Setup Project&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;font size="2"&gt;825&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;font size="2"&gt;New - Added test harness executable to setup and Start Menu&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;For more information check out the following resources:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint.aspx"&gt;Product Page&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/faqs.aspx"&gt;FAQ&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-for-SharePoint/Release-Notes.aspx"&gt;Release Notes&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-for-SharePoint/Administration-Guide.aspx"&gt;Administration Guide&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-for-SharePoint/User-Guide.aspx"&gt;User Guide&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-for-SharePoint/Screenshots.aspx"&gt;Screenshots&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/forum.aspx?ForumID=1"&gt;Discussion Forum&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/search/label/PDF%20Converter"&gt;Related Blog Posts&lt;/a&gt;. &lt;/li&gt; &lt;/ul&gt; &lt;script type="text/javascript"&gt;tweetmeme_url = 'http://blog.muhimbi.com/2010/05/pdf-converter-for-sharepoint-34.html';&lt;/script&gt;&lt;span style="margin-top: 11px; float: right; margin-left: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;As always, feel free to &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us using Twitter, our Blog, regular email&lt;/a&gt; or &lt;a href="http://eepurl.com/b6A7"&gt;subscribe to our newsletter&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/Free-Trial.aspx"&gt;Download your free trial here&lt;/a&gt; (6MB). &lt;span style="color: #ffffff"&gt;.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-1872263537552164227?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/1872263537552164227/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/05/pdf-converter-for-sharepoint-34.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/1872263537552164227" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/1872263537552164227" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/05/pdf-converter-for-sharepoint-34.html" title="PDF Converter for SharePoint 3.4 – SharePoint 2010 &amp;amp; Office 2010 RTM Compatible" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-110417625561742827</id><published>2010-04-20T14:10:00.001+01:00</published><updated>2010-04-20T14:22:44.614+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Convert Office files to PDF Format from Java using a Web Services based interface</title><content type="html">&lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 10px; display: inline; float: right; border-top: 0px; border-right: 0px" title="Java-Logo" border="0" alt="Java-Logo" align="right" src="http://lh3.ggpht.com/_IgJp5HQ80aU/S82n3Taw1MI/AAAAAAAAAO4/_WmtOTqjZss/Java-Logo%5B7%5D.jpg?imgmax=800" width="61" height="113" /&gt;&lt;/p&gt;  &lt;p&gt;As we have been receiving an increasing number of requests for Java based sample code for the &lt;em&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;Muhimbi PDF Converter Services&lt;/a&gt; (MDCS)&lt;/em&gt;, we have decided to lift the relevant chapter from the &lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/User---Developer-Guide.aspx"&gt;Developer Guide&lt;/a&gt; and publish it in this blog post. A .NET version of this post &lt;a href="http://blog.muhimbi.com/2009/12/converting-office-files-to-pdf-format.html"&gt;is available here&lt;/a&gt;.&lt;/p&gt; &lt;script type="text/javascript"&gt;tweetmeme_url = 'http://blog.muhimbi.com/2010/04/convert-office-files-to-pdf-format-from.html';&lt;/script&gt;&lt;span style="margin-top: 3px; float: left; margin-right: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt;  &lt;p&gt;&lt;em&gt;For those not familiar with the product, the MDCS is a server based SDK that allows software developers to convert typical Office files, including MS-Word, Excel, PowerPoint, Visio, Publisher and InfoPath, to PDF format using a robust, scalable but friendly Web Services interface from Java and .NET based solutions.&lt;/em&gt;     &lt;br /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Even though the MDCS itself must run on a Windows based server, it has been designed to interoperate with non-Windows platforms such as Java. This section describes how to convert documents to PDF format using a Java based environment.&lt;/p&gt;  &lt;p&gt;The full version of the sample code discussed in this post, including pre generated proxies, is installed alongside each copy of the MDCS.    &lt;br /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The example described below assumes the following:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The JDK has been installed and configured.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;The MDCS and all prerequisites have been installed in line with the &lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/Administration-Guide.aspx"&gt;Administration Guide&lt;/a&gt;.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;The MDCS is running in the default &lt;i&gt;anonymous mode&lt;/i&gt;. This is not an absolute requirement, but it makes initial experimentation much easier. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The first step is to generate proxy classes for the web service by executing the following command:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; wsimport http://localhost:41734/Muhimbi.DocumentConverter.WebService/?wsdl      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; -d src -Xnocompile -p com.muhimbi.ws&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Feel free to change the package name and destination directory to something more suitable for your organisation.&lt;/p&gt;  &lt;p&gt;Wsimport automatically generates the Java class names. Unfortunately some of the generated names are rather long and ugly so you may want to consider renaming some, particularly the Exception classes, to something friendlier. This, however, means that if you ever run wsimport again you will need to re-apply those changes. For more information have a look at the &lt;a href="http://blog.muhimbi.com/2009/12/converting-office-files-to-pdf-format.html"&gt;high level overview of the Object Model exposed by the web service&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Once the proxy classes have been created add the following sample code to your project. Run the code and make sure the path to the document to convert is specified on the command line. (&lt;a href="http://www.muhimbi.com/Images---Files/PDFConverterServices/Muhimbi-PDF-Converter-Sample-Code---Java.aspx"&gt;Download Source Code&lt;/a&gt;)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;style type="text/css"&gt;





    code { font-family: consolas, courier new, courier; font-size: 8pt; margin: 0px; }
    .java td { background-color: #fafafa; width:690px }&lt;/style&gt;  &lt;div class="java" align="left"&gt;   &lt;table border="0" cellspacing="0" cellpadding="3" bgcolor="#ffffff"&gt;&lt;tbody&gt;       &lt;tr&gt;&lt;!-- start source code --&gt;         &lt;td valign="top" nowrap="nowrap" align="left"&gt;&lt;code&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;package &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;com.muhimbi.app;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;com.muhimbi.ws.*;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;java.io.*;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;java.net.URL;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;java.util.List;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;javax.xml.bind.JAXBElement;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;import &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;javax.xml.namespace.QName;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public class &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;WsClient &lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;private final static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;String DOCUMENTCONVERTERSERVICE_WSDL_LOCATION = &lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;http://localhost:41734/Muhimbi.DocumentConverter.WebService/?wsdl&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;void &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;main&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;String&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;args&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;try &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;if &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;args.length != &lt;/font&gt;&lt;font color="#990000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out&lt;/font&gt;&lt;font color="#000000"&gt;.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Please specify a single file name on the command line.&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&amp;#160; &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;} &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;else &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Process command line parameters&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String sourceDocumentPath = args&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#990000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;File file = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;File&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;sourceDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String fileName = getFileName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String fileExt = getFileExtension&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Converting file &amp;quot; &lt;/font&gt;&lt;font color="#000000"&gt;+ sourceDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Initialise Web Service&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterService_Service dcss = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterService_Service&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;URL&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;DOCUMENTCONVERTERSERVICE_WSDL_LOCATION&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;, &lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;QName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;http://tempuri.org/&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;, &lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;DocumentConverterService&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterService dcs = dcss.getBasicHttpBindingDocumentConverterService&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Only call conversion if file extension is supported&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;if &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;isFileExtensionSupported&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileExt, dcs&lt;/font&gt;&lt;font color="#000000"&gt;)) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Read source file from disk&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;fileContent = readFile&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;sourceDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Converting the file&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;OpenOptions openOptions = getOpenOptions&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileName, fileExt&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ConversionSettings conversionSettings = getConversionSettings&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;convertedFile = dcs.convert&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileContent, openOptions, conversionSettings&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#3f7f5f"&gt;// ** Writing converted file to file system&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String destinationDocumentPath = getPDFDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;writeFile&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;convertedFile, destinationDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;File converted sucessfully to &amp;quot; &lt;/font&gt;&lt;font color="#000000"&gt;+ destinationDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;} &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;else &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;The file extension is not supported.&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;} &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;catch &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;IOException e&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;e.getMessage&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;} &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;catch &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterServiceGetConfigurationWebServiceFaultExceptionFaultFaultMessage e&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;printException&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;e.getFaultInfo&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;} &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;catch &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterServiceConvertWebServiceFaultExceptionFaultFaultMessage e&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;printException&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;e.getFaultInfo&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;OpenOptions getOpenOptions&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;String fileName, String fileExtension&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ObjectFactory objectFactory = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ObjectFactory&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;OpenOptions openOptions = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;OpenOptions&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;openOptions.setOriginalFileName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createOpenOptionsOriginalFileName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileName&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;openOptions.setFileExtension&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;objectFactory.createOpenOptionsFileExtension&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileExtension&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;openOptions;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ConversionSettings getConversionSettings&lt;/font&gt;&lt;font color="#000000"&gt;() {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ConversionSettings conversionSettings = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ConversionSettings&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings.setQuality&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ConversionQuality.OPTIMIZE_FOR_PRINT&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings.setRange&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ConversionRange.ALL_DOCUMENTS&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings.getFidelity&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;.add&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Full&amp;quot;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings.setFormat&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;OutputFormat.PDF&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;conversionSettings;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;String getFileName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;File file&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String fileName = file.getName&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;fileName.substring&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;, fileName.lastIndexOf&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;'.'&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;String getFileExtension&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;File file&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String fileName = file.getName&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;fileName.substring&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileName.lastIndexOf&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;'.'&lt;/font&gt;&lt;font color="#000000"&gt;) &lt;/font&gt;&lt;font color="#000000"&gt;+ &lt;/font&gt;&lt;font color="#990000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;, fileName.length&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;String getPDFDocumentPath&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;File file&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String fileName = getFileName&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;String folder = file.getParent&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;if &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;folder == &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;folder = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;File&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file.getAbsolutePath&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;.getParent&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;folder + File.separatorChar + fileName + &lt;/font&gt;&lt;font color="#990000"&gt;'.'&lt;/font&gt;&amp;#160;&lt;font color="#000000"&gt;+ OutputFormat.PDF.value&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;readFile&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;String filepath&lt;/font&gt;&lt;font color="#000000"&gt;) &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;throws &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;IOException &lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;File file = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;File&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;filepath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;InputStream is = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;FileInputStream&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;file&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;long &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;length = file.length&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;bytes = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[(&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;) &lt;/font&gt;&lt;font color="#000000"&gt;length&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;int &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;offset = &lt;/font&gt;&lt;font color="#990000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;int &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;numRead;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;while &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;offset &amp;lt; bytes.length&lt;/font&gt;&amp;#160;&lt;font color="#000000"&gt;&amp;amp;&amp;amp; &lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;numRead = is.read&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;bytes, offset, bytes.length - offset&lt;/font&gt;&lt;font color="#000000"&gt;)) &lt;/font&gt;&lt;font color="#000000"&gt;&amp;gt;= &lt;/font&gt;&lt;font color="#990000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;offset += numRead;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;if &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;offset &amp;lt; bytes.length&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;throw new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;IOException&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;quot;Could not completely read file &amp;quot; &lt;/font&gt;&lt;font color="#000000"&gt;+ file.getName&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;is.close&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;bytes;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;void &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;writeFile&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[] &lt;/font&gt;&lt;font color="#000000"&gt;fileContent, String filepath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&amp;#160;&lt;font color="#7f0055"&gt;&lt;b&gt;throws &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;IOException &lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;OutputStream os = &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;FileOutputStream&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;filepath&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;os.write&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;fileContent&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;os.close&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;boolean &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;isFileExtensionSupported&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;String extension, DocumentConverterService dcs&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;throws &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;DocumentConverterServiceGetConfigurationWebServiceFaultExceptionFaultFaultMessage &lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;Configuration configuration = dcs.getConfiguration&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;final &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;JAXBElement&amp;lt;ArrayOfConverterConfiguration&amp;gt; converters = configuration.getConverters&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;final &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ArrayOfConverterConfiguration ofConverterConfiguration = converters.getValue&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;final &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;List&amp;lt;ConverterConfiguration&amp;gt; cList = ofConverterConfiguration.getConverterConfiguration&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;for &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ConverterConfiguration cc : cList&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;final &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;List&amp;lt;String&amp;gt; supportedExtension = cc.getSupportedFileExtensions&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;.getValue&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;.getString&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;if &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;supportedExtension.contains&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;extension&lt;/font&gt;&lt;font color="#000000"&gt;)) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return true&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;return false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;public static &lt;/b&gt;&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;void &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;printException&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;WebServiceFaultException serviceFaultException&lt;/font&gt;&lt;font color="#000000"&gt;) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;serviceFaultException.getExceptionType&lt;/font&gt;&lt;font color="#000000"&gt;())&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;JAXBElement&amp;lt;ArrayOfstring&amp;gt; element = serviceFaultException.getExceptionDetails&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;ArrayOfstring value = element.getValue&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;for &lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;String msg : value.getString&lt;/font&gt;&lt;font color="#000000"&gt;()) {&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;msg&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;#160; &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;               &lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;              &lt;br /&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt; &lt;/td&gt; &lt;!-- end source code --&gt;&lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-110417625561742827?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/110417625561742827/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/04/convert-office-files-to-pdf-format-from.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/110417625561742827" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/110417625561742827" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/04/convert-office-files-to-pdf-format-from.html" title="Convert Office files to PDF Format from Java using a Web Services based interface" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-4703396349285921333</id><published>2010-04-19T15:27:00.001+01:00</published><updated>2010-04-19T15:37:17.668+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="pdf" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter Services" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Use Server Side Java &amp; .NET to Convert Word, Excel, PowerPoint, Publisher &amp; Visio to PDF</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="PDFConverterServicesBox" border="0" alt="PDFConverterServicesBox" align="right" src="http://lh4.ggpht.com/_IgJp5HQ80aU/S8xoSTCSDOI/AAAAAAAAAOU/7AaaRDDx39E/PDFConverterServicesBox%5B5%5D.jpg?imgmax=800" width="200" height="183" /&gt;We are very excited to announce our first product &lt;em&gt;spin-off&lt;/em&gt;, the &lt;em&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/summary.aspx"&gt;Muhimbi PDF Converter Services&lt;/a&gt; (MDCS)&lt;/em&gt;, a server side solution to convert typical MS-Office files to PDF Format in a robust and scalable manner from any web services capable environment, including Java and .NET.&lt;/p&gt; &lt;script type="text/javascript"&gt;tweetmeme_url = 'http://blog.muhimbi.com/2010/04/use-server-side-java-net-to-convert.html';&lt;/script&gt;&lt;span style="margin-top: 3px; float: left; margin-right: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt;  &lt;p&gt;The MDCS is a spin-off from our popular &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint/summary.aspx"&gt;PDF Converter for SharePoint&lt;/a&gt;. Much of the logic is the same, but all the SharePoint specific bells and whistles have been removed and the documentation has been completely rewritten and includes both Java and .NET sample code.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Key features:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Convert popular document types to PDF or XPS format with near perfect fidelity.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Scalable architecture that allows multiple conversions to run in parallel. The service can be scaled up by adding additional CPUs and scaled out by using standard HTTP Load Balancers.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Runs as a Windows Service. No need to install or configure IIS or other web service frameworks.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Convert password protected documents.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Apply security settings to generated PDF files including encryption, password protection and multiple levels of PDF Security options to prevent users from printing documents or copying a document’s content.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Generate regular PDF files or files in PDF/A format.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Generate high resolution PDF Files optimised for printing or normal resolution files optimised for use on screen.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Dynamically refresh a document’s content before generating the PDF. Ideal for merging content from external sources into your PDF file.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Control how to convert hidden / selected content such as PowerPoint Slides and Excel worksheets.      &lt;br /&gt;&amp;#160; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The web services class diagram is displayed below. A blog post describing how to use the Web Service in a .NET environment &lt;a href="http://blog.muhimbi.com/2009/12/converting-office-files-to-pdf-format.html"&gt;can be found here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://www.muhimbi.com/Images---Files/PDFConverterServices/PDFServicesDiagram-FullSize.aspx"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="PDF-Converter-Web-Services-Class-Diagram" border="0" alt="PDF-Converter-Web-Services-Class-Diagram" src="http://lh6.ggpht.com/_IgJp5HQ80aU/S8xoULDF3JI/AAAAAAAAAOs/m3-KFvTRtbs/PDF-Converter-Web-Services-Class-Diagram%5B11%5D.png?imgmax=800" width="670" height="506" /&gt;&lt;/a&gt;&lt;em&gt;&lt;font size="1"&gt;Powerful Web Services based interface. Click to enlarge&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;For more information check out the following resources:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services.aspx"&gt;Product Page&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/Images---Files/PDFConverterServices/PDF-Converter-Services-Brochure.aspx"&gt;Brochure&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/Release-Notes.aspx"&gt;Release Notes&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/Administration-Guide.aspx"&gt;Administration Guide&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/documentation/PDF-Converter-Services/User---Developer-Guide.aspx"&gt;User &amp;amp; Developer Guide&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/faqs.aspx"&gt;FAQ&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/support/forum.aspx?ForumID=7"&gt;Discussion Forum&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/search/label/PDF%20Converter%20Services"&gt;All PDF Converter Services related Blog postings&lt;/a&gt;. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;As always, feel free to &lt;a href="http://www.muhimbi.com/contact.aspx"&gt;contact us using Twitter, our Blog, regular email&lt;/a&gt; or &lt;a href="http://eepurl.com/b6A7"&gt;subscribe to our newsletter&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-Services/Free-Trial.aspx"&gt;Download your free trial here&lt;/a&gt; (4MB). &lt;/p&gt;  &lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-4703396349285921333?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/4703396349285921333/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/04/use-server-side-java-net-to-convert.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/4703396349285921333" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/4703396349285921333" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/04/use-server-side-java-net-to-convert.html" title="Use Server Side Java &amp;amp; .NET to Convert Word, Excel, PowerPoint, Publisher &amp;amp; Visio to PDF" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-5610170921428867974</id><published>2010-03-24T13:04:00.001Z</published><updated>2010-06-21T10:14:34.953+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="WPP" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Adding a dynamic watermark to a PDF file from a SharePoint Workflow</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="workflow" border="0" alt="workflow" align="right" src="http://lh6.ggpht.com/_IgJp5HQ80aU/S6oNwgz1UuI/AAAAAAAAAOE/31DD4etEA0I/workflow%5B5%5D.jpg?imgmax=800" width="153" height="141" /&gt; We have had a great response to our &lt;a href="http://blog.muhimbi.com/2010/01/adding-watermark-to-pdf-file-from.html"&gt;previous post about watermarking PDF files&lt;/a&gt;, however quite a few customers have told us that they want to use a dynamic watermark (e.g. a username, ip address etc) rather than a static one. &lt;/p&gt; &lt;script type="text/javascript"&gt;tweetmeme_url = 'http://www.muhimbi.com/blog/2010/03/adding-dynamic-watermark-to-pdf-file.html';&lt;/script&gt;&lt;span style="margin-top: 3px; float: left; margin-right: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt;  &lt;p&gt;A quick introduction for those not familiar with the product: &lt;em&gt;The Muhimbi Workflow Power Pack for SharePoint allows custom C# or VB.NET code to be embedded in SharePoint Designer Workflows without the need to resort to complex Visual Studio based workflows, the development of bespoke Workflow Activities or long development cycles.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Please note that as of version 3.5 the PDF Conversion Service also supports a &lt;a href="http://blog.muhimbi.com/2010/06/using-awesome-new-watermarking-features.html"&gt;native watermarking interface&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The solution presented below executes a workflow whenever a PDF file is added to a document library. It then applies security settings to prevent the watermark from being removed and then reads the watermark text from a SharePoint column. The workflow author can specify if the watermark is placed in the foreground or the background as well as the level of transparency. As the code is well documented it is easy to make further changes and customisations, e.g. the PDF file that needs to be watermarked may not be the file the workflow is acting on or the watermarked text may come from a workflow variable rather than a list column.&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;br /&gt;Create the workflow as follows:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="http://www.muhimbi.com/Products/Workflow-Power-Pack-for-SharePoint.aspx"&gt;Download and install the Muhimbi Workflow Power Pack for SharePoint&lt;/a&gt;.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint.aspx"&gt;Download and install the Muhimbi PDF Converter for SharePoint&lt;/a&gt;.       &lt;br /&gt;&lt;strong&gt;&lt;em&gt;&lt;font color="#ff0000"&gt;Note that you need version 3.1.2.18 or newer, older versions do not allow watermarking&lt;/font&gt;&lt;/em&gt;&lt;/strong&gt;.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.muhimbi.com/Images---Files/WorkflowPowerPack/Muhimbi-Workflow-Dynamic-Watermarking.aspx"&gt;Download this article’s source code&lt;/a&gt;.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;We need to be able to access functionality in the &lt;em&gt;Muhimbi.SharePoint.DocumentConverter.PDF&lt;/em&gt; and &lt;em&gt;System.Drawing&lt;/em&gt; assemblies. Add these references to the relevant Web Application using the &lt;i&gt;Workflow Power Pack Central Administration screens&lt;/i&gt; as described in the &lt;a href="http://www.muhimbi.com/support/documentation/Workflow-Power-Pack/Administration-Guide.aspx"&gt;Administration Guide&lt;/a&gt;. Make sure to place each reference on a new line.       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/li&gt;    &lt;li&gt;Make sure you have the appropriate privileges to create workflows on a site collection.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Create a new column named &lt;em&gt;Watermark&lt;/em&gt; in the &lt;em&gt;Shared Documents&lt;/em&gt; library. The content of this column will be used as the text for the watermark.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Create a new workflow using SharePoint Designer.      &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;On the Workflow definition screen associate the workflow with the &lt;em&gt;Shared Documents&lt;/em&gt; library, tick the box next to ‘&lt;em&gt;Automatically start this workflow when a new item is created&lt;/em&gt;’ and proceed to the next screen. Please note that if you tick the ‘auto start on update’ box as well then the PDF file may be watermarked multiple times leading to unexpected results.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;We only want to act on files of type PDF. Although we could have put this validation in the code, in this example we use a workflow condition for it so add a &lt;em&gt;Compare Any Data Source&lt;/em&gt; condition and:       &lt;br /&gt;&amp;#160; &lt;br /&gt;a.&amp;#160; Click on the first &lt;em&gt;value&lt;/em&gt; followed by the &lt;em&gt;display data binding&lt;/em&gt; (fx) button.       &lt;br /&gt;b.&amp;#160; Select &lt;em&gt;Current Item&lt;/em&gt; as the Source and select &lt;em&gt;File Type&lt;/em&gt; in the Field. Click the OK button to continue.       &lt;br /&gt;d.&amp;#160; Click on the second &lt;em&gt;value&lt;/em&gt; and enter &lt;em&gt;pdf&lt;/em&gt;. &lt;em&gt;(Use lower case as the compare option is case sensitive).&lt;/em&gt;       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Click the &lt;i&gt;Actions&lt;/i&gt; button and insert the &lt;em&gt;Execute Custom Code &lt;/em&gt;action&lt;em&gt;.        &lt;br /&gt;&amp;#160; &lt;/em&gt;&lt;/li&gt;    &lt;li&gt;Optionally click &lt;u&gt;parameter 1&lt;/u&gt; and enter a relative or absolute destination path. Leave the parameter empty to save the watermarked file on top of the existing PDF file. For details about how paths are handled, see &lt;a href="http://blog.muhimbi.com/2009/11/automatically-convert-files-to-pdf.html"&gt;this post&lt;/a&gt; and search for the words ‘this url’.       &lt;br /&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;Insert the C# based code embedded in step #3’s download (also listed below) by clicking &lt;u&gt;this code&lt;/u&gt;.       &lt;br /&gt;&amp;#160; &lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;       &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;/*********************************************************************************************&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Muhimbi PDF Converter - Dynamic Watermarking&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Copyright 2010, Muhimbi Ltd - www.muhimbi.com - All rights reserved&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt; The following code shows a simple way of adding a dynamic watermark to existing PDF Files. &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt; The watermark content is read from a SharePoint column and rendered on the center of the page.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt; Error and permission checking as well as other minor features have been omitted for the sake &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt; of brevity and clarity.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt; Ideally PDF Conversion, applying security and watermarking is executed in the same step, see &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt; http://www.muhimbi.com/blog/2010/01/configure-pdf-security-from-sharepoint.html&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt; This code requires Muhimbi’s PDF Converter and Workflow Power Pack to be installed.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;**********************************************************************************************/&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; System.Drawing;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; System.IO;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; Syncfusion.Pdf;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; Syncfusion.Pdf.Parsing;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; Syncfusion.Pdf.Graphics;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; Muhimbi.SharePoint.DocumentConverter.PDF;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; Syncfusion.Pdf.Security;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;SPFile spSourceDocument = MyWorkflow.Item.File;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; destinationFileName = spSourceDocument.Name;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; destinationFolderName = MyWorkflow.Parameter1 &lt;span style="color: #cc7832"&gt;as&lt;/span&gt; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Read the text from the Column named 'Watermark', use a column name of your choice.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; watermark = MyWorkflow.Item[&lt;span style="color: #a5c25c"&gt;&amp;quot;Watermark&amp;quot;&lt;/span&gt;] &lt;span style="color: #cc7832"&gt;as&lt;/span&gt; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; pdfOwnerPassword = &lt;span style="color: #a5c25c"&gt;&amp;quot;some!Strong^Password&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** z-order and transparency of the watermark&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;bool&lt;/span&gt; watermarkInBackground = &lt;span style="color: #cc7832"&gt;true&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;float&lt;/span&gt; watermarkTransparancy = &lt;span style="color: #6897bb"&gt;0.25f&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Method for creating a simple template, amend as needed&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;WorkflowFunction&amp;lt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt;, PdfTemplate&amp;gt; CreateWatermark = &lt;span style="color: #cc7832"&gt;delegate&lt;/span&gt;(&lt;span style="color: #cc7832"&gt;string&lt;/span&gt;[] parameters)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;const&lt;/span&gt; &lt;span style="color: #cc7832"&gt;float&lt;/span&gt; watermarkWidth = &lt;span style="color: #6897bb"&gt;250&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;const&lt;/span&gt; &lt;span style="color: #cc7832"&gt;float&lt;/span&gt; watermarkHeight = &lt;span style="color: #6897bb"&gt;23&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;string&lt;/span&gt; watermarkText = parameters[&lt;span style="color: #6897bb"&gt;0&lt;/span&gt;];&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt;(watermarkText==&lt;span style="color: #cc7832"&gt;null&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; watermarkText = &lt;span style="color: #a5c25c"&gt;&amp;quot;no watermark specified&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Create a new Template&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; PdfTemplate template = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; PdfTemplate(watermarkWidth, watermarkHeight);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; PdfGraphics tg = template.Graphics;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Rectangle&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; PdfPen pen = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; PdfPen(PdfBrushes.Black, &lt;span style="color: #6897bb"&gt;1&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; tg.DrawRectangle(pen, PdfBrushes.White, &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; RectangleF(&lt;span style="color: #6897bb"&gt;0&lt;/span&gt;, &lt;span style="color: #6897bb"&gt;0&lt;/span&gt;, watermarkWidth, &lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; watermarkHeight));&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Evaluation message text&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;using&lt;/span&gt; (Font f = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; Font(&lt;span style="color: #a5c25c"&gt;&amp;quot;Arial&amp;quot;&lt;/span&gt;, &lt;span style="color: #6897bb"&gt;10f&lt;/span&gt;, FontStyle.Regular))&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PdfFont font = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; PdfTrueTypeFont(f, &lt;span style="color: #cc7832"&gt;false&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PdfStringFormat stringFormat = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; PdfStringFormat();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; stringFormat.Alignment = PdfTextAlignment.Center;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; stringFormat.LineAlignment = PdfVerticalAlignment.Middle;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; stringFormat.WordWrap = PdfWordWrapType.WordOnly;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; stringFormat.ClipPath = &lt;span style="color: #cc7832"&gt;true&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; tg.DrawString(watermarkText, font, PdfBrushes.Black, &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; RectangleF(&lt;span style="color: #6897bb"&gt;5&lt;/span&gt;, &lt;span style="color: #6897bb"&gt;0&lt;/span&gt;, &lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; watermarkWidth - &lt;span style="color: #6897bb"&gt;10&lt;/span&gt;, watermarkHeight), stringFormat);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;return&lt;/span&gt; template;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;};&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Method for applying security settings, amend / uncomment as needed&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;WorkflowMethod&amp;lt;PdfLoadedDocument&amp;gt; ApplySecurity = &lt;span style="color: #cc7832"&gt;delegate&lt;/span&gt;(PdfLoadedDocument[] pdfDocuments)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; PdfLoadedDocument pdfDocument = pdfDocuments[&lt;span style="color: #6897bb"&gt;0&lt;/span&gt;];&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Enable encryption of content&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; pdfDocument.Security.KeySize = PdfEncryptionKeySize.Key128Bit;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Specify the password used for modifying permissions&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; pdfDocument.Security.OwnerPassword = pdfOwnerPassword;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Apply the restrictions, if any. Note that by default nothing is &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** allowed and we need to individually enable permissions&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; pdfDocument.Security.Permissions = PdfPermissionsFlags.Default;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Allow Commenting / annotations&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; pdfDocument.Security.SetPermissions(PdfPermissionsFlags.EditAnnotations);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Allow Accessibility&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;//pdfDocument.Security.SetPermissions(PdfPermissionsFlags.AccessibilityCopyContent);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Allow Copy content via clipboard etc.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;//pdfDocument.Security.SetPermissions(PdfPermissionsFlags.CopyContent);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Allow Assemble / modification of document&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;//pdfDocument.Security.SetPermissions(PdfPermissionsFlags.AssembleDocument);&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Allow Form fields to be filled out&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; pdfDocument.Security.SetPermissions(PdfPermissionsFlags.FillFields);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Allow high resolution printing&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; pdfDocument.Security.SetPermissions(PdfPermissionsFlags.FullQualityPrint);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Allow any kind of printing&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; pdfDocument.Security.SetPermissions(PdfPermissionsFlags.Print);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;};&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Load the document from SharePoint&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;PdfLoadedDocument sourceDocument = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; PdfLoadedDocument(spSourceDocument.OpenBinary());&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Restrict the rights&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;ApplySecurity(sourceDocument);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Create the watermark Template&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;PdfTemplate watermarkTemplate = CreateWatermark(watermark);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Iterate over all pages and apply the watermark&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;foreach&lt;/span&gt; (PdfPageBase page &lt;span style="color: #cc7832"&gt;in&lt;/span&gt; sourceDocument.Pages)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Position the watermark at the centre of the page&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;float&lt;/span&gt; wmWidth = watermarkTemplate.Width;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;float&lt;/span&gt; wmHeight = watermarkTemplate.Height;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;float&lt;/span&gt; wmLeft = ((page.Size.Width - wmWidth) / &lt;span style="color: #6897bb"&gt;2&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;float&lt;/span&gt; wmTop = ((page.Size.Height - wmHeight) / &lt;span style="color: #6897bb"&gt;2&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; PointF wmPosition = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; PointF(wmLeft, wmTop);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** Place watermark behind or in front of text?&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (watermarkInBackground == &lt;span style="color: #cc7832"&gt;true&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PdfTemplate pageTemplate = page.CreateTemplate();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; page.Layers.Clear();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PdfGraphics g = page.Graphics;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; g.SetTransparency(watermarkTransparancy);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; g.DrawPdfTemplate(watermarkTemplate, wmPosition);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; g.SetTransparency(&lt;span style="color: #6897bb"&gt;1f&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; g.DrawPdfTemplate(pageTemplate, PointF.Empty, page.Size);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;else&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PdfGraphics g = page.Graphics;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; g.SetTransparency(watermarkTransparancy);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; g.DrawPdfTemplate(watermarkTemplate, wmPosition);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Construct the path and file to write the watermarked PDF file to.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (&lt;span style="color: #cc7832"&gt;string&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.IsNullOrEmpty(destinationFolderName) == &lt;/span&gt;&lt;span style="color: #cc7832"&gt;true&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; destinationFolderName = spSourceDocument.ParentFolder.Url;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;SPFolder destinationFolder = Utility.GetSPFolder(destinationFolderName, MyWorkflow.Web);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;string&lt;/span&gt; destinationFilePath = &lt;span style="color: #cc7832"&gt;string&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Format(&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;&amp;quot;{0}/{1}&amp;quot;&lt;/span&gt;, destinationFolder.Url,&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; destinationFileName);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;SPWeb destinationWeb = destinationFolder.ParentWeb;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;SPFile spDestinationFile = destinationWeb.GetFile(destinationFilePath);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** If a document library requires manual checkout and the file is not checked out, then &lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** check the file out before uploading.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (spDestinationFile.Exists &amp;amp;&amp;amp; spDestinationFile.Item.ParentList.ForceCheckout &amp;amp;&amp;amp;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; spDestinationFile.CheckOutStatus == SPFile.SPCheckOutStatus.None)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; spDestinationFile.CheckOut();&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Add the file to the site including the meta data&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;using&lt;/span&gt; (MemoryStream watermarkedFile = &lt;span style="color: #cc7832"&gt;new&lt;/span&gt; MemoryStream())&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; sourceDocument.Save(watermarkedFile);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; spDestinationFile = destinationWeb.Files.Add(destinationFilePath, watermarkedFile,&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; spSourceDocument.Item.Properties, &lt;span style="color: #cc7832"&gt;true&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;// ** Check the file back in if this script was responsible for checking it out.&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (spDestinationFile.Item.ParentList.ForceCheckout == &lt;span style="color: #cc7832"&gt;true&lt;/span&gt;)&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; spDestinationFile.CheckIn(&lt;span style="color: #a5c25c"&gt;&amp;quot;Auto check-in after PDF watermarking.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

      &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;
    &lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Click the &lt;i&gt;Actions&lt;/i&gt; button, select &lt;i&gt;Log to History List&lt;/i&gt;, click &lt;i&gt;&lt;u&gt;this message&lt;/u&gt;&lt;/i&gt; and enter &lt;em&gt;File watermarked&lt;/em&gt;. 

    &lt;br /&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Close the Workflow Designer. 
    &lt;br /&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;Add a new PDF file to your library to trigger the workflow and apply the watermark. Make sure the content for the &lt;em&gt;Watermark&lt;/em&gt; field is specified when the file is added as otherwise a generic watermark text will be inserted. 

    &lt;br /&gt;&amp;#160; &lt;a href="http://lh6.ggpht.com/_IgJp5HQ80aU/S6oNxG4He6I/AAAAAAAAAOI/2ZsxbqDRWJs/s1600-h/WaterMarkScript%5B3%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="WaterMarkScript" border="0" alt="WaterMarkScript" src="http://lh3.ggpht.com/_IgJp5HQ80aU/S6oNxjcSF5I/AAAAAAAAAOM/YHKoZ30PcQQ/WaterMarkScript_thumb%5B1%5D.jpg?imgmax=800" width="575" height="304" /&gt;&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Naturally this is just a simple example. Feel free to play around with the code, change which parameters are passed into the workflow, modify where watermarked files are written to or use a different source for the watermark text. Leave a comment below if you are trying to do anything specific.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: &lt;em&gt;If you get the message ‘no watermark specified’ then the workflow may have been triggered before you specified the contents of the Watermark field. For details see &lt;/em&gt;&lt;a href="http://blog.muhimbi.com/2009/05/sharepoint-designer-workflows-trigger.html"&gt;&lt;em&gt;SharePoint Designer workflows trigger before properties are set&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-5610170921428867974?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/5610170921428867974/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/03/adding-dynamic-watermark-to-pdf-file.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/5610170921428867974" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/5610170921428867974" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/03/adding-dynamic-watermark-to-pdf-file.html" title="Adding a dynamic watermark to a PDF file from a SharePoint Workflow" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-890636393913357384</id><published>2010-03-17T11:40:00.003Z</published><updated>2010-05-19T13:42:48.636+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="SP2010" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Porting a SharePoint 2007 WSPBuilder solution to SharePoint 2010 – Part 4</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 5px 0px 0px 10px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="SharePoint2010" border="0" alt="SharePoint2010" align="right" src="http://lh6.ggpht.com/_IgJp5HQ80aU/S6C_oS004xI/AAAAAAAAAOA/4NnbzKznvVA/SharePoint2010%5B5%5D.png?imgmax=800" width="150" height="113"&gt; In the final part of our series about porting a SharePoint 2007 based WSPBuilder project to SharePoint 2010 we discuss the changes made to our Installation scripts in order to make it work with both versions of SharePoint.&lt;/p&gt;&lt;script type="text/javascript"&gt;tweetmeme_url = 'http://www.muhimbi.com/blog/2010/03/porting-sharepoint-2007-wspbuilder_17.html';&lt;/script&gt;&lt;span style="margin-top: 3px; float: left; margin-right: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt; &lt;p&gt;Please note that this article is based on our experiences with the beta version of SharePoint 2010. Some of the issues we have identified may have been resolved in the final release.&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;The following posts are part of this series:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder.html"&gt;Part 1 – Introduction / Problems installing the existing 2007 version on SP2010&lt;/a&gt;  &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_12.html"&gt;Part 2 – Reconfiguring the Visual Studio Solution&lt;/a&gt;  &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_15.html"&gt;Part 3 – Programmatic / visual changes&lt;/a&gt;  &lt;li&gt;Part 4 – Updating deployment scripts &lt;em&gt;(This post)&lt;/em&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;em&gt;&amp;nbsp;&lt;br&gt;&lt;/em&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Installation Script&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;The installation scripts used for deploying the SharePoint part of our solutions are simple Windows CMD scripts. Our customers appear to prefer it this way as it allows them to see what is going on and make necessary amendments to deploy the software as part of a larger deployment script. Unfortunately we cannot use &lt;em&gt;PowerShell&lt;/em&gt; as that technology is not available on all systems.&lt;/p&gt; &lt;p&gt;In order to make the same script work on SharePoint 2007 as well as 2010 environments we have had to make the following changes:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Detect which version of SharePoint is installed.  &lt;li&gt;Adjust the STSADM path accordingly.  &lt;li&gt;Adjust the name of the WSP file accordingly as the WSP files for both environments are different.&lt;/li&gt;&lt;br&gt;&amp;nbsp;&lt;/ol&gt; &lt;p&gt;The resulting installation script is as follows:&lt;/p&gt; &lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;&lt;pre style="margin: 0px"&gt;@echo off&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo *******************************************************************************&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo Installing Muhimbi PDF Converter for SharePoint.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (c) 2010 www.muhimbi.com&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo *******************************************************************************&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;REM ** Detect which version of SharePoint is installed.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;SET STSADM="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\bin\STSADM.EXE"&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;SET SolutionWSP=Muhimbi.PDFConverter.SP2010.wsp&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;if exist %STSADM% goto endVersionDetection&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET STSADM="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\bin\STSADM.EXE"&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET SolutionWSP=Muhimbi.PDFConverter.wsp&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if exist %STSADM% goto endVersionDetection&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo - SharePoint does not appear to be installed on this server.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; goto endOfScript&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;:endVersionDetection&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - Adding solution to Solution Store&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;%STSADM% -o addsolution -filename %SolutionWSP%&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;%STSADM% -o execadmsvcjobs&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - Deploying solution&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;%STSADM% -o deploysolution -name %SolutionWSP% -immediate -allowgacdeployment -force&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;%STSADM% -o execadmsvcjobs&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - Feature is self activating&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - Deploying Resources&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;%STSADM% -o copyappbincontent&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - If you are experiencing problems when accessing the solution then&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo&amp;nbsp;&amp;nbsp; please read the Administration guide, particularly section 3.5.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - Installation finished.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;:endOfScript&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;pause&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Un-Installation Script&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The changes required to the un-installation script are similar to the changes for the installation script. As the name of the Timer Service has changed between SharePoint 2007 and 2010 this name has been made dynamic as well.&lt;/p&gt;
&lt;p&gt;The resulting script is as follows:&lt;/p&gt;
&lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;&lt;pre style="margin: 0px"&gt;@echo off&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo *******************************************************************************&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo Un-installing Muhimbi PDF Converter for SharePoint.&amp;nbsp;&amp;nbsp;&amp;nbsp; (c) 2010 www.muhimbi.com&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo *******************************************************************************&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;REM ** Detect which version of SharePoint is installed.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;set STSADM="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\bin\STSADM.EXE"&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;set TimerServiceName="SharePoint 2010 Timer"&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;SET SolutionWSP=Muhimbi.PDFConverter.SP2010.wsp&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;if exist %STSADM% goto endVersionDetection&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET SolutionWSP=Muhimbi.PDFConverter.wsp&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set STSADM="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\bin\STSADM.EXE"&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set TimerServiceName="windows sharepoint services timer"&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if exist %STSADM% goto endVersionDetection&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo - SharePoint does not appear to be installed on this server.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; goto endOfScript&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;:endVersionDetection&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;SET SolutionWSP="Muhimbi.PDFConverter.wsp"&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - Retracting solution.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;%STSADM% -o retractsolution -name %SolutionWSP% -immediate&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;%STSADM% -o execadmsvcjobs&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - Wait for the solution to be retracted across the farm (Check Central Admin).&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;pause&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - Removing solution from Store.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;%STSADM% -o deletesolution -name %SolutionWSP%&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;%STSADM% -o execadmsvcjobs&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - Restarting timer service in order to release any GAC DLLs.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;net stop %TimerServiceName%&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;net start %TimerServiceName%&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo - Un-installation finished.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;:endOfScript&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;echo.&lt;/pre&gt;&lt;pre style="margin: 0px"&gt;pause&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That’s it. We hope you have enjoyed this series. Please leave feedback if you have any questions. &lt;/p&gt;
&lt;p&gt;&lt;font color="white"&gt;.&lt;/font&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-890636393913357384?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/890636393913357384/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_17.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/890636393913357384" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/890636393913357384" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_17.html" title="Porting a SharePoint 2007 WSPBuilder solution to SharePoint 2010 – Part 4" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5787751540548761056.post-5188841634079824134</id><published>2010-03-15T14:46:00.001Z</published><updated>2010-05-19T13:32:41.272+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="News" /><category scheme="http://www.blogger.com/atom/ns#" term="SP2010" /><category scheme="http://www.blogger.com/atom/ns#" term="Products" /><category scheme="http://www.blogger.com/atom/ns#" term="PDF Converter" /><category scheme="http://www.blogger.com/atom/ns#" term="Workflow" /><category scheme="http://www.blogger.com/atom/ns#" term="Articles" /><title type="text">Porting a SharePoint 2007 WSPBuilder solution to SharePoint 2010 – Part 3</title><content type="html">&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 5px 0px 0px 10px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="SharePoint2010" border="0" alt="SharePoint2010" align="right" src="http://lh6.ggpht.com/_IgJp5HQ80aU/S55IQEavJ-I/AAAAAAAAANw/qORAzba1pf8/SharePoint2010%5B5%5D.png?imgmax=800" width="150" height="113" /&gt; In part of 3 of our series about porting a SharePoint 2007 based WSPBuilder project to SharePoint 2010 we discuss the changes made to our code in order to make everything work, and look good, in both versions of SharePoint&lt;/p&gt; &lt;script type="text/javascript"&gt;tweetmeme_url = 'http://www.muhimbi.com/blog/2010/03/porting-sharepoint-2007-wspbuilder_15.html';&lt;/script&gt;&lt;span style="margin-top: 3px; float: left; margin-right: 5px"&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;/span&gt;  &lt;p&gt;Please note that this article is based on our experiences with the beta version of SharePoint 2010. Some of the issues we have identified may have been resolved in the final release.&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The following posts are part of this series:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder.html"&gt;Part 1 – Introduction / Problems installing the existing 2007 version on SP2010&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_12.html"&gt;Part 2 – Reconfiguring the Visual Studio Solution&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Part 3 – Programmatic / visual changes &lt;em&gt;(This post)&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_17.html"&gt;Part 4 – Updating deployment scripts&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;em&gt;&amp;#160; &lt;br /&gt;&lt;/em&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Fixing Central Administration links&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;We started of with the easy bit that required no coding, unless you consider writing XML files coding. As the configuration screen for our &lt;a href="http://www.muhimbi.com/Products/PDF-Converter-for-SharePoint.aspx"&gt;PDF Converter&lt;/a&gt; is located under &lt;em&gt;External Service Connections&lt;/em&gt; in SharePoint 2007, we decided to add it to the same location in SharePoint 2010. &lt;/p&gt;  &lt;p&gt;We added the Custom Action for SharePoint 2010 to the same elements file that holds the SharePoint 2007 definition. SharePoint will simply ignore locations it has no knowledge about, which is very convenient in this case.&lt;/p&gt;  &lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;   &lt;pre style="margin: 0px"&gt;&amp;lt;&lt;span style="color: #cc7832"&gt;Elements&lt;/span&gt; xmlns=&amp;quot;&lt;span style="color: #a5c25c"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160; &amp;lt;!--&lt;span style="color: silver"&gt; Settings screen in SP2007 Central Administration Application Management &lt;/span&gt;--&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160; &amp;lt;&lt;span style="color: #cc7832"&gt;CustomAction&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; Id=&amp;quot;&lt;span style="color: #a5c25c"&gt;Muhimbi.SharePoint.Administration.....ExternalService.DocumentConverterSettings&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; Title=&amp;quot;&lt;span style="color: #a5c25c"&gt;Muhimbi Document Converter Settings&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; Location=&amp;quot;&lt;span style="color: #a5c25c"&gt;Microsoft.SharePoint.Administration.ApplicationManagement&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; GroupId=&amp;quot;&lt;span style="color: #a5c25c"&gt;ExternalService&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; Sequence=&amp;quot;&lt;span style="color: #a5c25c"&gt;51&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160; &amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color: #cc7832"&gt;UrlAction&lt;/span&gt; Url=&amp;quot;&lt;span style="color: #a5c25c"&gt;~site/_admin/Muhimbi.PDFConverter/WebAppDocumentConverterSettings.aspx&lt;/span&gt;&amp;quot;/&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160; &amp;lt;/&lt;span style="color: #cc7832"&gt;CustomAction&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160; &amp;lt;!--&lt;span style="color: silver"&gt; Settings screen in SP2010 Central Administration Application Management &lt;/span&gt;--&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160; &amp;lt;&lt;span style="color: #cc7832"&gt;CustomAction&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; Id=&amp;quot;&lt;span style="color: #a5c25c"&gt;Muhimbi.....GeneralApplicationSettings.ExternalServiceConnections.DocumentCo&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;nverterSettings&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; Title=&amp;quot;&lt;span style="color: #a5c25c"&gt;Muhimbi Document Converter Settings&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; Description=&amp;quot;&lt;span style="color: #a5c25c"&gt;Configure the Muhimbi Document Converter settings.&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; Location=&amp;quot;&lt;span style="color: #a5c25c"&gt;Microsoft.SharePoint.Administration.GeneralApplicationSettings&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; GroupId=&amp;quot;&lt;span style="color: #a5c25c"&gt;ExternalServiceConnections&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; Sequence=&amp;quot;&lt;span style="color: #a5c25c"&gt;51&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160; &amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color: #cc7832"&gt;UrlAction&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Url=&amp;quot;&lt;span style="color: #a5c25c"&gt;/_admin/Muhimbi.PDFConverter/WebAppDocumentConverterSettings.aspx&lt;/span&gt;&amp;quot; /&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160; &amp;lt;/&lt;span style="color: #cc7832"&gt;CustomAction&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p align="center"&gt;&lt;em&gt;Updated elements.xml file. Note that some IDs have been truncated for readability&lt;/em&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;
  &lt;br /&gt;Note that we had to change both the GroupID and Location for SharePoint 2010. At the time of writing a full list of Groups and Locations has not yet been published by Microsoft, but &lt;a href="http://bloggingabout.net/blogs/arjen/archive/2010/02/04/custom-action-definitions-in-sharepoint-2010.aspx"&gt;Arjen Bloemsma has created his own preliminary list&lt;/a&gt;. If the location you want to target is not found in Arjen’s list then you can follow the procedure set out below:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Open Central Administration and navigate to the section you want to place your link in. &lt;/li&gt;

  &lt;li&gt;Write down the name of an ASPX file that is already in that section. &lt;/li&gt;

  &lt;li&gt;Search in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES for all files containing that file name. &lt;/li&gt;

  &lt;li&gt;Open the file and copy the GroupID and Location. 
    &lt;br /&gt;&amp;#160;&lt;/li&gt;
&lt;/ol&gt;

&lt;p align="center"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Central-Admin-PDF-Settings" border="0" alt="Central-Admin-PDF-Settings" src="http://lh6.ggpht.com/_IgJp5HQ80aU/S55IQsOlgYI/AAAAAAAAAN0/tf5nb1r3Sas/Central-Admin-PDF-Settings%5B5%5D.jpg?imgmax=800" width="602" height="277" /&gt;

  &lt;br /&gt;&lt;em&gt;Muhimbi Document Converter Settings in External Service Connections&lt;/em&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding support for the Ribbon&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With the links in Central Administration fixed we moved on to the SharePoint 2010 Ribbon. As we didn’t want to introduce too much change to our back end, we decided to only allow a single document to be selected for conversion at a time. Fortunately the SharePoint team had just provided an example on their blog about &lt;a href="http://blogs.msdn.com/sharepoint/archive/2010/02/15/enabling-a-button-on-the-ribbon-based-on-selection.aspx"&gt;disabling a Ribbon button when more than 1 item is selected&lt;/a&gt;. Unfortunately their code didn’t work, but it gave us a good starting point.&lt;/p&gt;

&lt;p&gt;The Ribbon is quite well documented. For details see:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ee540027(office.14).aspx"&gt;Ribbon documentation on MSDN&lt;/a&gt;. &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/sharepointdeveloperdocs/archive/2009/12/07/SharePointFoundationHowToAddTabToRibbon.aspx"&gt;How to add a tab to the Ribbon in SharePoint Foundation&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;#160; &lt;br /&gt;Once we had the Ribbon changes up and running on SharePoint 2010 we noticed that SharePoint 2007 was no longer able to accept the WSP file. As a result we decided to create a &lt;em&gt;shadow SPHive_2010&lt;/em&gt; folder and modify our build scripts to create two separate WSP Files. For more details see &lt;a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_12.html"&gt;Part 2 – Reconfiguring the Visual Studio Solution&lt;/a&gt;. 

  &lt;br /&gt;&amp;#160;&lt;/p&gt;

&lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;
  &lt;pre style="margin: 0px"&gt;&amp;lt;&lt;span style="color: #cc7832"&gt;CustomAction&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt; Id=&amp;quot;&lt;span style="color: #a5c25c"&gt;Muhimbi.SharePoint.DocumentConverter.PDF.Ribbon.Documents.Copies.Controls.PDFConversion.Action&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt; Location=&amp;quot;&lt;span style="color: #a5c25c"&gt;CommandUI.Ribbon&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt; RegistrationType=&amp;quot;&lt;span style="color: #a5c25c"&gt;ContentType&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt; RegistrationId=&amp;quot;&lt;span style="color: #a5c25c"&gt;0x0101&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt; &amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160; &amp;lt;&lt;span style="color: #cc7832"&gt;CommandUIExtension&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color: #cc7832"&gt;CommandUIDefinitions&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color: #cc7832"&gt;CommandUIDefinition&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Location=&amp;quot;&lt;span style="color: #a5c25c"&gt;Ribbon.Documents.Copies.Controls._children&lt;/span&gt;&amp;quot;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color: #cc7832"&gt;Button&lt;/span&gt; Id=&amp;quot;&lt;span style="color: #a5c25c"&gt;Muhimbi.SharePoint.DocumentConverter.PDF.Ribbon.Documents.Copies.Controls.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;                    PDFConversion.Button&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Command=&amp;quot;&lt;span style="color: #a5c25c"&gt;Muhimbi.SharePoint.DocumentConverter.PDF.Ribbon.Documents.Copies.Controls.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;                         PDFConversion.Button.Comma&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;nd&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Image16by16=&amp;quot;&lt;span style="color: #a5c25c"&gt;/_layouts/images/Muhimbi.PDFConverter/pdf16.gif&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Image32by32=&amp;quot;&lt;span style="color: #a5c25c"&gt;/_layouts/images/Muhimbi.PDFConverter/pdf32.gif&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; LabelText=&amp;quot;&lt;span style="color: #a5c25c"&gt;$Resources:ecb_title;&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Sequence=&amp;quot;&lt;span style="color: #a5c25c"&gt;11&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TemplateAlias=&amp;quot;&lt;span style="color: #a5c25c"&gt;o1&lt;/span&gt;&amp;quot; /&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;span style="color: #cc7832"&gt;CommandUIDefinition&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;span style="color: #cc7832"&gt;CommandUIDefinitions&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color: #cc7832"&gt;CommandUIHandlers&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color: #cc7832"&gt;CommandUIHandler&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Command=&amp;quot;&lt;span style="color: #a5c25c"&gt;Muhimbi.SharePoint.DocumentConverter.PDF.Ribbon.Documents.Copies.Controls.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;                 PDFConversion.Button.Comma&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;nd&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CommandAction=&amp;quot;&lt;span style="color: #a5c25c"&gt;javascript:window.location='{SiteUrl}/_layouts/Muhimbi.PDFConverter/&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;                       Convert.aspx?&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;ListId={ListId}&lt;/span&gt;&amp;amp;amp;&lt;span style="color: #a5c25c"&gt;ItemId={ItemId}&lt;/span&gt;&amp;amp;amp;&lt;span style="color: #a5c25c"&gt;Source=' + &lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;                       window.location&lt;/span&gt;&amp;quot;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; EnabledScript=&amp;quot;&lt;span style="color: #a5c25c"&gt;javascript:function singleEnable()&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var items = SP.ListOperation.Selection.getSelectedItems();&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var ci = CountDictionary(items);&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return (ci == 1);&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #a5c25c"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; singleEnable();&lt;/span&gt;&amp;quot; /&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;span style="color: #cc7832"&gt;CommandUIHandlers&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160; &amp;lt;/&lt;span style="color: #cc7832"&gt;CommandUIExtension&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;lt;/&lt;span style="color: #cc7832"&gt;CustomAction&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p align="center"&gt;&lt;em&gt;Custom Action for the PDF Conversion button and script to only allow a single selection&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;
  &lt;br /&gt;Note that we have wrapped some lines in the code listed above to make things more readable. When copying this code, please make sure everything between double quotes, with the exception of the &lt;em&gt;EnabledScript&lt;/em&gt; attribute, is placed on a single line.

  &lt;br /&gt;&amp;#160;&lt;/p&gt;

&lt;p align="center"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="PDF-Converter-Doclib" border="0" alt="PDF-Converter-Doclib" src="http://lh6.ggpht.com/_IgJp5HQ80aU/S55IQ_i0EcI/AAAAAAAAAN4/XjI7kyRgfoE/PDF-Converter-Doclib%5B6%5D.jpg?imgmax=800" width="602" height="277" /&gt; 

  &lt;br /&gt;&lt;em&gt;Look at our new button in the Ribbon, isn’t it shiny?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fixing visual problems&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As you may remember from &lt;a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder.html"&gt;Part 1 – Introduction / Problems installing the existing 2007 version on SP2010&lt;/a&gt;&lt;em&gt;&lt;/em&gt;, the formatting of certain page elements don’t look quite right in SharePoint 2010. The main problems were related to the vertical spacing of check boxes and additional vertical space being added between elements.&lt;/p&gt;

&lt;p&gt;After some investigation we decided that the easiest way to solve these rending problems was to add a little bit of conditional code that checks the version number of SharePoint and depending on the version output some additional CSS styles. 
  &lt;br /&gt;&lt;/p&gt;

&lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;
  &lt;pre style="margin: 0px"&gt;&lt;span style="color: silver"&gt;&amp;lt;!-- Additional SP2010 Styles. Disabled by default --&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;lt;&lt;span style="color: #e8bc64"&gt;style&lt;/span&gt; id=&lt;span style="color: #a5c25c"&gt;&amp;quot;sp2010AdditionalStyles&amp;quot;&lt;/span&gt; runat=&lt;span style="color: #a5c25c"&gt;&amp;quot;server&amp;quot;&lt;/span&gt; Disabled=&lt;span style="color: #a5c25c"&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #fcf4be"&gt;.FixSP2010CheckBox&lt;/span&gt; {&lt;span style="color: #fcf4be"&gt;position&lt;/span&gt;:relative; &lt;span style="color: #fcf4be"&gt;top&lt;/span&gt;:2px}&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #fcf4be"&gt;#ctl00_PlaceHolderMain_convertersSection&lt;/span&gt; &lt;span style="color: #fcf4be"&gt;.ms-authoringcontrols&lt;/span&gt; &lt;span style="color: #fcf4be"&gt;IMG&lt;/span&gt; { &lt;span style="color: #fcf4be"&gt;display&lt;/span&gt;:none}&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #fcf4be"&gt;.FixSP2010Button&lt;/span&gt; {&lt;span style="color: #fcf4be"&gt;position&lt;/span&gt;:relative; &lt;span style="color: #fcf4be"&gt;top&lt;/span&gt;:-2px}&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;lt;/&lt;span style="color: #e8bc64"&gt;style&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;... Irrelevant code removed&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;lt;&lt;span style="color: #e8bc64"&gt;asp&lt;/span&gt;:&lt;span style="color: #e8bc64"&gt;Button&lt;/span&gt; id=&lt;span style="color: #a5c25c"&gt;&amp;quot;btnTestServer&amp;quot;&lt;/span&gt; Text=&lt;span style="color: #a5c25c"&gt;&amp;quot;Test&amp;quot;&lt;/span&gt; OnClick=&lt;span style="color: #a5c25c"&gt;&amp;quot;btnTestServer_OnClick&amp;quot;&lt;/span&gt; &lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;class=&lt;span style="color: #a5c25c"&gt;&amp;quot;ms-ButtonHeightWidth FixSP2010Button&amp;quot;&lt;/span&gt; style=&lt;span style="color: #a5c25c"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #fcf4be"&gt;width&lt;/span&gt;:80px&lt;span style="color: #a5c25c"&gt;&amp;quot;&lt;/span&gt; runat=&lt;span style="color: #a5c25c"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;... Irrelevant code removed&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;lt;&lt;span style="color: #e8bc64"&gt;wssawc&lt;/span&gt;:&lt;span style="color: #e8bc64"&gt;InputFormCheckBox&lt;/span&gt; ID=&lt;span style="color: #a5c25c"&gt;&amp;quot;chkAllowWordProcessing&amp;quot;&lt;/span&gt; CssClass=&lt;span style="color: #a5c25c"&gt;&amp;quot;FixSP2010CheckBox&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; LabelText=&lt;span style="color: #a5c25c"&gt;&amp;quot;Word Processing (e.g. MS-Word, RTF, TXT)&amp;quot;&lt;/span&gt; runat=&lt;span style="color: #a5c25c"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;lt;&lt;span style="color: #e8bc64"&gt;wssawc&lt;/span&gt;:&lt;span style="color: #e8bc64"&gt;InputFormCheckBox&lt;/span&gt; ID=&lt;span style="color: #a5c25c"&gt;&amp;quot;chkAllowSpreadsheets&amp;quot;&lt;/span&gt; runat=&lt;span style="color: #a5c25c"&gt;&amp;quot;server&amp;quot;&lt;/span&gt; CssClass=&lt;span style="color: #a5c25c"&gt;&amp;quot;FixSP2010CheckBox&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; LabelText=&lt;span style="color: #a5c25c"&gt;&amp;quot;Spreadsheets (e.g. Excel, CSV)&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;... etc&lt;/pre&gt;
&lt;/div&gt;

&lt;p align="center"&gt;&amp;#160;&lt;em&gt;Changes to the ASPX Application page (Relevant fragments only)&lt;/em&gt;&lt;/p&gt;

&lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;
  &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Resolve the differences between SharePoint 2007 and 2010&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #cc7832"&gt;private&lt;/span&gt; &lt;span style="color: #cc7832"&gt;void&lt;/span&gt; FixSharePointDifferences()&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;{&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;int&lt;/span&gt; spVersion = &lt;span style="color: #ffc66d"&gt;SPFarm&lt;/span&gt;&lt;span style="font-weight: normal"&gt;.Local.BuildVersion.Major;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;if&lt;/span&gt; (spVersion == &lt;span style="color: #6897bb"&gt;12&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** SharePoint 2007&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sp2010AdditionalStyles.Disabled = &lt;span style="color: #cc7832"&gt;true&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #cc7832"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;// ** SharePoint 2010&lt;/span&gt;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sp2010AdditionalStyles.Disabled = &lt;span style="color: #cc7832"&gt;false&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

  &lt;pre style="margin: 0px"&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p align="center"&gt;&lt;em&gt;Changes to the Code Behind file. Invoke this method from the page’s OnLoad&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160; &lt;br /&gt;With these changes in place the screens suddenly look a lot better in SharePoint 2010. As the style changes are not active in SharePoint 2007 everything continues to work fine in that environment as well.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="SP2010-After-Fixing" border="0" alt="SP2010-After-Fixing" src="http://lh6.ggpht.com/_IgJp5HQ80aU/S55IRiElnXI/AAAAAAAAAN8/AXUk6NisHvs/SP2010-After-Fixing%5B5%5D.jpg?imgmax=800" width="690" height="332" /&gt;

  &lt;br /&gt;&lt;em&gt;SharePoint 2010 look and feel before and after fixing visual problems &lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Miscellaneous changes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In addition to some minor code changes, the addition of the &lt;em&gt;DynamicMasterPageFile&lt;/em&gt; attribute is worth mentioning as well. By replacing the &lt;em&gt;MasterPageFile&lt;/em&gt; attribute - in Application Pages hosted inside a site collection - with DynamicMasterPageFile, the Quick Access menu is magically added to the left of the page. The absence of this menu in previous SharePoint versions has always been a pet peeve to me.&lt;/p&gt;

&lt;p&gt;Note that this new attribute is incompatible with SharePoint 2007. Therefore a copy of the ASPX file with the &lt;em&gt;MasterPageFile&lt;/em&gt; attribute replaced with &lt;em&gt;DynamicMasterPageFile&lt;/em&gt; will need to be placed in the &lt;em&gt;shadow SPHive_2010&lt;/em&gt; folder. We tried setting this value manually (via reflection) in the page’s PreInit event, but that resulted in the SharePoint 2010 page being rendered in the SharePoint 2007 look and feel.

  &lt;br /&gt;&amp;#160;&lt;/p&gt;

&lt;div style="padding-bottom: 6px; padding-left: 6px; padding-right: 6px; font-family: consolas; background: black; color: white; font-size: 8pt; font-weight: bold; padding-top: 6px"&gt;
  &lt;pre style="margin: 0px"&gt;&lt;span style="color: #6897bb"&gt;&amp;lt;%&lt;/span&gt;@ &lt;span style="color: #e8bc64"&gt;Page&lt;/span&gt; Language=&lt;span style="color: #a5c25c"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt; DynamicMasterPageFile=&lt;span style="color: #a5c25c"&gt;&amp;quot;~masterurl/default.master&amp;quot;&lt;/span&gt; &lt;br /&gt;         Inherits=&lt;span style="color: #a5c25c"&gt;&amp;quot;Muhimbi.SharePoint.DocumentConverter.PDF.Convert&amp;quot;&lt;/span&gt; &lt;span style="color: #6897bb"&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Continue to &lt;a href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_17.html"&gt;Part 4 – Updating deployment scripts&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&lt;font color="#ffffff"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5787751540548761056-5188841634079824134?l=blog.muhimbi.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.muhimbi.com/feeds/5188841634079824134/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_15.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/5188841634079824134" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787751540548761056/posts/default/5188841634079824134" /><link rel="alternate" type="text/html" href="http://blog.muhimbi.com/2010/03/porting-sharepoint-2007-wspbuilder_15.html" title="Porting a SharePoint 2007 WSPBuilder solution to SharePoint 2010 – Part 3" /><author><name>Muhimbi</name><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry></feed>
