FloatingBox on each page not aligned correct

Hello,
When I create a pdf with multiple pages and I add a aligned FloatingBox on each page using IsFirstParagraph, The FloatingBoxon the first page is not aligned correct.

This is the test:


//Set PDF Section
Section lSection = new Section();
lSection.PageInfo.PageHeight = Aspose.Pdf.PageSize.A4Width;
lSection.PageInfo.PageWidth = Aspose.Pdf.PageSize.A4Height;

for (int i = 0; i < 8; i++)
{
Text lText = new Text("Titel " + i.ToString());
lText.IsFirstParagraph = true;

FloatingBox box1 = new FloatingBox();
box1.BoxWidth = 270;
box1.BoxHeight = 270;
box1.Border = new BorderInfo((int)BorderSide.All, 2);
box1.BackgroundColor = new Color(“lime”);
box1.BoxHorizontalPositioning = BoxHorizontalPositioningType.Page;
box1.BoxVerticalPositioning = BoxVerticalPositioningType.Page;
box1.BoxHorizontalAlignment = BoxHorizontalAlignmentType.Left;
box1.BoxVerticalAlignment = BoxVerticalAlignmentType.Top;
box1.Top = 100;
box1.Left = 50;

box1.IsFirstParagraph = true;
lSection.Paragraphs.Add(box1);
box1.Paragraphs.Add(lText);

}

Pdf lPdf = new Pdf();
lPdf.Sections.Add(lSection);

Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = “application/pdf”;
lPdf.Save(Response.OutputStream);
Response.End();




regards


Hello Bart,

Thanks for your interest in our products.

I've tested the scenario and I've noticed that the FloatingBox is not being placed properly because, first you've specified the Box positioning as Page Relative and then used the properties to specify the Absolute positioning of the Box. Please comment out/exclude the following two code lines and the Box will be displayed correctly (with Absolute positioning). I've also attached the resultant PDF generated using Aspose.Pdf for .NET 4.1.1

box1.BoxHorizontalAlignment = BoxHorizontalAlignmentType.Left;
box1.BoxVerticalAlignment = BoxVerticalAlignmentType.Top;

In case it does not satisfy your requirement or you've any further query, please feel free to contact. We apologize for your inconvenience.

Hello,
The FloatingBox one de first page is still aligned wrong.
Now the FloatingBox on the first pae is correct.
The FloatingBoxes on the next pages are aligned wrong.
Regards

Hello Bart,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Can you please share the resultant PDF document that is being generated at your end. It would help us while understanding the problem.

We're sorry for your inconvenience.

see File attachment
Regards

Hi,

Thanks for sharing the resource file.

I've again tested the scenario using Aspose.Pdf for .NET 4.1.1. and I'm unable to notice the problem. Can you please share which version of Aspose.Pdf for .NET you're using ?

Please take a look over the attached PDF document that I've generated using the following code snippet.

[C#]

Pdf lPdf = new Pdf();
//Set PDF Section
Aspose.Pdf.Section lSection = new Aspose.Pdf.Section();
lSection.PageInfo.PageHeight = Aspose.Pdf.PageSize.A4Width;
lSection.PageInfo.PageWidth = Aspose.Pdf.PageSize.A4Height;

for (int i = 0; i < 8; i++)
{
Text lText = new Text("Titel " + i.ToString());
lText.IsFirstParagraph = true;
FloatingBox box1 = new FloatingBox();
box1.BoxWidth = 270;
box1.BoxHeight = 270;
box1.Border = new BorderInfo((int)BorderSide.All, 2);
box1.BackgroundColor = new Aspose.Pdf.Color("lime");
box1.BoxHorizontalPositioning = BoxHorizontalPositioningType.Page;
box1.BoxVerticalPositioning = BoxVerticalPositioningType.Page;
box1.Top = 100;
box1.Left = 50;
box1.IsFirstParagraph = true;
lSection.Paragraphs.Add(box1);
box1.Paragraphs.Add(lText);
lPdf.Sections.Add(lSection);
}

lPdf.Save(@"d:/pdftest/FloatingBox.pdf");

I’m using 4.0.0.0
I will try 4.1.1