Open() private method

private Open ( ) : void
return void
        public void Start()
        {
            // there can be multiple Ghostscript versions installed on the system
            // and we can choose which one we will use. In this sample we will use
            // the last installed Ghostscript version. We can choose if we want to
            // use GPL or AFPL (commercial) version of the Ghostscript. By setting
            // the parameters below we told that we want to fetch the last version
            // of the GPL or AFPL Ghostscript and if both are available we prefer
            // to use GPL version.

            _lastInstalledVersion =
                GhostscriptVersionInfo.GetLastInstalledVersion(
                        GhostscriptLicense.GPL | GhostscriptLicense.AFPL,
                        GhostscriptLicense.GPL);

            // create a new instance of the viewer
            _viewer = new GhostscriptViewer();

            // set the display update interval to 10 times per second. This value
            // is milliseconds based and updating display every 100 milliseconds
            // is optimal value. The smaller value you set the rasterizing will
            // take longer as DisplayUpdate event will be raised more often.
            _viewer.ProgressiveUpdateInterval = 100;

            // attach three main viewer events
            _viewer.DisplaySize += new GhostscriptViewerViewEventHandler(_viewer_DisplaySize);
            _viewer.DisplayUpdate += new GhostscriptViewerViewEventHandler(_viewer_DisplayUpdate);
            _viewer.DisplayPage += new GhostscriptViewerViewEventHandler(_viewer_DisplayPage);

            // open PDF file using the last Ghostscript version. If you want to use
            // multiple viewers withing a single process then you need to pass 'true'
            // value as the last parameter of the method below in order to tell the
            // viewer to load Ghostscript from the memory and not from the disk.
            _viewer.Open("E:\test\test.pdf",_lastInstalledVersion, false);
        }
        public void Start()
        {
            // For users who distribute their gsdll32.dll or gsdll64.dll with their application: Ghostscript.NET by default
            // peeks into the registry to collect all installed Ghostscript locations. If you want to use ghostscript dll from
            // a custom location, it's recommended to do something like this:

            GhostscriptVersionInfo gvi = new GhostscriptVersionInfo(
                    new Version(0, 0, 0),
                    @"e:\dumyfolder\myapplication\gsdll32.dll",
                    string.Empty,
                    GhostscriptLicense.GPL);

            // and then pass that GhostscriptVersionInfo to required constructor or method

            // sample #1
            GhostscriptProcessor proc = new GhostscriptProcessor(gvi);

            // sample #2
            GhostscriptRasterizer rast = new GhostscriptRasterizer();
            rast.Open("test.pdf", gvi, true);

            // sample #3
            GhostscriptViewer view = new GhostscriptViewer();
            view.Open("test.pdf", gvi, true);
        }
Ejemplo n.º 3
0
        private void mnuFileOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title  = "Open PDF file";
            ofd.Filter = "PDF, PS files|*.pdf;*.ps";

            if (ofd.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                mnuFileClose_Click(this, null);

                _viewer.Open(ofd.FileName, _gsVersion, false);
                this.Text = System.IO.Path.GetFileName(ofd.FileName) + " - " + Program.NAME;
            }
        }
Ejemplo n.º 4
0
        private void FMain_Load(object sender, EventArgs e)
        {
            txtOutput.AppendText("Is64BitOperatingSystem: " + System.Environment.Is64BitOperatingSystem.ToString() + "\r\n");
            txtOutput.AppendText("Is64BitProcess: " + System.Environment.Is64BitProcess.ToString() + "\r\n");

            _preview.Show();
            this.Show();

            GhostscriptVersionInfo gvi =  GhostscriptVersionInfo.GetLastInstalledVersion();

            _viewer = new GhostscriptViewer();

            _viewer.AttachStdIO(_stdioHandler);
            
            _viewer.DisplaySize += new GhostscriptViewerViewEventHandler(_viewer_DisplaySize);
            _viewer.DisplayUpdate += new GhostscriptViewerViewEventHandler(_viewer_DisplayUpdate);
            _viewer.DisplayPage += new GhostscriptViewerViewEventHandler(_viewer_DisplayPage);

            _viewer.Open(gvi, true);
        }