Free Support Forum - aspose.com

Some JPG files convert to PDF not working

Hi,
I am using Aspose.pdf to convert JPG to pdf, for most files it works. but some jpg file seems not working. I have attached the jpg file to see if someone can convert to pdf. Below is my code.

            case ".jfif":
            case ".jpe":
            case ".jpg":
            case ".jpeg":
            case ".tif":
            case ".png":
            case ".gif":
         
                pdfDocument = new Aspose.Pdf.Document();
                pdfDocument.Pages.Add();
                asposePdfImage = new Aspose.Pdf.Image();
                Bitmap bitmap = new Bitmap(postFile.InputStream);
                asposePdfImage.ImageStream = postFile.InputStream;

                pdfDocument.Pages[1].Paragraphs.Add(asposePdfImage);
                pdfDocument.Pages[1].PageInfo.Height = bitmap.Height;
                pdfDocument.Pages[1].PageInfo.Width = bitmap.Width;
                pdfDocument.Pages[1].PageInfo.Margin.Left = 1;
                pdfDocument.Pages[1].PageInfo.Margin.Top = 1;
                pdfDocument.Pages[1].PageInfo.Margin.Bottom = 1;
                pdfDocument.Pages[1].PageInfo.Margin.Right = 1;
                pdfDocument.Save(basePdfStream);
                break;

I1.1 8x11 Single Page Photo Portrait.jpg (2.6 MB)

thanks,
Jeffrey

@jeffreyshou

Thank you for contacting support.

We have worked with the data shared by you and have been able to generate attached PDF file ImageSave_18.9.pdf. If you notice any problem with it then please elaborate so that we may investigate further to help you out. Please ensure using Aspose.PDF for .NET 18.9.1 in your environment.

Great, after upgrade Aspose.pdf from 18.7 to 18.9.1, the issue has been resolved. thanks, Farhan.