Page break and Margin

Hi,

I am creating PDF using aspose.words latest dll.
Eventually PDF is being created from html string.
How do I setup specific tag or something else in html so that it creates new page when converting to pdf when ever aspose dll reads that tag in html.

Also, I wanna know how can I set margin of page in PDF being created,

Below is my code snippet I am using

byte[] byteArray = Encoding.UTF8.GetBytes("" + [HTML Content] + "");

using (MemoryStream stream = new MemoryStream(byteArray))
{
    Aspose.Words.Document wordDoc = new Aspose.Words.Document(stream);
    wordDoc.Save(pathToSaveServer + "\\" + filenameToBeDeleted);


    Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(pathToSaveServer + "\\" + filenameToBeDeleted);
    pdfDoc.Encrypt(password, password, 0, Aspose.Pdf.CryptoAlgorithm.AESx128);
    pdfDoc.Save(pathToSaveServer + "\\" + filename);
}

Please guide me here

Thanks
Rohit

Hi Rohit,

Thanks for your inquiry. Please see the following HTML and code to meet these requirements.

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <title>
    </title>
</head>
<body>
    <div>
        <p style="margin-top:0pt; margin-bottom:8pt; line-height:108%; font-size:11pt">
            <span style="font-family:Calibri">This should be on page 1</span>
        </p>
        <p style="margin-top:0pt; margin-bottom:8pt; line-height:108%; font-size:11pt">
            <br style="page-break-before:always; clear:both" />
        </p>
        <p style="margin-top:0pt; margin-bottom:8pt; line-height:108%; font-size:11pt">
            <span style="font-family:Calibri">This should be on page 2</span>
        </p>
    </div>
</body>
</html>
Document doc = new Document(MyDir + @"in.html");
PageSetup ps = doc.FirstSection.PageSetup;
ps.LeftMargin = 2 * 72;
ps.RightMargin = 2 * 72;
ps.TopMargin = 2 * 72;
ps.BottomMargin = 2 * 72;
doc.Save(MyDir + @"17.6.pdf");

Hope, this helps.

Best regards,