Page Break after 2 sections?


#1

I am trying to print "Top Text" and "Bottom Text" on one page and then break to a new page for the next set of top and bottom text. Don't seem to be able to finger it out??

Thanks for any help.

Dim pdf As pdf = New pdf
Dim section1 As Section = New Section(pdf)
pdf.Sections.Add(section1)
Dim section2 As section = New section(pdf)
pdf.Sections.Add(section2)

Dim i As Integer

For i = 0 To 5 - 1 Step 1
Dim t As Text = New Text("Top Text " + i.ToString())
Dim t2 As Text = New Text("Bottom Text " + i.ToString())
section1.Paragraphs.Add(t)
section2.Paragraphs.Add(t2)
Next

Return pdf


#2

Hi,

Thank you for considering Aspose.

You can write your code like the following:

Dim pdf As Pdf = New Pdf

Dim i As Integer

For i = 0 To 5 - 1 Step 1
Dim section1 As Section = New Section(pdf)
pdf.Sections.Add(section1)
Dim t As Aspose.Pdf.Text = New Aspose.Pdf.Text("Top Text " + i.ToString())
Dim t2 As Aspose.Pdf.Text = New Aspose.Pdf.Text("Bottom Text " + i.ToString())
t2.Margin.Top = 650
section1.Paragraphs.Add(t)
section1.Paragraphs.Add(t2)
Next

pdf.Save("e:/temp/test.pdf")