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

Free Support Forum - aspose.com

SVG images not being moved to the next page

Hi,

I noticed that SVG images do not overflow over to a new page when the image doesn’t fit on the current page like JPEGs do. For example, I created two pages and swapped the order in the page’s paragraph. The JPEG properly moves over to the next page while the SVG is unreadable.

Debug.zip (38.5 KB)

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

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

            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
            };

            //svg overflows page, doesn't get moved to a new page
            page.Paragraphs.Add(jpgChart);
            page.Paragraphs.Add(svgChart);

            page2.Paragraphs.Add(svgChart);
            page2.Paragraphs.Add(jpgChart);

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

@dfactset

Thank you for precisely explaining the scenario.

I have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-43989 has been logged in our issue management system for the support of this feature. The issue ID has been linked with this thread so that you will receive notification as soon as the issue is resolved.

We are sorry for the inconvenience.

Hello Farhan,

I am also facing the same problem as discussed above. The svg image is overflowing if the page does not have enough space to fit itself in.

Have you identified some solution with this problem? Please reply at your earliest

@PriyankaShelke

Thank you for contacting support.

We would like to share with you that the ticket, PDFNET-43989, was logged for not overflowing of SVG image in specific scenario. Whereas, you are reporting overflow of SVG image which appears to be a different scenario. Would you please create a separate post while elaborating it and sharing relevant files and code snippet to reproduce the problem, so that we may proceed to help you out.

The issues you have found earlier (filed as PDFNET-43989) have been fixed in Aspose.PDF for .NET 19.3.