コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: surjit/mupdf-1
		/* MuPDF Result*/
		public void MuPDFResult(ConvertParams_t gs_result)
		{
			if (gs_result.result == GS_Result_t.gsCANCELLED)
			{
				xaml_MuPDFGrid.Visibility = System.Windows.Visibility.Collapsed;
				return;
			}
			if (gs_result.result == GS_Result_t.gsFAILED)
			{
				xaml_MuPDFGrid.Visibility = System.Windows.Visibility.Collapsed;
				ShowMessage(NotifyType_t.MESS_STATUS, "MuPDF Failed Conversion");
				return;
			}
			ShowMessage(NotifyType_t.MESS_STATUS, "MuPDF Completed Conversion");
		}
コード例 #2
0
ファイル: mudocument.cs プロジェクト: surjit/mupdf-1
 private void MuPDFProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     /* Callback with progress */
     ConvertParams_t Value = new ConvertParams_t();
     muPDFEventArgs info = new muPDFEventArgs(false, e.ProgressPercentage, Value);
     mupdfUpdateMain(this, info);
 }
コード例 #3
0
ファイル: mudocument.cs プロジェクト: surjit/mupdf-1
        private void MuPDFCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            ConvertParams_t Value;
            muPDFEventArgs info;

            if (e.Cancelled)
            {
                Value = new ConvertParams_t();
                Value.result = GS_Result_t.gsCANCELLED;
                info = new muPDFEventArgs(true, 100, Value);
            }
            else
            {
                Value = (ConvertParams_t)e.Result;
                info = new muPDFEventArgs(true, 100, Value);
            }
            mupdfUpdateMain(this, info);
        }
コード例 #4
0
ファイル: mudocument.cs プロジェクト: surjit/mupdf-1
        /* Render page by page in background with progress call back */
        private gsStatus ConvertMuPDF(ConvertParams_t Params)
        {
            try
            {
                if (m_worker != null && m_worker.IsBusy)
                {
                    m_worker.CancelAsync();
                    return gsStatus.GS_BUSY;
                }
                if (m_worker == null)
                {
                    m_worker = new BackgroundWorker();
                    m_worker.WorkerReportsProgress = true;
                    m_worker.WorkerSupportsCancellation = true;
                    m_worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(MuPDFCompleted);
                    m_worker.ProgressChanged += new ProgressChangedEventHandler(MuPDFProgressChanged);
                    m_worker.DoWork += new DoWorkEventHandler(MuPDFWork);
                }

                m_params = Params;
                m_worker.RunWorkerAsync(Params);
                return gsStatus.GS_READY;
            }
            catch (OutOfMemoryException e)
            {
                Console.WriteLine("Memory allocation failed during mupdf rendering\n");
                return gsStatus.GS_ERROR;
            }
        }
コード例 #5
0
ファイル: mudocument.cs プロジェクト: surjit/mupdf-1
 public muPDFEventArgs(bool completed, int progress, ConvertParams_t param)
 {
     m_completed = completed;
     m_progress = progress;
     m_param = param;
 }
コード例 #6
0
ファイル: mudocument.cs プロジェクト: surjit/mupdf-1
        public gsStatus ConvertSave(gsDevice_t device, String outputFile, int num_pages, 
			System.Collections.IList pages, int resolution)
        {
            ConvertParams_t convertparams = new ConvertParams_t();

            convertparams.device = device;
            convertparams.outputfile = outputFile;
            convertparams.num_pages = num_pages;
            convertparams.resolution = resolution;
            convertparams.pages = pages;
            convertparams.currpage = 1;
            return ConvertMuPDF(convertparams);
        }