This problem just popped up after the converter has worked fine for quite some time. I am using the latest build of Aspose.Slides (2.6.26). I've attached a zip file containing the PPT and the resulting image. As you can see, the first line wraps the last work when it is converted. Why is this happening? Below is my conversion code.
Imports Drawing2D = System.Drawing.Drawing2D
Imports System.Drawing
Imports System.IO
Imports Aspose.Slides
Public Class PPTConverter
Public Sub New()
'Do nothing
End Sub
Public Shared Sub convert(ByVal filepath As String, ByVal slideWidth As Integer, ByVal slideHeight As Integer, ByVal imageExtension As String, Optional ByVal slidesName As String = "slide")
Dim ppt As New Aspose.Slides.Presentation(filepath)
Dim pathname As String
pathname = filepath.Substring(0, filepath.LastIndexOf("\") + 1)
Dim i As Integer
Dim bmpSlideName As String
Dim slideName As String
Dim slide As Aspose.Slides.Slide
Dim bmpSlideImage As Image
Dim slideImage As Image
Dim slideSize As New Size(slideWidth, slideHeight)
Dim gif As Imaging.ImageFormat = Imaging.ImageFormat.Gif
Dim jpg As Imaging.ImageFormat = Imaging.ImageFormat.Jpeg
Dim bmp As Imaging.ImageFormat = Imaging.ImageFormat.Bmp
Dim imgEncoder As Imaging.Encoder = Imaging.Encoder.Quality
Dim imgQuality As New Imaging.EncoderParameter(imgEncoder, 95)
Dim imgEncoderParams As New Imaging.EncoderParameters(1)
imgEncoderParams.Param(0) = imgQuality
Dim graphic As System.Drawing.Graphics
Dim myCallback As New Image.GetThumbnailImageAbort(AddressOf getThumbnailImageCallback)
For i = 1 To ppt.Slides.Count - 1
slide = ppt.GetSlideByPosition(i)
bmpSlideName = pathname & slidesName & Format(i, "000") & imageExtension
bmpSlideImage = slide.GetThumbnail(1, 1)
Select Case imageExtension
Case ".gif"
slideImage = bmpSlideImage.GetThumbnailImage(slideWidth, slideHeight, myCallback, IntPtr.Zero)
slideImage.Save(bmpSlideName, getImageCodecInfo("image/gif"), imgEncoderParams)
Case ".jpg"
slideImage = New Bitmap(slideWidth, slideHeight, Imaging.PixelFormat.Format24bppRgb)
graphic = System.Drawing.Graphics.FromImage(slideImage)
graphic.DrawImage(bmpSlideImage, 0, 0, slideWidth, slideHeight)
slideImage.Save(bmpSlideName, getImageCodecInfo("image/jpeg"), imgEncoderParams)
End Select
Next
End Sub
Public Shared Function getImageCodecInfo(ByVal mimeType As String) As Imaging.ImageCodecInfo
Dim codecs() As Imaging.ImageCodecInfo = Imaging.ImageCodecInfo.GetImageEncoders
Dim codec As Imaging.ImageCodecInfo
For Each codec In codecs
If codec.MimeType = mimeType Then
Return codec
End If
Next
End Function
Public Shared Function getThumbnailImageCallback() As Boolean
Return False
End Function
End Class
Thanks!
Dan