Exemple #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 + "AddTextStampAll.pdf");

            //create stamp
            Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();
            stamp.BindLogo(new FormattedText("Hello World!", System.Drawing.Color.Blue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, true, 14));
            stamp.SetOrigin(200, 200);
            stamp.Rotation     = 90.0F;
            stamp.IsBackground = true;

            //add stamp to PDF file
            fileStamp.AddStamp(stamp);

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

            //close fileStamp
            fileStamp.Close();
        }
        public static void Run()
        {
            try
            {
                // ExStart:ExtractImageImageStamp
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();
                // Instantiate PdfContentEditor Object
                PdfContentEditor pdfContentEditor = new PdfContentEditor();

                // Bind input PDF file
                pdfContentEditor.BindPdf(dataDir + "ExtractImage-ImageStamp.pdf");

                // Get Stamp info for the first stamp
                StampInfo[] infos = pdfContentEditor.GetStamps(1);

                // Get the image from Stamp Info
                System.Drawing.Image image = infos[0].Image;

                // Save the extracted image
                image.Save(dataDir + "image_out_.jpg");
                // ExEnd:ExtractImageImageStamp
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemple #3
0
        public static void Run()
        {
            // ExStart:AddImageStampAll
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();

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

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

            // Create stamp
            Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();
            stamp.BindImage(dataDir + "aspose-logo.jpg");
            stamp.SetOrigin(200, 200);
            stamp.Rotation     = 90.0F;
            stamp.IsBackground = true;

            // Add stamp to PDF file
            fileStamp.AddStamp(stamp);

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

            // Close fileStamp
            fileStamp.Close();
            // ExEnd:AddImageStampAll
        }
Exemple #4
0
        public static void Run()
        {
            // ExStart:AddPageStampPage
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();

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

            // Open Document
            fileStamp.BindPdf(dataDir + "AddPageStamp-Page.pdf");

            // Create stamp
            Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();
            stamp.BindPdf(dataDir + "temp.pdf", 1);
            stamp.SetOrigin(200, 200);
            stamp.Rotation     = 90.0F;
            stamp.IsBackground = true;

            // Set particular pages
            stamp.Pages = new int[] { 2 };

            // Add stamp to PDF file
            fileStamp.AddStamp(stamp);

            // Save updated PDF file
            fileStamp.Save(dataDir + "AddPageStamp-Page_out_.pdf");

            // Close fileStamp
            fileStamp.Close();
            // ExEnd:AddPageStampPage
        }
Exemple #5
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()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();

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

            //Open Document
            fileStamp.BindPdf(dataDir + "AddImageStamp-Page.pdf");

            //create stamp
            Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();
            stamp.BindImage(dataDir + "aspose-logo.jpg");
            stamp.SetOrigin(200, 200);
            stamp.Rotation     = 90.0F;
            stamp.IsBackground = true;

            //set particular pages
            stamp.Pages = new int[] { 1 };

            //add stamp to PDF file
            fileStamp.AddStamp(stamp);

            //save updated PDF file
            fileStamp.Save(dataDir + "AddImageStamp-Page_out.pdf");

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

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

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

            // Create formatted text for page number
            FormattedText formattedText = new FormattedText("Aspose - Your File Format Experts!", System.Drawing.Color.Blue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, false, 14);

            // Add footer
            fileStamp.AddFooter(formattedText, 10);

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

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

                // Instantiate PdfContentEditor Object
                PdfContentEditor pdfContentEditor = new PdfContentEditor();

                // Bind input PDF file
                pdfContentEditor.BindPdf(dataDir + "ChangeStampPosition.pdf");

                int    pageId     = 1;
                int    stampIndex = 1;
                double x          = 200;
                double y          = 200;

                // Change the position of the stamp to new x and y position
                pdfContentEditor.MoveStamp(pageId, stampIndex, x, y);

                // Save the Pdf file
                pdfContentEditor.Save(dataDir + "ChangeStampPosition_out_.pdf");
                // ExEnd:ChangeStampPosition
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemple #9
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();
            //open document
            PdfFileStamp fileStamp = new PdfFileStamp(dataDir + "AddImage-Footer.pdf", dataDir + "AddImage-Footer_out.pdf");

            //add footer
            fileStamp.AddFooter(new FileStream(dataDir + "aspose-logo.jpg", FileMode.Open), 10);

            //save updated PDF file
            fileStamp.Close();
        }
Exemple #10
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();

            //open document
            PdfFileStamp fileStamp = new PdfFileStamp(dataDir + "AddHeader.pdf", dataDir + "AddHeader_out.pdf");

            //create formatted text for page number
            FormattedText formattedText = new FormattedText("Aspose - Your File Format Experts!", System.Drawing.Color.Blue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, false, 14);

            //add header
            fileStamp.AddHeader(formattedText, 10);

            //save updated PDF file
            fileStamp.Close();
        }
        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 Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();
            //Instantiate PdfContentEditor Object
            PdfContentEditor pdfContentEditor = new PdfContentEditor();

            ////bind input PDF file
            pdfContentEditor.BindPdf(dataDir + "ExtractImage-ImageStamp.pdf");

            //Get Stamp info for the first stamp
            StampInfo[] infos = pdfContentEditor.GetStamps(1);

            //Get the image from Stamp Info

            System.Drawing.Image image = infos[0].Image;

            //Save the extracted image
            image.Save(dataDir + "image.jpg");
        }
Exemple #13
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();
            //open document
            PdfFileStamp fileStamp = new PdfFileStamp(dataDir + "AddImageStampAll.pdf", dataDir + "AddImageStampAll_out.pdf");

            //create stamp
            Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();
            stamp.BindImage(dataDir + "aspose-logo.jpg");
            stamp.SetOrigin(200, 200);
            stamp.Rotation     = 90.0F;
            stamp.IsBackground = true;

            //add stamp to PDF file
            fileStamp.AddStamp(stamp);

            //save updated PDF file
            fileStamp.Close();
        }
Exemple #14
0
        public static void Run()
        {
            // ExStart:AddImageFooter
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();

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

            // Open Document
            fileStamp.BindPdf(dataDir + "AddImage-Footer.pdf");

            // Add footer
            fileStamp.AddFooter(new FileStream(dataDir + "aspose-logo.jpg", FileMode.Open), 10);

            // Save updated PDF file
            fileStamp.Save(dataDir + "AddImage-Footer_out.pdf");

            // Close fileStamp
            fileStamp.Close();
            // ExEnd:AddImageFooter
        }
Exemple #15
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();

            //Instantiate PdfContentEditor Object
            PdfContentEditor pdfContentEditor = new PdfContentEditor();

            ////bind input PDF file
            pdfContentEditor.BindPdf(dataDir + "ChangeStampPosition.pdf");

            int    pageId     = 1;
            int    stampIndex = 1;
            double x          = 200;
            double y          = 200;

            //Change the position of the stamp to new x and y position
            pdfContentEditor.MoveStamp(pageId, stampIndex, x, y);

            //Save the PDF file
            pdfContentEditor.Save(dataDir + "ChangeStampPosition_out.pdf");
        }