Free Support Forum - aspose.com

Aspose.Words open Word Doc fails

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


This message was posted using Page2Forum from Convert Word documents to PDF - Aspose.Pdf for .NET

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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.

Best regards.

Hi,

the code its trying to run is as follows;

var destinationPdf = new MemoryStream();

_builder.Document.SaveToPdf(0, _builder.Document.PageCount, destinationPdf, null);

destinationPdf.Seek(0, SeekOrigin.Begin);

return destinationPdf;

It fails on the SaveToPdf command with the error exception which is attached

I've done some further investigation ;

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.

Does this sound reasonable?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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.

Best regards.

Hi Alexey,

I had assumed that the issue was fixed but it has occured again - it seems to be intermittent.

Please find copy of doc attached.

Regards

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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?

Best regards,

Hi,

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.

It is this which seems to fail intermittently.

Also, I have upgraded to use Aspose.Words 8.2.1

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. If you need just to send the generated PDF document directly into the client’s browser, you can use the following code:

doc.Save("out.pdf", SaveFormat.Pdf, SaveType.OpenInApplication, Response);

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/save-a-document.html

Hope this helps.

Best regards.

Thanks, but this needs to be passed from another tier.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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.

Best regards.

A fix for the issue(s) you've reported (filed as 7626) will be released in the next release at the end of this month. You will be notified.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(5)

The issues you have found earlier (filed as WORDSNET-2103) have been fixed in this .NET update and in this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(60)