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