How to get Presentation from a direct link?

Hi Team,

I wanted to know how can I get the pptx presentation from a website link where it is stored.

Regards,
Priti

Hi Priti,

Thanks for your interest in Aspose.Slides.

I like to share that you can access the presentation shared on any web link by downloading it in stream using source URL. Then you may use Aspose.Slides to load presentation as stream. Please use the following code snippet in this regard. Please share, if I may help you further in this regard.

public static void LoadPresentationfromURL()

{

// Sample Url

string PPTXUrl = @“http://dl.dropbox.com/u/72783084/demo.pptx”;

MemoryStream PPTXMemoryStream;

System.Net.WebClient client = new System.Net.WebClient();

try

{

PPTXMemoryStream = new MemoryStream(client.DownloadData(PPTXUrl));

}

finally

{

client.Dispose();

}

PPTXMemoryStream.Position = 0;

PresentationEx pres = new PresentationEx(PPTXMemoryStream);

pres.Save(“D:\Temp.pptx”, Aspose.Slides.Export.SaveFormat.Pptx);

pres.Save(“D:\Temp.pdf”, Aspose.Slides.Export.SaveFormat.Pdf);

}

Many Thanks,

Hi Mudassir,

Thanks a lot for your reply. I tried this code snippets it works for the link you provided but when I try to use my link it gives me the following error:

body {font-family:“Verdana”;font-weight:normal;font-size: .7em;color:black;}
p {font-family:“Verdana”;font-weight:normal;color:black;margin-top: -5px}
b {font-family:“Verdana”;font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:“Verdana”;font-weight:normal;font-size:18pt;color:red }
H2 { font-family:“Verdana”;font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:“Lucida Console”;font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

The remote server returned an error: (401) Unauthorized.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The remote server returned an error: (401) Unauthorized.

The link I am using when I directly enter it in IE it opens up, so the link is fine then why I am getting the above error. Can you please help me in this.

Regards,
Priti Shetty

Hi Priti,


I have observed the issue shared and it is in fact not an issue with Aspose.Slides. This is basically some authentication issue on your end while accessing the URL using your application. I may suggest you to kindly try some other link or you may google it for possible resolution.

Many Thanks,