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

Free Support Forum - aspose.com

Unable to Convert HTML Input Stream to PowerPoint Format

Hi, I am trying to convert html input stream to pptx format, but I am seeing the following error

Convert failed - class com.aspose.slides.PptUnsupportedFormatException: Unknown file format. —> class com.aspose.slides.internal.da.int: Unknown file format._com.aspose.slides.internal.da.if.else(Unknown Source)_com.aspose.slides.internal.da.if.(Unknown Source)_com.aspose.slides.internal.da.new.new(Unknown Source)_com.aspose.slides.internal.da.new.for(Unknown Source)_com.aspose.slides.internal.da.new.(Unknown Source)_com.aspose.slides.internal.da.goto.do(Unknown Source)_com.aspose.slides.internal.da.goto.(Unknown Source)_com.aspose.slides.akd.if(Unknown Source)_com.aspose.slides.Presentation.do(Unknown Source)_com.aspose.slides.Presentation.if(Unknown Source)_com.aspose.slides.Presentation.(Unknown Source)_com.aspose.slides.Presentation.(Unknown Source)_sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)_sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

using the following code for the conversion

InputStream inputStream = new ByteArrayInputStream(temp.getBytes());
Presentation presentation = new Presentation(inputStream);
presentation.save(FILE_ABSOULTE_PATH + fileName + EXTENTION_PPT, SaveFormat.Ppt);

@rgutta,
Thank you for contacting support.

You can import the HTML document to a presentation. You should use the AddFromHtml method from the ISlideCollection interface as shown below:

var presentation = new Presentation();
var htmlStream = new FileInputStream("example.html");
presentation.getSlides().addFromHtml(htmlStream);
presentation.save("output.pptx", SaveFormat.Pptx);
presentation.dispose();
1 Like

Hi

I have tried the above approach but its only but the output presentation only contains text but does not have images. I have attached the html file I am using.Untitled-1.zip (481 Bytes)

@rgutta,
I am checking the problem you described and will get back to you soon.

@rgutta,
I’ve reproduced the problem with missing the image when importing the HTML document to a presentation and added a ticket with ID SLIDESJAVA-39091 to our issue-tracking system. We apologize for any inconvenience. Our development team will investigate the case. You will be notified when a new release of Aspose.Slides with a fix is published.

Hi Andrey,

Any update on the above issue.

@rgutta,
An investigation of the issue has been scheduled for the week 2023/06. Thank you for your patience.