Last post Oct 18, 2016 07:58 AM by Cathy Zou
Oct 17, 2016 07:50 AM|rogue1|LINK
I am trying to convert a document using apose pdf but I am having an issue with my stream which is plain .net code it appears to be timming out when going to a file server on our azure network
string pathtoCreate = documentServer + ivaCode.ToString() + " " + fullname.ToString() + @"\";
Log.Info("Before Save File to server ");
Log.Info("After Save File to server filename=" + saveAsFileName);
Aspose.Words.License license = new Aspose.Words.License();
// Open the stream.
string mystream = saveAsFileName;
Stream stream = File.OpenRead(mystream);
Log.Info("After Stream File to server filename=" + mystream);
// Open the document. Note the Document constructor detects HTML format automatically.
// Pass the URI of the base folder so any images with relative URIs in the HTML document can be found.
LoadOptions loadOptions = new LoadOptions();
loadOptions.LoadFormat = LoadFormat.Rtf;
Document doc = new Document(stream, loadOptions);
Log.Info("Before Output to pdf filename=" + outputFileNamePdf);
When I hover over the vairable stream I am presented with the following i have notied on other forum posts that this is not an issue however I seem to be having a lag problem in that the stream is not finished before the conversation process needs to happen
You see the two errors on the read time out and the write time out
Oct 17, 2016 05:09 PM|codemovement.pk|LINK
Please see the below example by using aspose API and it works like a charm.
internal byte ConvertRightNowAspose(byte aDocument, SaveFormat saveFormat)
Aspose.Words.Document doc = new Aspose.Words.Document(new MemoryStream(aDocument));
doc.PageColor = Color.White; // doc files are saved with red background on the server, changing to white anyway
using (MemoryStream firstStream = new MemoryStream())
if (saveFormat == SaveFormat.Html)
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.Html);
options.ImageSavingCallback = new HandleImageSaving();
public class HandleImageSaving : IImageSavingCallback
void IImageSavingCallback.ImageSaving(ImageSavingArgs e)
e.ImageStream = new MemoryStream();
e.KeepImageStreamOpen = false;
Please try to utilize it and it works like a charm. If problem still exist please share your document with me so that I can try on my machine and sort out the issues.
Oct 17, 2016 05:26 PM|rogue1|LINK
This is not relavant to stream the way i am working with it im converting a file to pdf not creating a new word document !!!1 next time read the dam source and stop trying to answer every question on a forum this is twice today answers not relavant.
Oct 18, 2016 07:58 AM|Cathy Zou|LINK
According to official document, The ReadTimeout property should be overridden to provide the appropriate behavior for the stream. If the stream does not support timing out, this property should raise an InvalidOperationException.
WriteTimeout property is some as ReadTimeout.