We have Dynamic HTML which doesn't have fix length. every time it generates with different length. I have to convert html data into pdf file. and we are using aspose.pdf to generate .pdf file. I have to create page break in pdf file dynamically.
Can you please share the source HTML file so that we can test the scenario at our end. This will help us to identify the issue and reply back to you soon.
Aspose.Pdf for .NET provides the feature of conversion from HTML to PDF. In case you need any page breaks, you need to provide your custom implementation in HTML file/string to allow the page break. You may use the replaceable symbol “#$NP” in the text string that can be replaced with corresponding content during conversion to PDF. Please see the following documentation link in this regard: Replaceable Symbols
Also, I have noticed the formatting issue in the converted PDF file and for rectification, an issue has been registered in our issue tracking system with issue id: PDFNEWNET-33506. We will update you via this forum thread regarding any updates against your issue.
Thanks for your feedback. For page break, you can use “#$NP” in your text where you want the page to break. Please see the following sample code in this regard. Resultant file is attached for your reference.
[C#]
// Instantiate Pdf instance by calling it empty constructor Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Create a section in the Pdf object Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
//Create a sample text paragraph Aspose.Pdf.Generator.Text text1= new Aspose.Pdf.Generator.Text("Page 1 #$NP Page 2 #$NP Page 3");
//Specify the ID for text paragraph text1.ID = "page1";
//add text paragraph to paragraphs collection of section object sec1.Paragraphs.Add(text1);
pdf1.Save(@"d:\pdffiles\test.pdf");
Please feel free to contact support in case you need any further assistance.
I had tried using #$NP, but it works only with Aspose.pdf.Generator.text. And I had used BindHTML() to generate pdf from dynamic HTML content. with BindHTML() it is not worknig. And style is also not working with dynamic content.
I had tried using #$NP, but it works only with Aspose.pdf.Generator.text. And I had used BindHTML() to generate pdf from dynamic HTML content. with BindHTML() it is not worknig. And style is also not working with dynamic content.
Thanks for your patience. Your reported issue PDFNEWNET-33506 has been fixed in new DOM approach of HTML to PDF conversion. Please check following documentation link for code snippet and details.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.