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

Free Support Forum - aspose.com

Add image in table cell using Aspose.PDF - AutoFitToContent is not working properly with images


I noticed that images(svg/jpeg) do not work with the table AutoFitToContent property. The images are unreadable. All the columns are getting collapsed.

Here is a code sample with the attached images I was testing with:

Debug.zip (38.5 KB)

    Document doc = new Document();
    Page page = doc.Pages.Add();
    page.PageInfo.Width = PageSize.PageLetter.Width;
    page.PageInfo.Height = PageSize.PageLetter.Height;
    page.PageInfo.Margin = new MarginInfo(27, 47, 27, 27);

    using (var checkStream = new FileStream(@"check.svg", FileMode.Open))
    using (var svgChartStream = new FileStream(@"chart.svg", FileMode.Open))
    using (var jpgChartStream = new FileStream(@"chart.jpeg", FileMode.Open))
        checkStream.Position = 0;
        svgChartStream.Position = 0;
        jpgChartStream.Position = 0;

        var checkSvg = new Aspose.Pdf.Image
            FileType = ImageFileType.Svg,
            ImageStream = checkStream,
            FixHeight = 12,
            FixWidth = 12
        var svgChart = new Aspose.Pdf.Image{
            FileType = ImageFileType.Svg,
            ImageStream = svgChartStream
        var jpgChart = new Aspose.Pdf.Image
            FileType = ImageFileType.Unknown,
            ImageStream = jpgChartStream,
            FixWidth = 300,
            FixHeight = 350

        var wideTable = new Table
            ColumnAdjustment = ColumnAdjustment.AutoFitToContent,
            DefaultCellBorder = new BorderInfo(BorderSide.All, 1f),
            Broken = TableBroken.Vertical
        var wideRow = wideTable.Rows.Add();
        var cell4 = wideRow.Cells.Add();
        var cell5 = wideRow.Cells.Add();
        var cell6 = wideRow.Cells.Add();



Thank you for contacting support.

We have been able to reproduce the issue in our environment and have logged a ticket with ID PDFNET-47090 in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Is there any update on this?


I regret to inform that issue is still unresolved. We will share good news with you soon. I request for your patience.