Esempio n. 1
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();

            //create PdfFileStamp object
            PdfFileStamp fileStamp = new PdfFileStamp();

            //Open Document
            fileStamp.BindPdf(dataDir + "Input_new.pdf");

            //get total number of pages
            int totalPages = new PdfFileInfo(dataDir + "Input_new.pdf").NumberOfPages;

            //create formatted text for page number
            FormattedText formattedText = new FormattedText("Page # Of " + totalPages, System.Drawing.Color.Blue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, false, 14);

            //set starting number for first page; you might want to start from 2 or more
            fileStamp.StartingNumber = 1;

            //add page number
            fileStamp.AddPageNumber(formattedText, 0);

            //save updated PDF file
            fileStamp.Save(dataDir + "AddPageNumber_out.pdf");

            //close fileStamp
            fileStamp.Close();
        }
        public static void Run()
        {
            // ExStart:AddPageNumber
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();

            // Create PdfFileStamp object
            PdfFileStamp fileStamp = new PdfFileStamp();

            // Open Document
            fileStamp.BindPdf(dataDir + "AddPageNumber.pdf");
            
            // Get total number of pages
            int totalPages = new PdfFileInfo(dataDir + "AddPageNumber.pdf").NumberOfPages;

            // Create formatted text for page number
            FormattedText formattedText = new FormattedText("Page # Of " + totalPages, System.Drawing.Color.Blue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, false, 14);

            // Set starting number for first page; you might want to start from 2 or more
            fileStamp.StartingNumber = 1;

            // Add page number
            fileStamp.AddPageNumber(formattedText, 0);

            // Save updated PDF file
            fileStamp.Save(dataDir + "AddPageNumber_out.pdf");

            // Close fileStamp
            fileStamp.Close();
            // ExEnd:AddPageNumber
            
        }
 public static void CustomNumberStyle()
 {
     // ExStart:CustomNumberStyle
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();
     // Create PdfFileStamp object
     PdfFileStamp fileStamp = new PdfFileStamp();
     // Open Document
     fileStamp.BindPdf(dataDir + "AddPageNumber.pdf");
     // Specify numbering style as Numerals Roman UpperCase
     fileStamp.NumberingStyle = NumberingStyle.NumeralsRomanUppercase;
     // Add page number stamp at Bottom-Center of page
     fileStamp.AddPageNumber("#");
     // Save updated PDF file
     fileStamp.Save(dataDir + "CustomNumberStyle_out.pdf");
     // ExEnd:CustomNumberStyle
 }
        public static void CustomNumberStyle()
        {
            // ExStart:CustomNumberStyle
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();
            // Create PdfFileStamp object
            PdfFileStamp fileStamp = new PdfFileStamp();

            // Open Document
            fileStamp.BindPdf(dataDir + "AddPageNumber.pdf");
            // Specify numbering style as Numerals Roman UpperCase
            fileStamp.NumberingStyle = NumberingStyle.NumeralsRomanUppercase;
            // Add page number stamp at Bottom-Center of page
            fileStamp.AddPageNumber("#");
            // Save updated PDF file
            fileStamp.Save(dataDir + "CustomNumberStyle_out_.pdf");
            // ExEnd:CustomNumberStyle
        }
Esempio n. 5
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //open document
            PdfFileStamp fileStamp = new PdfFileStamp(dataDir + "Input_new.pdf", dataDir + "output.pdf");

            //get total number of pages

            int totalPages = new PdfFileInfo(dataDir + "Input_new.pdf").NumberOfPages;
            //create formatted text for page number
            FormattedText formattedText = new FormattedText("Page # Of " + totalPages, System.Drawing.Color.Blue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, false, 14);

            //set starting number for first page; you might want to start from 2 or more
            fileStamp.StartingNumber = 1;
            //add page number
            fileStamp.AddPageNumber(formattedText, 0);

            //save updated PDF file
            fileStamp.Close();
        }
Esempio n. 6
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //open document
            PdfFileStamp fileStamp = new PdfFileStamp(dataDir+ "Input_new.pdf", dataDir+ "output.pdf");

            //get total number of pages

            int totalPages = new PdfFileInfo(dataDir+ "Input_new.pdf").NumberOfPages;
            //create formatted text for page number
            FormattedText formattedText = new FormattedText("Page # Of " + totalPages, System.Drawing.Color.Blue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, false, 14);

            //set starting number for first page; you might want to start from 2 or more
            fileStamp.StartingNumber = 1;
            //add page number
            fileStamp.AddPageNumber(formattedText, 0);

            //save updated PDF file
            fileStamp.Close();
        }