I have written some code that renders and image for each slide of an imported PPT file, but the resulting jpgeg image is corrupted or ‘incomplete’, could you please direct me to an example of how this should be done properly?
I have observed your requirements. Can you please share the source presentation along with generated corrupted output with us. Please also share the sample code used to reproduce the issue. I would also recommend you to please try using latest version of Aspose.Slides for .NET on your end as well.
Sorry I cannot send you the original PPT as it is owned by the client, however I believe the fault lies in my code, not the file I am rendering images from.
Here is the sample code:
Dim importPresentation As New Aspose.Slides.Presentation(filePath) Dim saveOpts As New Aspose.Slides.SVGOptions saveOpts.JpegQuality = 100
For i As Integer = 0 To importPresentation.Slides.Count - 1 If (i + 1) > 4 Then Exit For End If Dim PageNumber As String = (i + 1).ToString If i < 10 Then PageNumber = String.Concat(“0”, PageNumber) importPresentation.Slides(i).SaveToSVG(Server.MapPath(“RenderedImages/” & fileName & “_” & PageNumber & “.jpg”), saveOpts) Next
The corrupt rendered image is attached, as requested.
Can you please explain this section of code : For i As Integer = 0 To importPresentation.Slides.Count - 1 If (i + 1) > 4 Then Exit For End If Dim PageNumber As String = (i + 1).ToString If i < 10 Then PageNumber = String.Concat(“0”, PageNumber) importPresentation.Slides(i).SaveToSVG(Server.MapPath(“RenderedImages/”
& fileName & “_” & PageNumber & “.jpg”), saveOpts) because curentely i try to generate ppt with a picture of costumer but i dont find the best way , i have always this error : Unexpected Aspose.Slides.PptException: Picture creating error. Parent of a picture can’t be a null.
this is the code if you have any idea
SqlConnection cn = new SqlConnection(“chaine de connexion”); // selection du nom de client String selectString = “SELECT nom from client”; String vName; // Create an OleDbCommand object SqlCommand cmd = new SqlCommand(selectString, cn);
cn.Open();
// Send the CommandText to the connection, and then build an OleDbDataReader SqlDataReader reader = cmd.ExecuteReader();
I have observed the code snippet shared. You are trying to save the SVG file as jpeg. This is wrong. Please try using the following sample on your end.
public static void SaveToSvg()
{
String path = “D:\Aspose Data\”;
Presentation pres = new Presentation(path + “Test.ppt”);
Aspose.Slides.SVGOptions saveOpts= new Aspose.Slides.SVGOptions();
saveOpts.JpegQuality = 100;
for (int i=1;i<=pres.Slides.LastSlidePosition;i++)
I like to share that Aspose.Slides supports to generate the the slide thumbnails in different formats like bmp, jpeg or png. Please visit this documentation link for your kind reference.
I like to share that whatever dimension you will set the slide thumbnail for entire slide will be generated. Please use the following code line for generating the slide thumbnail.
//Getting the thumbnail image of the slide of a specified size
Image image = slide.GetThumbnail(1f,1f);
The factor 1f sets the size of actual slide in generated thumbnail. if you use 2f, then the slide thumbnail for twice the slide size will be generated.
Please share, if I may help you further in this regard.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.