public static void Run()
        {
            // ExStart:ConvertAllPagesToEMF
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Images();

            // Open document
            Document pdfDocument = new Document(dataDir+ "ConvertAllPagesToEMF.pdf");

            for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
            {
                using (FileStream imageStream = new FileStream(dataDir + "image" + pageCount + "_out" + ".emf", FileMode.Create))
                {
                    // Create Resolution object
                    Resolution resolution = new Resolution(300);
                    // Create PNG device with specified attributes
                    // Width, Height, Resolution
                    EmfDevice emfDevice = new EmfDevice(500, 700, resolution);

                    // Convert a particular page and save the image to stream
                    emfDevice.Process(pdfDocument.Pages[pageCount], imageStream);

                    // Close stream
                    imageStream.Close();

                }
            }
            // ExEnd:ConvertAllPagesToEMF
            System.Console.WriteLine("PDF pages are converted to EMF successfully!");
        }
Esempio n. 2
0
        ///<Summary>
        /// ConvertPdfToEmf method to convert PDF to Emf
        ///</Summary>
        public Response ConvertPdfToEmf(string fileName, string folderName)
        {
            return(ProcessTask(fileName, folderName, ".emf", true, "", true, delegate(string inFilePath, string outPath, string zipOutFolder)
            {
                Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(inFilePath);

                string outfileName = Path.GetFileNameWithoutExtension(fileName) + "_{0}";
                int totalPages = pdfDocument.Pages.Count;

                for (int pageCount = 1; pageCount <= totalPages; pageCount++)
                {
                    if (totalPages > 1)
                    {
                        outPath = zipOutFolder + "/" + outfileName;
                        outPath = string.Format(outPath, pageCount);
                    }
                    else
                    {
                        outPath = zipOutFolder + "/" + Path.GetFileNameWithoutExtension(fileName);
                    }

                    Resolution resolution = new Resolution(300);
                    var emfDevice = new EmfDevice(resolution);
                    emfDevice.Process(pdfDocument.Pages[pageCount], outPath + ".emf");
                }
            }));
        }
Esempio n. 3
0
        public static void Run()
        {
            // ExStart:ConvertAllPagesToEMF
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Images();

            // Open document
            Document pdfDocument = new Document(dataDir + "ConvertAllPagesToEMF.pdf");

            for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
            {
                using (FileStream imageStream = new FileStream(dataDir + "image" + pageCount + "_out_" + ".emf", FileMode.Create))
                {
                    // Create Resolution object
                    Resolution resolution = new Resolution(300);
                    // Create PNG device with specified attributes
                    // Width, Height, Resolution
                    EmfDevice emfDevice = new EmfDevice(500, 700, resolution);

                    // Convert a particular page and save the image to stream
                    emfDevice.Process(pdfDocument.Pages[pageCount], imageStream);

                    // Close stream
                    imageStream.Close();
                }
            }
            // ExEnd:ConvertAllPagesToEMF
            System.Console.WriteLine("PDF pages are converted to EMF successfully!");
        }
Esempio n. 4
0
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //open document
            Document pdfDocument = new Document(dataDir + "input.pdf");

            for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
            {
                using (FileStream imageStream = new FileStream(dataDir + "image" + pageCount + ".emf", FileMode.Create))
                {
                    //create Resolution object
                    Resolution resolution = new Resolution(300);
                    //create PNG device with specified attributes
                    //Width, Height, Resolution
                    EmfDevice emfDevice = new EmfDevice(500, 700, resolution);

                    //convert a particular page and save the image to stream
                    emfDevice.Process(pdfDocument.Pages[pageCount], imageStream);

                    //close stream
                    imageStream.Close();
                }
            }
        }
Esempio n. 5
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Images();

            //open document
            Document pdfDocument = new Document(dataDir+ "PageToEMF.pdf");


            using (FileStream imageStream = new FileStream(dataDir + "image.emf", FileMode.Create))
            {
                //create Resolution object
                Resolution resolution = new Resolution(300);
                //create EMF device with specified attributes
                //Width, Height, Resolution
                EmfDevice emfDevice = new EmfDevice(500, 700, resolution);

                //convert a particular page and save the image to stream
                emfDevice.Process(pdfDocument.Pages[1], imageStream);

                //close stream
                imageStream.Close();
            }
 
            
            
        }
Esempio n. 6
0
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //open document
            Document pdfDocument = new Document(dataDir+ "input.pdf");

            using (FileStream imageStream = new FileStream(dataDir + "image.emf", FileMode.Create))
            {
                //create Resolution object
                Resolution resolution = new Resolution(300);
                //create EMF device with specified attributes
                //Width, Height, Resolution
                EmfDevice emfDevice = new EmfDevice(500, 700, resolution);

                //convert a particular page and save the image to stream
                emfDevice.Process(pdfDocument.Pages[1], imageStream);

                //close stream
                imageStream.Close();
            }
        }
Esempio n. 7
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Images();

            //open document
            Document pdfDocument = new Document(dataDir + "PageToEMF.pdf");


            using (FileStream imageStream = new FileStream(dataDir + "image.emf", FileMode.Create))
            {
                //create Resolution object
                Resolution resolution = new Resolution(300);
                //create EMF device with specified attributes
                //Width, Height, Resolution
                EmfDevice emfDevice = new EmfDevice(500, 700, resolution);

                //convert a particular page and save the image to stream
                emfDevice.Process(pdfDocument.Pages[1], imageStream);

                //close stream
                imageStream.Close();
            }
        }