Hi,
in an MVC C# app I sometimes (not always) when opening a Word Doc into Aspose get a permissions error.
Can you suggest some things I might try/look into to try to solve this issue, please?
Thanks
Thanks for your request. It is difficult to say what can cause the problem. Does the issue occurs with some specific document or randomly with different documents? If this occurs with some specific document, please attach it here for testing.
Do you read documents from disk? If so, maybe there could be something wrong with read permissions.
First I tried saving to Word Doc format instead - which works.
After a piece of inspiration I recalled our company uses a non-Windows-standard font in a lot of documents, so I changed the font in the original Word document and PDF generation now works!
So presumably the PDF save cannot cope with embedded fonts which have not been installed on the target PC whereas the Word save version can.
Thanks for your request. Unfortunately, Aspose.Words does not support embedded fonts upon rendering. Fonts used in the document should be installed on your PC. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
But anyways, Aspose.Words should not throw and exception, it should just use alternative font if it cannot find some specific font.
Also, could you please attach font and document, which cause the problem here for testing? I will check them on my side and provide you more information.
Thank you for additional information. I cannot reproduce the problem with your document on my side using the latest version of Aspose.Words (8.2.1). I use the following code for testing:
Document doc = new Document("WMS+Modeller+Template+NEW.doc");
doc.SaveToPdf("out.pdf");
Also, could you please attach “Frutiger 55 Roman” font here for testing?
I had previously found that using the SaveToPDF to generate a file works fine, but I want to generate a Stream to pass down to the Web Browser as this is a Web application.
Thanks for your request. I tried saving your document as PDF into a stream and it seems all works fine. Here is code I used for testing:
// Open document.
Document doc = new Document(@"Test001\WMS+Modeller+Template+NEW.doc");
// Save document as PDF into stream.
using (MemoryStream pdfStream = new MemoryStream())
{
doc.SaveToPdf(0, doc.PageCount, pdfStream, null);
// For testign purposes save content of stream into a file.
using (FileStream pdfFile = File.Create(@"Test001\out.pdf"))
pdfStream.WriteTo(pdfFile);
}
Could you please create simple code, which will allow me to reproduce the problem or provide step-by-step manual how I can reproduce the problem on my side? I will check the problem and provide you more information.