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

Free Support Forum - aspose.com

Images not rendered to next page

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

Hi Daniel,


Thanks for using our API’s.

I have tested the scenario and I am able to
notice the same problem. For the sake of correction, I have logged this problem
as PDFNEWNET-40511 in our issue tracking system. We will
further look into the details of this problem and will keep you updated on the
status of correction. Please be patient and spare us little time. We are sorry
for this inconvenience.

The issues you have found earlier (filed as PDFNEWNET-40511) have been fixed in Aspose.Pdf for .NET 11.6.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,


It looks like the initial problem was fixed, but I noticed the problem persists if we use the FixWidth and FixHeight properties when adding the image. When I do, the second image is still squished into the first page and doesn’t respect the height and width we set. Here’s an updated code sample:

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.jpeg”;
image.FixHeight = 450;
image.FixWidth = 450;
page.Paragraphs.Add(image);

var image2 = new Aspose.Pdf.Image();
image2.File = @“chart.jpeg”;
image2.FixHeight = 450;
image2.FixWidth = 450;
page.Paragraphs.Add(image2);

doc.Save(“imageBreak.pdf”);
dfactset:
Hi,

It looks like the initial problem was fixed, but I noticed the problem persists if we use the FixWidth and FixHeight properties when adding the image. When I do, the second image is still squished into the first page and doesn't respect the height and width we set. Here's an updated code sample:

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.jpeg";
image.FixHeight = 450;
image.FixWidth = 450;
page.Paragraphs.Add(image);

var image2 = new Aspose.Pdf.Image();
image2.File = @"chart.jpeg";
image2.FixHeight = 450;
image2.FixWidth = 450;
page.Paragraphs.Add(image2);

doc.Save("imageBreak.pdf");
Hi Daniel,

Thanks for contacting support.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have separately logged it as PDFNEWNET-40912 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNET-40912) have been fixed in Aspose.Pdf for .NET 17.4.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
(2)