Hi,
I’m getting an exception when trying to convert a JPG to PDF.
I’m using the latest version of Aspose.Pdf (6.4.0.0). The same piece of code works fine with BMP, GIF, PNG and TIF images. I have attached the jpg file I’m using.
The code I’m running is the following:
PdfGenerator.Pdf pdf = new PdfGenerator.Pdf();
PdfGenerator.Section section = pdf.Sections.Add();
PdfGenerator.Image image = new PdfGenerator.Image(section);
section.Paragraphs.Add(image);
image.ImageInfo.ImageStream = file.Stream;
image.ImageInfo.ImageFileType = ImageFileType.Jpeg;
using(var stream = new MemoryStream())
{
pdf.Save(stream);
return stream.GetBuffer();
}
The exception I get is the following:
Unknown image type : Jpeg Stack: at ?.?.□□(? , Int32 , ImageFileType , String
, String , String , Int32 , Int32 , Boolean , Boolean , Boolean , Boolean ,
Byte[] , Stream , □ )
at ?.?.□□(Image , ImageFileType , String , String ,
String , Int32 , Int32 , Boolean , Boolean , Byte[] , Stream , □ )
at
?.?.□□(Pdf , Image )
at ?.?.□□(Pdf , Section , Table , Row , Cell , Image
, , □ )
at ?.?.□□(Pdf , Section , HeaderFooter , Table , Row , Cell ,
Image , , □ , Boolean )
at ?.□.□□(Pdf , Section , )
at
?.?.□□(Pdf )
at ?.?.□□(□ , Pdf )
at
Aspose.Pdf.Generator.Pdf.Save(Stream stream)
at
Netcompany.CCM.Business.DocumentManipulation.Pdf.AsposePdfConverter.ConvertImageToPDF(IFile
file, ImageFileType imageFileType)