This project has moved. For the latest updates, please go here.

Can I use this to automate docx -> pdf on a server?

Feb 17, 2015 at 7:35 PM
I want to set up a server running IIS/.net that will automatically look for .docx files on the server and convert them into .pdf files. Is this going to be possible? And what MS Word licence will I need?

I'm using .net 4 and I have an office 365 account.
Feb 18, 2015 at 9:42 AM
Actually, that wasn't the clearest question, let me clarify:

I want to set up a Windows Service that will be permanently running. It will look for any new DOCX files in certain folders every 30 seconds, and automatically make a PDF from them.

Is this going to be possible?
Coordinator
Feb 19, 2015 at 11:19 AM
Edited May 5, 2015 at 10:50 AM
Hi

Short answer, yes. Longer answer, yes, but you should take care.

Firstly, Office was never designed to be run un-attended, and Microsoft specifically recommends not running Office in a server context because it may well pop up dialog boxes and generally request user input at unexpected times. There may be cases where a single document could block your service because of a dialog box has popped up requiring someone to press "OK". If you're going to run as a service, ensure you have some means to check for it being blocked.

Secondly, you need to ensure your service runs as a user with a Desktop and sufficient permissions to start Office - see http://www.timwappat.info/post/2013/09/03/Solution-to-Excel-Automation-VBNETC-error-running-as-a-service-0x800A03EC-MicrosoftOfficeInteropExcelWorkbooksOpen

Thirdly, consider the security of your server. If you're accepting doc/docx/docm files from un-trusted sources (or trusted ones for that matter), you need to understand that Word will be starting up and running on the documents you feed it. Office can be vulnerable to attacks caused simply by opening a document (e.g. https://technet.microsoft.com/library/security/MS15-012). You should consider virus scanning, and a regular patch policy for your server.

Finally licensing. OfficeToPDF will work as long as you have a full copy if the needed Office applications installed (e.g. Word.exe to convert doc, docx and docm files). The Office licensing restrictions for different versions of Office 365 and Office 2013 vary depending on how you intend to use the products and in what context. Microsoft's licensing restrictions can be somewhat arcane, and really the only people that can advise you are Microsoft. Read the EULA and small print on your 365 subscription and determine if how you want to use OfficeToPDF/Office meets the requirements. http://www.microsoft.com/licensing/about-licensing/product-licensing-faq.aspx may (or may not) be of help.


Regards
Vittal
Marked as answer by cognidox on 5/5/2015 at 2:51 AM
Feb 19, 2015 at 12:59 PM
Thanks very much for your help!

I'll start with a console app to test it out, and move on to putting this in a web service later.