Page footer issue

We are using PdfPageStamp to add in page footer margin.But sometimes footer text height exceeds the page margin size so text is getting cut off.Is there a way so that page footer can automatically adjust to text

@Tejal_Patel

Could you please share complete sample code snippet and sample input PDF document with us. We will test the scenario in our environment and address it accordingly.

		//rtfSnippet is our main pdf content
		
		
		Aspose.Pdf.PdfPageStamp pdfStamp;
        Aspose.Words.Document rtfDoc;

        // Get an RTF stream from the RTF string
        using (Stream rtfStream = RTFHelper.GenerateStreamFromString(rtfSnippet))   
        {
            // Create an RTF Document from the RTF stream
            rtfDoc = new Aspose.Words.Document(rtfStream);

            // Adjust the source doc margins a bit-
            foreach (Section sec in rtfDoc.Sections)
            {
                // Adjust the top and bottom margins just a little so they dont get cut off by the printer.
                // Adjust the side margins to the amount specified by the print template formatting.
                PageSetup ps = sec.PageSetup;
                ps.TopMargin = 10;
                ps.RightMargin = RTFFormat.rightMargin * PTS_PER_INCH;
                ps.BottomMargin = 10;
                ps.LeftMargin = RTFFormat.leftMargin * PTS_PER_INCH;
            }
        }

        // Now that we've got the RTF in Aspose, and marginized, convert it to PDF so that we can manipulate it with the Aspose PDF API.
        Aspose.Pdf.Document pdfDoc;

        
        MemoryStream pdfStream = new MemoryStream();
        undisposedStreams.Add(pdfStream);                       // keep a list of these so that we can properly dispose of them later since we can't dispose of them now, before a Save()
        
        rtfDoc.Save(pdfStream, SaveFormat.Pdf);                 // save the original rtfDoc as PDF into a pdfStream 
        pdfDoc = new Aspose.Pdf.Document(pdfStream);            // convert the pdfStream into Aspose.Pdf.Document

         pdfStamp = new Aspose.Pdf.PdfPageStamp(pdfDoc.Pages[1]);// convert the PDF to a "page stamp", so we can tack it as header or footer onto an existing PDF page

        pdfStamp.VerticalAlignment = Aspose.Pdf.VerticalAlignment.Top;

        pdfStamp.Background = true;                             // puts the stamp in the background, so "important" page text will override it if theres a collision in alignments
        
        // if its a footer, move it down to the bottom of the page (ie the end of the page minus the margin)
        if (isFooter)
        {
            double pageHeightPts = pdfDoc.Pages[1].Rect.Height;
            pdfStamp.TopMargin = pageHeightPts - (RTFFormat.bottomMargin * PTS_PER_INCH);
        } 
		targetPDFDoc.Pages[pageNum].AddStamp(remainFooter);

@Tejal_Patel

Thanks for sharing sample code snippet.

As requested earlier, please also share your sample input document with us. We will further test the scenario in our environment and proceed to assist you accordingly.

Hi,
You can use any document with margin size of header and footer 1 inch.and footer text height should exceeds footer margin

@Tejal_Patel

We have created a sample RTF document where margins are set to 1 inch and font height of the footer is 75. The document is attached for your kind reference so you may review and share if it replicates the issue on your end. Moreover, kindly share SSCCE code so that we may proceed further.

Sample.zip