Getting unnecessary Blank Page

With the following code I am receiving a blank page at the end.


Document pdfDoc = new Document();

Page pdfPage
= pdfDoc.Pages.Add();

pdfPage.PageInfo.Width = 612.0;

pdfPage.PageInfo.Height = 792.0;

pdfPage.PageInfo.Margin.Top = 48;

pdfPage.PageInfo.Margin.Bottom = 48;

pdfPage.PageInfo.Margin.Left = 50;

pdfPage.PageInfo.Margin.Right = 50;

TextSegment txtSeg = new TextSegment();

txtSeg.TextState.Font = FontRepository.FindFont("Arial");

txtSeg.TextState.FontSize = 14;

txtSeg.TextState.LineSpacing = 13;

txtSeg.TextState.HorizontalAlignment = HorizontalAlignment.Justify;

txtSeg.Text = "be deemed to constitute a “subordination agreement” within the meaning of Section 510(a) of the Bankruptcy Code and is intended to be and shall be interpreted to be enforceable to the maximum extent permitted pursuant to applicable non bankruptcy law and (ii) it is the intention of the parties hereto that (and to the maximum extent permitted by law the parties hereto agree that) the Revolving Obligations (and the security therefor) constitute a separate and distinct class (and separate and distinct claims) from the other Secured Obligations (and security therefor).Term Loan Lenders’ Acknowledgment Clause EACH LENDER WITH OUTSTANDING TERM LOANS ACKNOWLEDGES AND AGREES THAT THE REVOLVING OBLIGATIONS (INCLUDING OUTSTANDING REVOLVING LOANS, [SWING LINE LOANS AND LETTER OF CREDIT OUTSTANDINGS]) ARE ENTITLED TO DISTRIBUTIONS PURSUANT TO SECTION [insert cross-reference to waterfall provision] (INCLUDING DISTRIBUTIONS PURSUANT TO AN INSOLVENCY OR LIQUIDATION PROCEEDING) PRIOR TO ANY DISTRIBUTIONS BEING APPLIED TO THE OBLIGATIONS IN RESPECT OF OUTSTANDING TERM LOANS.EACH LENDER WITH OUTSTANDING TERM LOANS ACKNOWLEDGES AND AGREES THAT THE REVOLVING OBLIGATIONS (INCLUDING OUTSTANDING REVOLVING LOANS, [SWING LINE LOANS AND LETTER OF CREDIT OUTSTANDINGS]) ARE ENTITLED TO DISTRIBUTIONS PURSUANT TO SECTION [insert cross-reference to waterfall provision] (INCLUDING DISTRIBUTIONS PURSUANT TO AN INSOLVENCY OR LIQUIDATION PROCEEDING) PRIOR TO ANY DISTRIBUTIONS BEING APPLIED TO THE OBLIGATIONS IN RESPECT OF OUTSTANDING TERM LOANS.EACH LENDER WITH OUTSTANDING TERM LOANS ACKNOWLEDGES AND AGREES THAT THE REVOLVING to ab ";

TextFragment tf = new TextFragment();

tf.TextState.HorizontalAlignment = HorizontalAlignment.Justify;

tf.Segments.Add(txtSeg);

TextFragment tf1 = new TextFragment();

FloatingBox floatBx = new FloatingBox();

floatBx.Paragraphs.Add(tf);

pdfPage.Paragraphs.Add(floatBx);

pdfDoc.Save("sample.pdf");

Hi Sridhar,


Thanks for contacting support.

The blank page appears because you have added some blank spaces after last words of TextSegment " THE REVOLVING to ab ". Since page right border is reached, the in order to render the blank spaces, a new page is added.

Please take a look over attached PDF file which is generated after removing extra blank spaces.