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

Free Support Forum - aspose.com

JPG not showing up in PDF

JPG image not showing up in PDF. When I run my code to see the MVC view I can see the JPG image, but when I run my code to convert the MVC view into PDF, then image is not shown in the PDF.

I see the JPG image in MVC view HTML page.
I don’t see the JPG image in PDF.

Here is my code to convert the MVC view HTML page into PDF.

MemoryStream stream2 = new MemoryStream();

        Aspose.Pdf.License license = new Aspose.Pdf.License();
        string html = ViewRenderer.RenderView("~/Views/Home/MyMVCview.cshtml", viewModel);

        // convert string to stream
        byte[] byteArray = Encoding.ASCII.GetBytes(html);
        MemoryStream stream = new MemoryStream(byteArray);

        // import an HTML document
        Aspose.Pdf.HtmlLoadOptions options = new Aspose.Pdf.HtmlLoadOptions();
        options.PageInfo.IsLandscape = false;
        options.PageInfo.Margin.Top = 5;
        options.PageInfo.Margin.Left = 23;
        options.PageInfo.Margin.Right = 22;
        options.PageInfo.Margin.Bottom = 5;
        options.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width;
        options.PageInfo.Height = Aspose.Pdf.PageSize.A4.Height;

        Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(stream, options);
        pdfDocument.Info.Title = "MyFile" + viewModel.RecID.ToString() + ".pdf";
        pdfDocument.Save(stream2, Aspose.Pdf.SaveFormat.Pdf);

        return stream2;


Thank you fo rcontacting support.

Would you please share source and generated files as ZIP so that we may try to reproduce and investigate it in our environment. Before sharing requested data, please ensure using Aspose.PDF for .NET 19.11.

I found the answer. You can close this ticket. Thank you.


Thank you for your kind feedback.

Please feel free to contact us if you need any further assistance.