Hi,
I noticed that images are not properly flowing to a new page in the Aspose.pdf namespace if the height of the image is larger than the remaining space on the first page. It looks like the old Aspose.Pdf.Generator namespace works properly and the two images end up on two different pages.
static void generateImageBreak()
{
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);
var image = new Aspose.Pdf.Image();
image.File = “chart.jpg”;
page.Paragraphs.Add(image);
var image2 = new Aspose.Pdf.Image();
image2.File = “chart.jpg”;
page.Paragraphs.Add(image2);
doc.Save(“imageBreak.pdf”);
}
static void generateOldImageBreak()
{
var pdf = new Aspose.Pdf.Generator.Pdf();
var section = pdf.Sections.Add();
section.PageInfo.PageWidth = PageSize.PageLetter.Width;
section.PageInfo.PageHeight = PageSize.PageLetter.Height;
section.PageInfo.Margin = new Aspose.Pdf.Generator.MarginInfo
{
Left = 27,
Top = 47,
Right = 27,
Bottom = 27
};
var image = new Aspose.Pdf.Generator.Image();
image.ImageInfo.File = “chart.jpg”;
section.Paragraphs.Add(image);
var image2 = new Aspose.Pdf.Generator.Image();
image2.ImageInfo.File = “chart.jpeg”;
section.Paragraphs.Add(image2);
pdf.Save(“oldImageBreak.pdf”);
}