Page break with page section / set margin with bindHTML

I am displaying html using page section.and I need page break after some html text. I have tried with

but it does not supports when geneate pdf . and also I have tried with "$NP" for new page but it does not support with html , it supports only to text info.

also I have tried with another option . I have tried to display html with Bindhtml() . it supports page break but its not set page left and top margin.

please guide me regarding this issue as soon as possible.

sample code :

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
Aspose.Pdf.Generator.HeaderFooter footer = new Aspose.Pdf.Generator.HeaderFooter(section);
// set the Odd footer of the PDF file
section.OddFooter = footer;
// set the Even footer of the PDF file
section.EvenFooter = footer;
// Create a Text object
Aspose.Pdf.Generator.Text footertext = new Aspose.Pdf.Generator.Text(GenerateFooter);
// Add text to Header section of the Pdf file
footertext.IsHtmlTagSupported = true;
footertext.IsHtml5Supported = true;
footer.IsLastPageOnly = false;
footer.IsSubsequentPagesOnly = false;
footer.DistanceFromEdge = 40;
footer.Margin.Left = 0;
//footer.Margin.Top = 100;
footer.Paragraphs.Add(footertext);


finalHTML = " " + finalHTML + "";
Aspose.Pdf.Generator.Text bodytext = new Aspose.Pdf.Generator.Text(finalHTML);
bodytext.IsKeptTogether = true;
bodytext.WrapLines = 0;
bodytext.IsKeptWithNext = true;

bodytext.IsFirstParagraph = true;
bodytext.IsHtmlTagSupported = true;
bodytext.Margin.Top = -10;
bodytext.Margin.Left = -10;
section.Paragraphs.Add(bodytext);

section.PageInfo.Margin.Left = 30;
section.PageInfo.Margin.Top = 10;
section.IsNewPage = true;

pdf.DestinationType = DestinationType.FitBox;

pdf.PageSetup.Margin.Left = -10;

pdf.HtmlInfo.PageHeight = PageSize.A4Height;
pdf.HtmlInfo.PageWidth = PageSize.A4Width;



pdf.HtmlInfo.Margin.Left =0;

pdf.HtmlInfo.Margin.Top = 0;

pdf.HtmlInfo.IsLandScape = false;
pdf.IsPageNumberRestarted = true;
pdf.IsPageNumberForDocument = true;
pdf.IsBookmarked = true;


Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(Server.MapPath("Aspose.Total.lic"));
pdf.OpenType = OpenType.Bookmarks;

filePath = Convert.ToString(ViewState["filePath"]);
pdf.Save(Server.MapPath(filePath));
DownloadFile(filePath);



--Here finalHTML is our HTML string with multiple property data.

I will also attached pdf file which not displaying page break

Hi,


Thanks for using our products.

We are working over this query and will get back to you soon. We are sorry for your inconvenience.

Hi,


Thanks for your patience.

I have gone through your requirement and have tried replicating this scenario over my end. During my testing, I have used a simple HTML file and have added

tag inside it. Then I have used the InLineHtml approach to read the contents of HTML file and have placed them inside the PDF document but I am unable to replicate this problem. Can you please share the source HTML that you are using so that we can test the scenario at our end. We are sorry for your inconvenience.


PS, Yes your understanding regarding $NP is correct because its only applicable to Text element and it has no effect when using it with HTML tags.