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);
            }
        }
        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);
            }
            
        }
Exemplo n.º 3
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //Instantiate PdfContentEditor Object
            PdfContentEditor pdfContentEditor = new PdfContentEditor();

            ////bind input PDF file
            pdfContentEditor.BindPdf(dataDir + "input.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");
        }
        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");
        }
Exemplo n.º 5
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //Instantiate PdfContentEditor Object
            PdfContentEditor pdfContentEditor = new PdfContentEditor();

            ////bind input PDF file
            pdfContentEditor.BindPdf(dataDir+ "input.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");
        }
Exemplo n.º 6
0
        private Document RemoveExistingWatermarks(Document pdfDocument)
        {
            PdfContentEditor ped = new PdfContentEditor(pdfDocument);

            for (int i = 1; i <= pdfDocument.Pages.Count; i++)
            {
                double pHeight = pdfDocument.Pages[i].Rect.Height;
                double pWidth  = pdfDocument.Pages[i].Rect.Width;

                StampInfo[] vstamp     = ped.GetStamps(i);
                List <int>  ltToDelete = new List <int>();
                for (int j = 0; j < vstamp.Length; j++)
                {
                    if (StampType.Form == vstamp[j].StampType)
                    {
                        if ((vstamp[j].Rectangle.Height * 100) / pHeight >= 30 || (vstamp[j].Rectangle.Width * 100) / pWidth >= 30)
                        {
                            ltToDelete.Add(j);
                        }
                    }
                }

                int[] vToDelete = new int[ltToDelete.Count];
                for (int j = 0; j < ltToDelete.Count; j++)
                {
                    vToDelete[j] = ltToDelete[j];
                }

                ped.DeleteStamp(i, vToDelete);
            }


            MemoryStream outStream = new MemoryStream();

            ped.Save(outStream);
            Document pdfDocumentNoStamps = new Document(outStream);

            return(pdfDocumentNoStamps);
        }
        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");
 
            
            
        }