I have a C# web application that pulls Word documents out of a database and converts them to PDF and appends them into one large PDF. The Word documents are stored as image files in a SQL database and converted to a byte array in C#. I instantiate a Stream object with the byte array and use the stream to instantiate a new Aspose.Words.Document.
System.IO.Stream docStream = new System.IO.MemoryStream(byteArrayOfWordDoc);
Aspose.Words.Document wordsDoc = new Aspose.Words.Document(docStream);
If the Word document that is stored in the database in marked Read-Only, I get the following error when trying to instantiate the Aspose.Words.Document class:
The document appears to be corrupted and cannot be loaded.
I can, however, separately pull this Word document from the database and view it in Word, so I know it is not corrupted. Do I get this error because the Word document is marked read-only? Is there a way to deal with read-only documents to allow me to convert it into a PDF or is this a permissions issue?
Thanks for your inquiry. Yes, Aspose.Words supports the read-only document. Please read following documentation link for your kind reference.
Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.
Thanks Tahir for your help. I believe the problem was with the document itself. I was able to append a different read-only document to the PDF.
Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.