arklumpus/VectSharp

[Question] Can I convert a XPS to a SVG with this library?

Closed this issue · 2 comments

I'm looking for a way to convert and XPS file to a SVG one.
Can I achieve this with this library ?

Hi! No, you can't open XPS files using this library. You can do it using MuPDFCore, though:

using MuPDFCore;

// Create a MuPDFContext object
using MuPDFContext ctx = new MuPDFContext();

// Open the XPS file 
using MuPDFDocument doc = new MuPDFDocument(ctx, @"path/to/file.xps");

// Page index (0 = first page)
int index = 0;

// Export the first page of the document as an SVG file
MuPDFDocument.CreateDocument(ctx, @"path/to/output.svg", DocumentOutputFileTypes.SVG, true, doc.Pages[index]);

Thanks for that ;)