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

Free Support Forum - aspose.com

Images not rendering properly when converted from Excel to PDF

Hi, I am using the Aspose Cells 18.11.0 for a Demo to retreive the first sheet from an Excel Document and save it as a Pdf.
There are some images in the Excel file and those are not getting rendered correctly when the PDF gets generated. Please see attached image . The screenshot on the left is from Excel and screenshot on the right is generated pdf.
Excel Pdf conversion.jpg (535.1 KB)

I tried the Conversion by using Excel 2016(Save as Pdf) and I do not get the issue with the images when I use Excel 2016. Are there any Save options or some other properties from the workbook or the worksheet object I can use so that the images show correctly in the pdf?

I use the following code to create the pdf.

        Workbook workbook = new Workbook(@"test.xlsx");
        // Create an instance of PdfSaveOptions and pass SaveFormat to the constructor
        PdfSaveOptions options = new PdfSaveOptions(SaveFormat.Pdf);
        options.CreatedTime = DateTime.Now;

        // Save the workbook to PDF format while passing the object of PdfSaveOptions
        workbook.Save("aspose.pdf", options);

        Workbook excelWorkbook1 = new Workbook();

        // Copy the first sheet of the first book into second book.
        excelWorkbook1.Worksheets[0].Copy(workbook.Worksheets[0]);

        // Save the file.
        excelWorkbook1.Save("aspose sheet1.pdf", options);

Thank you for your help.
Manish

@manishmahajan,

Thanks for your query.

Please share your sample file (test.xlsx) with us for our testing. We will reproduce the problem and provide our feedback after analysis.

Hi @ahsaniqbalsidiqui

How do I share the file? When I try to upload, it says Excel is not allowed.

Regards,
Manish

Please find the link to the file here.
https://drive.google.com/file/d/13yGXh4rMJdmkd4TuqQ9yA5x3ppVN-RxM/view?usp=sharing

@manishmahajan,

Thanks for sharing the template file.

After an initial test, I am able to observe the issue as you mentioned (via your screenshot: https://forum.aspose.com/uploads/discourse_instance3/21712) by using your sample code with your template file. I found that images (on page 1 and 2) are not rendered properly when converted from the Excel file to PDF file format:
e.g
Sample code:

Workbook workbook = new Workbook(@"test.xlsx");
        // Create an instance of PdfSaveOptions and pass SaveFormat to the constructor
        PdfSaveOptions options = new PdfSaveOptions(SaveFormat.Pdf);
        options.CreatedTime = DateTime.Now;

        // Save the workbook to PDF format while passing the object of PdfSaveOptions
        workbook.Save("aspose.pdf", options);

        Workbook excelWorkbook1 = new Workbook();

        // Copy the first sheet of the first book into second book.
        excelWorkbook1.Worksheets[0].Copy(workbook.Worksheets[0]);

        // Save the file.
        excelWorkbook1.Save("aspose sheet1.pdf", options);

I have logged a ticket with an id “CELLSNET-46499” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Thanks.
This is one of the issues which is keeping us from Purchasing Aspose.cells for our project and any resolutions would help us in making the decision to use Aspose.Cells.

@manishmahajan,

This issue is logged too recently and still not analyzed by us. We will analyze it and provide ETA as soon as available.

@manishmahajan,

We did trace the problem, but we found it is too complex to sort it out in short time, We need more time to evaluate it and to figure it out.

There is no ETA for the issue but once we have an update on it, we will let you know.

@manishmahajan,

This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-46499”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

The issues you have found earlier (filed as ) have been fixed in Aspose.Cells for .NET v18.12. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi