static void Main(string[] args)
        {
            Console.WriteLine("Ghostscript.NET Samples");

            if (!GhostscriptVersionInfo.IsGhostscriptInstalled)
            {
                throw new Exception("You don't have Ghostscript installed on this machine!");
            }

            ISample sample;

            //sample = new GetInkCoverageSample();
            sample = new ProcessorSample1();
            //sample = new ProcessorSample2();
            //sample = new FindInstalledGhostscriptVersionsSample();
            //sample = new RunMultipleInstancesSample();
            //sample = new ViewerSample();
            //sample = new RasterizerSample1();
            //sample = new RasterizerSample2();
            //sample = new AddWatermarkSample();
            //sample = new DeviceUsageSample();
            //sample = new PipedOutputSample();
            //sample = new SendToPrinterSample();
            //sample = new RasterizerCropSample();

            sample.Start();

            Console.ReadLine();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Ghostscript.NET Samples");

            if (!GhostscriptVersionInfo.IsGhostscriptInstalled)
            {
                throw new Exception("You don't have Ghostscript installed on this machine!");
            }

            ISample sample;

            //sample = new GetInkCoverageSample();
            sample = new ProcessorSample1();
            //sample = new ProcessorSample2();
            //sample = new FindInstalledGhostscriptVersionsSample();
            //sample = new RunMultipleInstancesSample();
            //sample = new ViewerSample();
            //sample = new RasterizerSample1();
            //sample = new RasterizerSample2();
            //sample = new AddWatermarkSample();
            //sample = new DeviceUsageSample();
            //sample = new PipedOutputSample();
            //sample = new SendToPrinterSample();
            //sample = new RasterizerCropSample();

            sample.Start();

            Console.ReadLine();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Ghostscript.NET Samples");

            if (!GhostscriptVersionInfo.IsGhostscriptInstalled)
            {
                throw new Exception("You don't have Ghostscript installed on this machine!");
            }

            ISample sample = null;

            int.TryParse(args.Length >= 1 ? args[0] : "", out int choice);

            for (choice = 1; ; choice++)
            {
                try
                {
                    switch (choice)
                    {
                    case 1:
                        sample = new GetInkCoverageSample();
                        break;

                    case 2:
                        sample = new ProcessorSample1();
                        break;

                    case 3:
                        sample = new ProcessorSample2();
                        break;

                    case 4:
                        sample = new FindInstalledGhostscriptVersionsSample();
                        break;

                    case 5:
                        sample = new RunMultipleInstancesSample();
                        break;

                    case 6:
                        sample = new ViewerSample();
                        break;

                    case 7:
                        sample = new RasterizerSample1();
                        break;

                    case 8:
                        sample = new RasterizerSample2();
                        break;

                    case 9:
                        sample = new AddWatermarkSample();
                        break;

                    case 10:
                        sample = new DeviceUsageSample();
                        break;

                    case 11:
                        sample = new PipedOutputSample();
                        break;

                    case 12:
                        sample = new SendToPrinterSample();
                        break;

                    case 13:
                        sample = new RasterizerCropSample();
                        break;

                    case 14:
                        sample = new ProcessorSample3();
                        break;

                    case 15:
                        sample = new ProcessorSample4();
                        break;

                    default:
                        sample = null;
                        break;
                    }

                    if (sample == null)
                    {
                        break;
                    }

                    sample.Start();
                }
                catch (GhostscriptException ex)
                {
                    Console.WriteLine($"Sample {choice}: GhostScript Error {ex.Code} ({ex.CodeName ?? "<unknown>"}) --> Exception: {ex}");
                    if (!String.IsNullOrEmpty(ex.GhostScriptOutput))
                    {
                        Console.WriteLine($"\n*** GS stdio output: ***\n{ ex.GhostScriptOutput }\n\n");
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Sample {choice}: Exception: {ex}");
                }

                Console.ReadLine();
            }
        }