We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

TextElement on bottom of the last page

Thread ID:

Created:

Updated:

Platform:

Replies:

128009 Dec 24,2016 12:07 PM Dec 27,2016 06:08 AM WPF 1
loading
Tags: PDF
Vladimir Culum
Asked On December 24, 2016 12:07 PM

Hello,

I am using PDF for WPF.

I don`t know how many pages will document have (it is dinamic).

I want to add PdfTextElement only to the bottom of the last page (not like footer on every page).

How can I achieve this.

Thank You.



Chinnu Muniyappan [Syncfusion]
Replied On December 27, 2016 06:08 AM

Hi Vladimir, 
 
Thank you for contacting Syncfusion support. 
 
We can get the last page of the PDF document by using PdfLoadedPageCollection.PageCount property, we have created a sample for inserting PdfTextElement in bottom of the last page for your reference, please refer the below code snippet and sample for more details. 
            //Load the existing PDF document  
            PdfLoadedDocument ldoc = new PdfLoadedDocument("../../Barcode.pdf"); 
 
            //Get the PDF document page count 
            int pageCount = ldoc.Pages.Count; 
 
            //Get the last page 
            PdfLoadedPage lastPage = ldoc.Pages [pageCount-1] as PdfLoadedPage ; 
 
            //Create a new PDF text element 
            PdfTextElement lastPageElement = new PdfTextElement("This is the last page", new PdfStandardFont(PdfFontFamily.Helvetica, 15, PdfFontStyle.Bold), PdfBrushes.Red); 
 
            //Draw the text element to the last page of the document 
            lastPageElement.Draw(lastPage.Graphics, new System.Drawing.PointF(0, lastPage.Size.Height - 20)); 
 
            //Save the document  
            ldoc.Save("output.pdf"); 
 
            //Close the document 
            ldoc.Close(true); 
 
Sample Link: 
 
Let us know if you have any concern. 
 
Regards, 
Chinnu 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;