15

I have XPS documents being generated from XAML User Controls that act as templates. I want to convert the XPS documents into alternative formats, mainly PDF, programmatically with a .NET based API.

What is the best way to do this?

markti
  • 2,783
  • 1
  • 23
  • 30
  • For an open-source solution, see this [question](http://stackoverflow.com/questions/14162392/programmatically-print-to-a-pdf-printer). Hope this helps someone – killaJewl Jan 07 '13 at 18:05

5 Answers5

6

You can also use ABCpdf PDF Component for .NET . Version 7 can serve your purpose. see http://www.websupergoo.com/abcpdf-12.htm.

it provides fully functional trial version unlike NiXPS and almost equally as fast as NiXPS.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
  • Alas, we already purchased NiXPS, but NiXPS trial seemed fully functional aside from the red "TRIAL" that was on all my documents :-) The only technical issue we have with it is when constructing PDFs from a XPS byte[] you need to create a buffer larger than the expected PDF byte[] array you are generating...kind of lame... but you can work around it – markti Aug 12 '09 at 17:38
  • Our trial version is indeed fully functional - aside from the trial watermark on output. markti: could you contact our support people about the that buffer issue – nixps Aug 24 '09 at 07:40
  • already have, they said they would look into enhancing that operation – markti Sep 25 '09 at 13:15
  • AbcPdf is great. It correctly handles CMYK color space and complex scripts (right to left), what I found in no other converter I've tried. Great product! – Alireza Sep 22 '13 at 17:54
3

The way I have done this in the past is print my XPS file to a PDF printer. I use cutePDF for this. So when you select to print, you print to cutePDF which prints a PDF version.

I am not sure if this will meet your needs but it has worked well for me in the past.

northpole
  • 10,244
  • 7
  • 35
  • 58
  • 1
    I am looking for a way to do this programmatically using a .NET based API. – markti Jun 16 '09 at 20:10
  • This works, and is free, it can also be automated programmatically. Just beware, that this method messes with CMYK color values, if you have them in your xps file. If this is important for you, try a converter API (like abcpdf or nixps) above. – Alireza Sep 22 '13 at 18:08
2

If you have OneNote, you can print to OneNote and then export as PDF at least in OneNote 2013. This seems better than having to install another third party tool.

Engineer2021
  • 3,288
  • 6
  • 29
  • 51
1

After much searching, I found this SDK:

NiXPS

Its kindof expensive but works wonderfully. Goodbye fop!

markti
  • 2,783
  • 1
  • 23
  • 30
  • NiXPS seems a bit outdated. The latest News on their site is from 2010. The home page is just a view into the blue sky. – DrMarbuse Dec 08 '15 at 08:59
0

If you want to do this in your own program, CloudConvert has a free and open source API built on the .NET framework by MadScripter.

https://github.com/MadScripter/CloudConvert-.NET-Wrapper/

CaffeineToCode
  • 830
  • 3
  • 13
  • 25