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

Free Support Forum - aspose.com

Saving an Adobe Reader PDF as Microsoft Word DOC


We're using Aspose.Words successfully to do replacement and reformatting, and it's working very well. Elsewhere in the system, we're using Aspose.Pdf ( to convert PDF to DOC format, and this is causing an issue.

Here's some sample code I'm using as a test:

// Get the PDF from a SharePoint wrapper service (using a Guid) as a byte stream.
using (MemoryStream inputdocumentStream = new MemoryStream(clientService.GetPrecedentDocumentContent(documentToMerge)))
// Test 1: return the incoming stream as a PDF file to ensure it is valid.
return inputdocumentStream.ToArray();

// Create an Aspose.Pdf document from the stream.
Pdf.Document inputPdfDocument = new Pdf.Document(inputdocumentStream);

// Test 2: save the stream as a DOC file.
inputPdfDocument.Save("C:\\MyNewPdf.doc", Pdf.SaveFormat.Doc);

// Test 3: send the Word format output to a memory stream.
using (MemoryStream outputPdfToWordStream = new MemoryStream())
inputPdfDocument.Save(outputPdfToWordStream, Pdf.SaveFormat.Doc);
thisDocument = new Words.Document(outputPdfToWordStream);

Test 1 returns the incoming PDF directly to the Internet Explorer 8, and is opened correctly. So the PDF is returned intact from the service. It is a two page document.

Test 2 saves the PDF as a Word file. The result is a valid Word document, but the contents are incorrect: page 2 appears three times; page 1 is lost.

Test 3 returns the following error:

[Aspose.Words.FileCorruptedException] "The document appears to be corrupted and cannot be loaded"

The InnerException is "Cannot access a closed Stream".

I also note that if I examine the inputPdfDocument object, the "OpenAction" property is set to:

'inputPdfDocument.OpenAction' threw an exception of type 'System.NullReferenceException'

My question is: is it possible to convert a PDF to DOC using memory streams? I see code elsewhere on your site, but that is for files only, not streams. Is what I'm attempting to do here possible?

Any help would be much appreciated,


Hi John,

Thanks for your interest in our products.

I am sorry to inform you that PDF to DOC conversion using streams is currently not available in Aspose.Pdf for .NET. However, I have logged a new feature request as PDFNEWNET-33486 in our issue tracking system. Our development team is looking into this feature and you will be updated via this forum thread once it is supported.

We apologize for your inconvenience.

Thanks & Regards,

The issues you have found earlier (filed as PDFNEWNET-33486) have been fixed in Aspose.Pdf for .NET 8.3.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.