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

Free Support Forum - aspose.com

Margin on second file is wrong

// Instantiate Document Object

Document doc = new Document();

foreach (var fileData in FileData)


// Load the source image file to Stream object

using (FileStream fs = new FileStream(fileData.LocalFileName, FileMode.Open, FileAccess.Read))


byte[] tmpBytes = new byte[fs.Length];

fs.Read(tmpBytes, 0, Convert.ToInt32(fs.Length));

MemoryStream mystream = new MemoryStream(tmpBytes);

// Instantiate BitMap object with loaded image stream

Bitmap b = new Bitmap(mystream);

// Add a page to pages collection of document

Page page = doc.Pages.Add();

//Aspose.Pdf.MarginInfo margin = new Aspose.Pdf.MarginInfo();

//margin.Top = 0;

//margin.Bottom = 0;

//margin.Left = 0;

//margin.Right = 0;

//page.PageInfo.Margin = margin;

//page.CropBox = new Aspose.Pdf.Rectangle(0, 0, b.Width, b.Height);

// Create an image object

Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();

// Add the image into paragraphs collection of the section


// Set the image file stream

image1.ImageStream = mystream;

// Close memoryStream object




// Save resultant PDF file



Hi Giuseppe,

Thanks for contacting support.

The problem appears to be related to input image being placed inside PDF document. Can you please share the resource images, so that we can test the scenario in our environment. We are sorry for this inconvenience.

Image attached.

Hi Giuseppe,

Thanks for sharing the resource file.

I have tested the scenario where I have tried place the above shared image file twice in PDF document and as per my observations, the dimensions of image on both pages is same. However you may consider setting appropriate dimension values and margin information, so that image is properly displayed inside the document.

For your reference, I have also attached the PDF document generated over my end.

If you read carefully my initial post, you will see that I am trying to set the margin = 0 and to streach the image full page.

If you are able to do the above, please share the code with me.

Hi Giuseppe,

Thanks for the acknowledgement.

I have again tested the scenario while setting margin as 0 on all four sides and have managed to reproduce the same issue that margin for image on second page is not correct. For the sake of correction, I have logged this problem
as PDFNEWNET-39262 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.

I have noted that many of support question has been remained unresponded from your support team.

I hope this will not be the same case.

Hi Giuseppe,

Thanks for your inquiry. There would be some confusion, we try to respond and resolve each and every query in timely fashion until unless some fix or feature need some major changes in API as compare to its demand. Actually product team schedule issue investigation and resolution on first come first serve basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

However we will keep you updated about your issue resolution progress in this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

Any news about this issue?

Hi Giuseppe,

Thanks for your inquiry. I am afraid your reported issue is still not resolved, as our product team is busy in investigating/fixing other issues in the queue, reported earlier. However we have raised the issue priority and requested our product team to complete the analysis and share an ETA at their earliest. We will notify you as soon as we made some significant progress towards issue resolution.

Thanks for your patience and cooperation.

Best Regards,

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

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