We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF rendering issues with files over network


I am writing a ASP.NET application that converts Word documents into PDF, merges them and then displays them in the browser. I have been successfully able to do this when the Word files are in the folders that my web pages are in. However, for our production system I will need to access these files off of a network share. When I try to open and convert the files from the share I do not get any errors but the files are not rendering correctly. I am seeing this sort of display in the browser:

%PDF-1.6 %���� 5 0 obj <> stream x�]PMo� �#�|�UJ�n��jU)�}h�~’CZrȿ���������~.���6:@���l0@���8��K�{m(a ����’a�()���ǀCm:KIUA��c�3lNʶ�Y�^�צ����I�fr�a4v�p ���U�71 Y��Ud�0o���kv�%����U8:!� �c\d���qJШG�qѵ������1�lE��^�z>��̵�2��0��’�{����N�d�� h��k;��n }?z� endstream endobj

Again, this works when the files are in the same folder or even a subfolder of where my web code is just not when they are pulled from across the network from another server. Is there any way I can handle this in my code to make the files render correctly?



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

Thanks for your inquiry. Could you please provide the code which you use to get the document across the network?

Best regards,

Here is my code:

protected void MergePDFandDisplay(string[] vwjobs)


int index = vwjobs.Length;

string reportsfolder = ConfigurationManager.AppSettings["ReportsFolder"].ToString();

SqlConnection objConn = new SqlConnection();

SqlCommand objCmd = new SqlCommand();

objConn.ConnectionString = ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString;


objCmd.Connection = objConn;

objCmd.CommandText = "select ......"

SqlDataReader rdr = objCmd.ExecuteReader();

//open the reader, get the info and close as soon as possible. We do not want to leave the db connections open.

ArrayList filePaths = new ArrayList();


filePaths.Add(reportsfolder + rdr["CustomerID"] + "\\" + rdr["Date"] + "\\" + rdr["DocumentID"]);




string[] paths = new string[index];


//declare an array list to hold our memory streams. For ASPOSE methods.

ArrayList myList = new ArrayList();

MemoryStream[] streams = new MemoryStream[index]; //size of our num of jobs

MemoryStream inStream; //for each individual job

//for each job go out and convert it to PDF. Do not write to disk. Save this into a MemoryStream

foreach (string p in paths)


//write our converted stream into our inStream variable then add it to our ArrayList

inStream = new MemoryStream(CreatePDFStream(p).GetBuffer());



//copy the array list to the MemoryStream array. Needed for the ASPOSE methods.


//Create our output stream which will hold our merged PDF

MemoryStream outStream = new MemoryStream();

//ASPOSE object to concatenate the PDF streams into our 1 single outStream MemoryStream


PdfFileEditor pdfEditor = new PdfFileEditor();

pdfEditor.Concatenate(streams, outStream);



catch(Exception e){




//Set the appropriate ContentType and wrrite the stream to the browser.

Response.ContentType = "Application/pdf";




protected MemoryStream CreatePDFStream(string faspath)


string documentid = faspath.Substring(faspath.Length - 12);

MemoryStream currstream = new MemoryStream();

Document currdoc;


currdoc = new Document(File.OpenRead(faspath)); //faspath is reading from a share such as\\sharename\folder1\folder2\WordDoc1.DOC. This works if I read from my web code folders. Such as, Server.MapPath("TemFolder\\WordDoc1.DOC") and it works.

currdoc.Save(currstream, SaveFormat.Pdf);


catch (Exception e){




return currstream;



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

Thank you for additional information. I cannot reproduce the problem on my side using the latest version Aspose.Words and Aspose.Pdf.Kit. I use the same code as you provide, my file path looks like the following @"\\\temp\1.doc". Could you please create simple application which will allow me to reproduce the problem on my side?

Best regards,