コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public GhostscriptRasterizer()
 {
     _viewer = new GhostscriptViewer();
     _viewer.ShowPageAfterOpen = false;
     _viewer.ProgressiveUpdate = false;
     _viewer.DisplayPage += new GhostscriptViewerViewEventHandler(_viewer_DisplayPage);
 }
コード例 #4
0
ファイル: Reader.xaml.cs プロジェクト: nandusharma/ocrdemo
        public Reader()
        {
            InitializeComponent();

            _viewer = new GhostscriptViewer();

            _viewer.DisplaySize += new GhostscriptViewerViewEventHandler(_viewer_DisplaySize);
            _viewer.DisplayUpdate += new GhostscriptViewerViewEventHandler(_viewer_DisplayUpdate);
            _viewer.DisplayPage += new GhostscriptViewerViewEventHandler(_viewer_DisplayPage);
        }
コード例 #5
0
        public GhostscriptRasterizer(GhostscriptStdIO stdIo)
        {
            _viewer = new GhostscriptViewer();
            _viewer.ShowPageAfterOpen = false;
            _viewer.ProgressiveUpdate = false;
            _viewer.DisplayPage += new GhostscriptViewerViewEventHandler(_viewer_DisplayPage);

            if (stdIo != null)
            {
                _viewer.AttachStdIO(stdIo);
            }
        }
コード例 #6
0
        public GhostscriptRasterizer(GhostscriptViewer viewerInstance)
        {
            if (viewerInstance == null)
            {
                throw new ArgumentNullException("viewerInstance");
            }

            _viewer = viewerInstance;
            _gsViewState = _viewer.SaveState();
            _viewer.ProgressiveUpdate = false;
            _viewer.DisplayPage += new GhostscriptViewerViewEventHandler(_viewer_DisplayPage);
        }
コード例 #7
0
ファイル: FMain.cs プロジェクト: dcga/Ghostscript.NET
        public FMain()
        {
            InitializeComponent();

            this.Text = Program.NAME;

            pbPage.Width = 100;
            pbPage.Height = 100;

            _viewer = new GhostscriptViewer();

            _viewer.DisplaySize += new GhostscriptViewerViewEventHandler(_viewer_DisplaySize);
            _viewer.DisplayUpdate += new GhostscriptViewerViewEventHandler(_viewer_DisplayUpdate);
            _viewer.DisplayPage += new GhostscriptViewerViewEventHandler(_viewer_DisplayPage);
        }
コード例 #8
0
        public FMain()
        {
            InitializeComponent();

            this.Text = Program.NAME;

            pbPage.Width  = 100;
            pbPage.Height = 100;

            _viewer = new GhostscriptViewer();

            _viewer.DisplaySize   += new GhostscriptViewerViewEventHandler(_viewer_DisplaySize);
            _viewer.DisplayUpdate += new GhostscriptViewerViewEventHandler(_viewer_DisplayUpdate);
            _viewer.DisplayPage   += new GhostscriptViewerViewEventHandler(_viewer_DisplayPage);
        }
コード例 #9
0
ファイル: FMain.cs プロジェクト: dcga/Ghostscript.NET
        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);
        }
コード例 #10
0
 public GhostscriptViewerDefaultFormatHandler(GhostscriptViewer viewer) : base(viewer)
 {
 }
 public GhostscriptViewerDisplayHandler(GhostscriptViewer viewer)
 {
     _viewer = viewer;
 }
コード例 #12
0
 public GhostscriptViewerStdIOHandler(GhostscriptViewer viewer, GhostscriptViewerFormatHandler formatHandler) : base(true, true, true)
 {
     _viewer = viewer;
     _formatHandler = formatHandler;
 }
コード例 #13
0
 public GhostscriptViewerStdIOHandler(GhostscriptViewer viewer, GhostscriptViewerFormatHandler formatHandler) : base(true, true, true)
 {
     _viewer        = viewer;
     _formatHandler = formatHandler;
 }
コード例 #14
0
 public GhostscriptViewerPdfFormatHandler(GhostscriptViewer viewer) : base(viewer)
 {
 }
コード例 #15
0
 public GhostscriptViewerDisplayHandler(GhostscriptViewer viewer)
 {
     _viewer = viewer;
 }
コード例 #16
0
ファイル: FMain.cs プロジェクト: dcga/Ghostscript.NET
 private void FMain_FormClosed(object sender, FormClosedEventArgs e)
 {
     _viewer.Dispose();
     _viewer = null;
 }
コード例 #17
0
 public GhostscriptViewerDefaultFormatHandler(GhostscriptViewer viewer) : base(viewer) { }
コード例 #18
0
 public GhostscriptViewerFormatHandler(GhostscriptViewer viewer)
 {
     _viewer = viewer;
 }
コード例 #19
0
 public GhostscriptViewerPdfFormatHandler(GhostscriptViewer viewer) : base(viewer) { }
コード例 #20
0
 public GhostscriptViewerDisplayHandler(GhostscriptViewer viewer) : base(viewer.Interpreter.GhostscriptLibrary)
 {
     _viewer = viewer;
 }
コード例 #21
0
 public GhostscriptViewerFormatHandler(GhostscriptViewer viewer)
 {
     _viewer = viewer;
 }
コード例 #22
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    if (_gsViewState == null)
                    {
                        if (_viewer != null)
                        {
                            _viewer.Dispose();
                            _viewer = null;
                        }
                    }
                    else
                    {
                        _viewer.RestoreState(_gsViewState);
                    }
                }

                _disposed = true;
            }
        }