ASP.NET C# - How to convert Office files to PDF using SyncFusion File Formats & Essential Studio A great third-party alternative to Office.Interop to programmatically create PDF out of MS Office Word, Excel and/or Powerpoint files

ASP.NET C# - How to convert Office files to PDF using SyncFusion File Formats & Essential Studio

A few months ago I've written a post here explaining how to programmatically convert MS Word DOC and DOCX files to PDF in ASP.NET C# using the Microsoft Office primary interop assemblies (PIAs), aka Microsoft Office Interop.

Although that method does indeed work well, it also comes with a fair amount of issues - notably two:

  • There's an high chance that you'll run into DCOM issues and/or permission errors when publishing your project into a Windows Server + IIS production machine: I wrote a dedicated post to fix / address them, but these are nasty issues that will most likely drain some of your valuable time.
  • As you most likely already know, Office Interop works using the actual MS Office apps in background: it's basically a server-side automation of the MS Office installed on the server machine. Unfortunately, such kind of technique isn't really supported by Microsoft, as brillantly explained in this official post.

For all the above reasons, whenever you need to build a stable and reliable Office-to-PDF microservice, relying to a third-party library that supports such kind of automated tasks would most likely bring better performance and overall results to your project(s).

Introducing SyncFusion

I ran into SyncFusion roughly 8 months ago, when I was looking for an automation tool who could help me converting a huge amount of DOC, DOCX, XLS and XLSX files in real-time: well, as a matter of fact, I already did that using Office Interop (see above), but my users had often hard times with the long queues which I was forced do put because... well, you might already know why: one of the sad things of MS Office automation is that the server can't handle more than a single instance of each Office app at a time, otherwise you will definitely ran into thread concurrency issues, such as Word and/or Excel threads pending on the activity monitor... you know how it is.

Well, long story short, I started looking for an alternative and - after a couple attempts I ended up not being satisfied with - I stopped by the SyncFusion website, where I was able to download the free SyncFusion File Format package trial for ASP.NET MVC.

After the install, I was quickly able to replace my old Interop-based code with the following:

Right after that I unit-tested it, ran few checks on my development machine and then pushed everything on my testing servers to see if the new code would have performed well also on a production machine: much to my surprise, it started running smoothly at the first attempt, without having to mess with any DCOM and/or permission setting.

Before bringing everything into production I also added a switch clause to handle the Excel xls & xlsx files, which are handled in the same exact way using the Syncfusion.ExcelToPdfConverter namespace.

In case you need additional info with the actual implementation of SyncFusion File Format library packages, you can take a look at the SyncFusion File Formats API.

Licensing Plans

Right before pushing everything on my live servers, I visited the SyncFusion license page to take a look at their licensing plans: to my great surprise I noticed that they were offering a Community License for organizations earning up to $1M in U.S. revenue and employing fewer than five developers (as a matter of fact, they still do!). Such licensing model was perfect for my tests and also for my microservice. Therefore, I had the chance to download the whole SyncFusion Essential Studio package, which also contains more than 800 web, desktop and mobile controls that I slowly started to add to my projects as well.

In case your organization and/or your project don't meet the requirements for the Community Edition, you can still choose between getting the Developer Platform Essential Studio, which will cover a single developer (for $ 1,995) or the Unlimited Global License, which will cover everyone in your organization (prices may vary).

Conclusion

I can only recommend SyncFusion File Formats and SyncFusion Essential Studio, not only for their great set of tools yet also for their great licensing plan and the philosophy behind their Community Edition license: it's really refreshing to see that there still are companies that supports the developers with their valuable products. I was so curious about the reasons behind such move that I looked at their Community License FAQs, and... guess what I have found?

Why are you doing this? What's the catch?

 

We loved what Microsoft did with Visual Studio Community Edition and decided to extend it to our products as well. There is no catch, but we would really appreciate it if you help spread the message through Twitter, Facebook, and Google+.

Being a Microsoft MVP for Developer Technologies, I couldn't be more happy to see that the Visual studio Community Edition - which is IMHO one of the best moves Microsoft ever made - is still being a great source of inspiration for third-party companies. My sincere thanks to SyncFusion for keep doing this!

That's it for now: happy coding!

 

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.