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

Free Support Forum - aspose.com

Update margin on the overflow page of a paragraph

Hi, I am currently working on the code below:

 var htmlFragment = new HtmlFragment(htmlString);
 htmlFragment.Margin.Top = 240;
 htmlFragment.TextState = new TextState();
 htmlFragment.TextState.Font = FontRepository.FindFont("Verdana");
 htmlFragment.TextState.FontSize = 10.0F;
 htmlFragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.DimGray);


I need to specify the top margin on the first page as I have other content at the top of it. My issue is that when this htmlfragment content overflows to the next page, the content also starts the same as in the first page where the Margin.Top = 240. Is there a way for me to specify that this paragraph on overflow pages should start at a particular margin.top?

Thanks for your help,


Could you kindly provide your sample HTML string for our reference. We will test the scenario in our environment and share our feedback with you accordingly.

Hi Asad,

Please find code below:

            var list = new System.Text.StringBuilder();

            for (int i=0; i <= 50; i++)
                list.AppendFormat(string.Format("<li>{0}</li>", i));

            var htmlString = string.Format(@"
                                        <span>Text 1</span><br />
                                        <span>Text 2</span>
                                        <ul>{0}</ul>", list.ToString());



We need to investigate the functionality which you need at the moment and for the purpose, we have logged an investigation ticket as PDFNET-48680 in our issue tracking system. We will further look into its details and keep you posted with the status of ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.