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 (188.8.131.52) 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.
// Create an Aspose.Pdf document from the stream.
Pdf.Document inputPdfDocument = new Pdf.Document(inputdocumentStream);
// Test 2: save the stream as a DOC file.
// Test 3: send the Word format output to a memory stream.
using (MemoryStream outputPdfToWordStream = new MemoryStream())
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,