We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert XPS to Word doc

Hello. We are currently using Aspose toconvert Word documents to XPS, and were wondering if any of the existing Aspose products provide functionality to convert the xps document back to a Word doc format.


Thanks in advance for your answers.

Hi
Paul,


Thanks for your inquiry. I am afraid, none of Aspose products provide the functionality of loading/importing XPS files as due to the internal format of .XPS document, it’s extremely hard for any program to load these files in for conversion. Moreover, you can think of .XPS file as being “flattened” in a sense, all of the text, lines and pictures are stored in a pure uneditable format making it near impossible to import the data without manually scanning the document and recognising the texts and paragraphs etc back into an editable form e.g. Word format.

If we can help you with anything else, please feel free to ask.

Best Regards,

Hi


Thank you for your interest in Aspose components. Awais is right none of Aspose products allows converting XPS to DOC. But i would like to clarify a bit, the difficulty in such conversion is not reading XPS documents. XPS is quite easy format to read. But the main problem is that DOC format is flow format, and XPS is fixed page. This means that in XPS all elements are absolutely positioned. But if you want to get “editable” Word document, this document should not contain absolutely positioned elements otherwise the document will be very hard to edit.

Best regards,

Thank you Alexey for your answer. Could you please elaborate on your answer just a little bit? I understand XPS can’t be loaded by the Aspose.Words engine for editing, but is there another engine I can use to render the pages into JPEG or MTIFF?


Thank you so much!

Hi Michael,


Thanks for your inquiry. You can achieve this using Aspose.Pdf for .NET API. First you need to perform XPS to PDF conversion. Please see the following code:

// instantiate LoadOption object using XPS load option
Aspose.Pdf.LoadOptions options = new XpsLoadOptions();
//create documetn object
Aspose.Pdf.Document document = new Aspose.Pdf.Document(myDir + “t.xps”, options);
// save the resultant PDF document
document.Save(myDir + “resultant_evaluation.pdf”);

Then you need to convert this PDF file to images. Please see the following code:

//Open document
Document pdfDocument = new Document(“input.pdf”);

for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{
using (FileStream imageStream = new FileStream(“image” + pageCount + “.png”, FileMode.Create))
{
//create PNG device with specified attributes
//Width, Height, Resolution, Quality
//Quality [0-100], 100 is Maximum
//Create Resolution object
Resolution resolution = new Resolution(300);
PngDevice pngDevice = new PngDevice(resolution);

//Convert a particular page and save the image to stream
pngDevice.Process(pdfDocument.Pages[pageCount], imageStream);

//Close stream
imageStream.Close();

}
}

I hope, this helps.

Best regards,

perfect! thanks!!