Free Support Forum - aspose.com

Paragraph margins not working in floating box

Hi,

Using Aspose.Pdf v3.6.1.0, I have a Floating box with many text paragraphs. I assign each paragraph a top margin to create space between each paragraph. My problem is that the margin value is not applied for paragraphs in the floating box…

Below is some sample code to reproduce the problem… Any ideas ?

Thanks,

Dominic.

const float MM2PT = 2.8346456692913385f;

Aspose.Pdf.Pdf pdfDocument = new Aspose.Pdf.Pdf();
Aspose.Pdf.Section pdfSection = pdfDocument.Sections.Add();

Aspose.Pdf.Text pdfText;
Aspose.Pdf.FloatingBox pdfBox;

// Text Paragraph 1
pdfText = new Aspose.Pdf.Text(“Paragraph text 1”);
pdfSection.Paragraphs.Add(pdfText);
pdfText.Margin.Top = 20 * MM2PT;

// Text Paragraph 2
pdfText = new Aspose.Pdf.Text(“Paragraph text 2”);
pdfSection.Paragraphs.Add(pdfText);
pdfText.Margin.Top = 20 * MM2PT;

// Text Paragraph 3
pdfText = new Aspose.Pdf.Text(“Paragraph text 3”);
pdfSection.Paragraphs.Add(pdfText);
pdfText.Margin.Top = 20 * MM2PT;

pdfBox = new Aspose.Pdf.FloatingBox();
pdfSection.Paragraphs.Add(pdfBox);
pdfBox.BoxHorizontalPositioning = Aspose.Pdf.BoxHorizontalPositioningType.Page;
pdfBox.BoxVerticalPositioning = Aspose.Pdf.BoxVerticalPositioningType.Page;
pdfBox.Top = 100 * MM2PT;
pdfBox.Left = 50 * MM2PT;

// Box Paragraph 1
pdfText = new Aspose.Pdf.Text(“Paragraph box 1”);
pdfBox.Paragraphs.Add(pdfText);
pdfText.Margin.Top = 20 * MM2PT;

// Box Paragraph 2
pdfText = new Aspose.Pdf.Text(“Paragraph box 2”);
pdfBox.Paragraphs.Add(pdfText);
pdfText.Margin.Top = 20 * MM2PT;

// Box Paragraph 3
pdfText = new Aspose.Pdf.Text(“Paragraph box 3”);
pdfBox.Paragraphs.Add(pdfText);
pdfText.Margin.Top = 20 * MM2PT;

pdfDocument.Save(“c:\temp\pdfTest.pdf”);

Hi,

I have logged this issue as PDFNET-4230. We will try to fix it soon.