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(); // 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 Open(Stream stream, GhostscriptVersionInfo versionInfo, bool dllFromMemory) { if (stream == null) { throw new ArgumentNullException("stream"); } if (versionInfo == null) { throw new ArgumentNullException("versionInfo"); } if (_gsViewState == null) { _viewer.Open(stream, versionInfo, dllFromMemory); } }
public void LoadPreview() { //wbPreview.Navigate(@"about:blank"); //SpinWait.SpinUntil(() => wbPreview.IsBusy == false); //Application.DoEvents(); //Thread.Sleep(1000); if (TempFileDataPath != "") { _viewer.Open(TempFileDataPath, _gsVersion, true); _viewer.Zoom(1); //wbPreview.Navigate(string.Format(@"file:///{0}", TempFileDataPath)); //SpinWait.SpinUntil(() => wbPreview.IsBusy == false); //Application.DoEvents(); } }
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); }
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(@"e:\dummyfolder\myapplication\gsdll32.dll"); // and then pass that GhostscriptVersionInfo to the 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); }