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

Free Support Forum - aspose.com

Sharepoint doc to pdf

Looking to convert docx to pdf in a sharepoint workflow and would like to know if there are any examples around.

What I am looking to do is basicly take a document out of a list and convert it to a pdf. Can I just call the aspose word save comand by using the docx url and the updating the list with the stream from the conversion.


send the url to the aspose word and get a stream back and then add the stream back to the list by using the followingf roughly

Document doc = new Document(ListDocUrl)

MemoryStream dstStream = new MemoryStream();
doc.Save(dstStream, SaveFormat.PDF);

dstStream.Position = 0;

SPFile spf = webSite.GetFile(ListDocUrl);

spf.ParentFolder.Files.Add(spf.Name, dstStream, true)


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

Thanks for your request. Please try using the following code to open document from URL:

string url = "http://localhost/test/in.doc";

//Prepare the web page we will be asking for

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

request.Method = "GET";

request.ContentType = "application/msword";

request.UserAgent = "Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0";

//Execute the request

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

//We will read data via the response stream

Stream resStream = response.GetResponseStream();

//Write content into the MemoryStream

BinaryReader resReader = new BinaryReader(resStream);

MemoryStream docStream = new MemoryStream(resReader.ReadBytes((int)response.ContentLength));

//Create document

Document doc = new Document(docStream);

//Save document (you can also save document to stream)


Hope this helps.

Best regards.


We are delighted to announce the availability of Aspose.Words for SharePoint, which is our latest addition to the Aspose.Words product family.

This release, Aspose.Words for SharePoint 1.0 makes high quality document conversions for DOC/DOCX/ODT/RTF/PDF/XPS and others easily accessible to SharePoint users.

Please find more details in our Documentation area.

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