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

Free Support Forum - aspose.com

Table cells do not resize properly when calling AutoFitToContent with SVG images

Hi,

I noticed that SVG images do not work with the table AutoFitToContent property. The svg images are unreadable while the jpeg image resizes the cell properly. 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
            };
            page.Paragraphs.Add(wideTable);
            var wideRow = wideTable.Rows.Add();
            var cell4 = wideRow.Cells.Add();
            cell4.Paragraphs.Add(checkSvg);
            var cell5 = wideRow.Cells.Add();
            cell5.Paragraphs.Add(jpgChart);
            var cell6 = wideRow.Cells.Add();
            cell6.Paragraphs.Add(svgChart);

            doc.ProcessParagraphs();
            doc.Save("AutoFitToContentSvgs.pdf");
    }

@dfactset,

We have tested your scenario with the latest version 17.12 of Aspose.Pdf for .NET API and managed to replicate the said issue in our environment. The JPEG image is also missing in the output PDF. This is the output PDF file: AutoFitToContentSvgs.pdf (128.5 KB). We have logged tickets in our issue tracking system as follows:

PDFNET-43991: the table cells do not resize properly with SVG images
PDFNET-43992: The JPEG is not being rendered in the table cell

We have linked your post to these tickets and will keep you informed regarding any available updates.

Any progress?

@dirq

Thank you for getting back to us.

We are afraid that the tickets PDFNET-43991 and PDFNET-43992 have not been resolved yet owing to previously logged and critical tickets. We have escalated their priority to next level and they will be scheduled soon. We will let you know as soon as some significant updates will be available. We appreciate your patience and comprehension in this regard.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan