How to do page break while converting HTML to PDF

Hi,

We are having dynamic html and in html we are passing page break like below

<div style="page-break-after: always">Casey</div>

but when we convert into pdf page break is not coming ,

so can you please suggest what is best way to do page break while converting html to pdf , or if we have any other way please suggest us .

@caseyfriese,

We have tested your scenario with the latest version 17.11 of Aspose.Pdf for .NET API and works fine. Please refer to these input and output documents: Files.zip (24.4 KB)

[C#]

string dataDir = @"C:\Pdf\test492\";
Document document = new Document(dataDir + "input.html", new HtmlLoadOptions());
document.Save(dataDir + "output.pdf", SaveFormat.Pdf);

@saulosag

Please use following link to download files. Also, in case you face any issue or have any other query, please feel free to create a new topic. We will surely assist you accordingly.

@saulosag

It seems like you are using Aspose.Words API. We request you to please share complete code snippet which you are using in your environment. We will test the scenario in our environment and address it accordingly.

@saulosag

Thanks for sharing the code snippet. In your code, you are saving document to PDF and returning it as Aspose.Pdf.Document. It should be Aspose.Words.Document.

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word/PDF file that shows the undesired behavior.
  • Please attach the expected output Word/PDF file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.