Powerpoint & pdf conversion (bis)


#1

Hi,

I have the same problem and I need to feedback quickly my Customer about that.

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

Lorenzo


#2

Dear Lorenzo,

Please check my answer in the Aspose.Pdf forum:
http://www.aspose.com/forums/ShowPost.aspx?PostID=15004


#3

Tanks,

Just an other problem, I need to get document (word and powerpoint) from a Web Application and join all the document. I have a problem opening a ppt document from the Stream. I you look the code, I use the same stream for word and PowerPoint, for Word works but for PowerPoint there is an error: “Unable to read entire block; 110 bytes read; expected 512 bytes”.

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

Lorenzo

public Stream GetFromHttp(String docUrl)

{

Stream outStream = new MemoryStream();

byte[] buffer = new byte[4096];

WebRequest wr = WebRequest.Create(docUrl);

MemoryStream ms = new MemoryStream();

WebResponse response = wr.GetResponse();

using(Stream responseStream = response.GetResponseStream())

{

int count = 0;

do

{

count = responseStream.Read(buffer, 0, buffer.Length);

ms.Write(buffer, 0, count);

} while(count != 0);

}

ms.Seek(0,SeekOrigin.Begin);

//word

if (response.ContentType.IndexOf("word") != -1)

{

Document wordDoc= new Document(ms);

wordDoc.Save(outStream, Aspose.Word.SaveFormat.FormatAsposePdf);

}

//powerpoint

if (response.ContentType.IndexOf("powerpoint") != -1 )

{

Aspose.PowerPoint.Presentation pppDoc = new Aspose.PowerPoint.Presentation(ms);

int i=0;

foreach (Slide slide in pppDoc.Slides)

{

System.Drawing.Image img = slide.GetThumbnail(1,1);

//todo new word document with pptThumbnail

}

}

//pdf

if (response.ContentType=="application/pdf")

{

Aspose.Pdf.Kit.PdfFileEditor pdfDoc = new PdfFileEditor();

//TODO ??

}

response.Close();

return outStream;

}


#4

Dear Lorenzo,

Error “Unable to read…” can be only in 2 situations.
1. You try to read not PowerPoint document.
2. Presentation is broken.