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

Free Support Forum - aspose.com

Page Breaks in PDf from Dynamic HTML content

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.

I will attach sample html file

Hi Aanal,

Thanks for your interest in our products.

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.

We apologize for your inconvenience.

Thanks & Regards,

Ok. I will send you sample HTML content.

Hi
Aanal,<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

<o:p> </o:p>

Thank
you for sharing the template HTML file.<o:p></o:p>

<o:p> </o:p>

Aspose.Pdf
for .NET provides the feature of conversion from HTML2PDF and 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
replaceable symbol “#$NP” in text string that can be replaced with
corresponding content during conversion to PDF. Please see the following
documentation link in this regard:<o:p></o:p>

<o:p> </o:p>

Replaceable
Symbols
<o:p></o:p>

<o:p> </o:p>

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.<o:p></o:p>

<o:p> </o:p>

Sorry
for the inconvenience,

Thanks for your reply.

I read the link u had provided to me for page break.

I had sent you the HTML file whose content are not fixed. It generates dynamically everytime. So where I have to set #$NP in text.

Please guide me.

Hi Aanal,

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.

Thanks & Regards,

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.

AanalS:
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.
Hi,

Please notice my comments over 381453

The issues you have found earlier (filed as PDFNEWNET-33506) have been fixed in Aspose.Pdf for .NET 9.5.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Aanal,


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.


Please feel free to contact us for any further assistance.

Best Regards,