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

Free Support Forum - aspose.com

HTML formatting- page breaks- and aspose.pdf

I am using a telerik RAD editor control to collect user-formatted text (they’re writing a report with bullets, underlining, italics, etc.) The RAD editor stores this formatting as HTML tags in the text.

I am taking that text, combining it using a stringbuilder object, and then outputting that into an aspose.pdf file, like so:

var pdf = new Pdf();
var section = pdf.Sections.Add();
Aspose.Pdf.Generator.Text t = new Text(sb.ToString());
t.ID = “ROI”;
t.IsHtmlTagSupported = true;
section.Paragraphs.Add(t);
return pdf;

The issue I have is I need page breaks in the pdf document. I’m doing this by using replaceable symbols (specifically, #$NP).

When I experiment, setting IsHtmlTagSupported = true results in the #$NP symbol being outputted to the final document. Setting it to false causes them to disappear (presumably being turned into page breaks although at the moment my test doc isn’t long enough for that to show up).

How do I go about getting page breaks and HTML formatting to live together in the same pdf?

Hi Scott,


Thanks for your inquiry. I have tested the scenario with Aspose.Pdf for .NET 9.3.0 and unable to replicate the issue. Please check following code snippet, hopefully it will help you to accomplish the task. If issue persist then please share you HTML, so we will test the scenario at our end and will provide you information accordingly.

var pdf34 = new Pdf();<o:p></o:p>

var section = pdf34.Sections.Add();

Aspose.Pdf.Generator.Text t = new Text("Page Break from here #$NP

Test it now

");

t.ID = "ROI";

t.IsHtmlTagSupported = true;

section.Paragraphs.Add(t);

pdf34.Save(myDir+"testoutgen.pdf");

Please feel free to contact us for any further assistance.


Best Regards,

Thanks! This resolved my issue.

Hi Scott,


Thanks for your feedback. It is good to know that you have managed to fulfill your requirements.

Please feel free to contact us for any further assistance, we will be more than happy to extend our support.

Best Regards,