コード例 #1
3
 private void FormClosing(object sender, FormClosingEventArgs e)
 {
     if (_adobeReader != null)
     {
         // This purposely SUPPRESSES the Dispose of _adobeReader that otherwise automatically happens
         // as the window shuts down. For some reason Dispose of this object is VERY slow; around 16 seconds
         // on my fast desktop. I don't think it can hang on to any important resources once the app
         // quits, so just prevent the Dispose.
         // (I tried various other things, such as loading a non-existent file and catching the resulting
         // exception, hiding the _adobeReader, Disposing it in advance (in this method)...nothing else
         // prevented the long delay on shutdown.)
         this.Controls.Remove(_adobeReader);
         _adobeReader = null;
     }
 }
コード例 #2
1
 private void removePDFControls()
 {
     try
     {
         foreach (Control p in pnlPDFViewer.Controls)
         {
             if (p.GetType() == typeof(AxAcroPDFLib.AxAcroPDF))
             {
                 AxAcroPDFLib.AxAcroPDF c = (AxAcroPDFLib.AxAcroPDF)p;
                 c.Visible = false;
                 pnlPDFViewer.Controls.Remove(c);
                 c.Dispose();
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
コード例 #3
0
ファイル: PageDocument.xaml.cs プロジェクト: junzheng/YF17A
        private void PageLoaded(object sender, RoutedEventArgs e)
        {
            host = new System.Windows.Forms.Integration.WindowsFormsHost();
            pdfviewer = new AxAcroPDFLib.AxAcroPDF();
            host.Child = pdfviewer;
            this.Stage.Children.Add(host);

            pdfviewer.setShowToolbar(false);
            pdfviewer.setShowScrollbars(true);

            PageDataExchange sInstance = PageDataExchange.getInstance();

            Dictionary<String,Object> bundle = sInstance.getExtra(PageDocument.TAG);
            Object action;
            bundle.TryGetValue( PageDataExchange.KEY_SENDER_VALUE, out action);

            if (action != null)
            {
                if (MenuControl.ACTION_MANUAL.Equals(action.ToString()))
                {
                    mDocumentFile = ManualFile;
                }
                else if (MenuControl.ACTION_ELECTRIC.Equals(action.ToString()))
                {
                    mDocumentFile = ElectricFile;
                }
            }

            String filePath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
            pdfviewer.LoadFile(Path.Combine(filePath, mDocumentFile));
        }
コード例 #4
0
 private bool InitializeAdobeReader()
 {
     try
     {
         this._adobeReader = new AxAcroPDFLib.AxAcroPDF();
         ((System.ComponentModel.ISupportInitialize) (this._adobeReader)).BeginInit();
         this._adobeReader.Dock = DockStyle.Fill;
         this._adobeReader.Enabled = true;
         this._adobeReader.Location = new System.Drawing.Point(103, 3);
         this._adobeReader.Name = "_adobeReader";
         //this._adobeReader.TabIndex = 5;
         this.Controls.Add(this._adobeReader);
         ((System.ComponentModel.ISupportInitialize) (this._adobeReader)).EndInit();
         return true;
     }
     catch (Exception error)
     {
         if (error.Message.Contains("0x80040154"))
         {
             _problemLabel.Text = LocalizationManager.GetString("PublishTab.AdobeReaderControl.NotInstalled", "Please install Adobe Reader so that Bloom can show your completed book. Until then, you can still save the PDF Book and open it in some other program.");
         }
         else
         {
             _problemLabel.Text = LocalizationManager.GetString("PublishTab.AdobeReaderControl.UnknownError", "Sad News. Bloom wasn't able to get Adobe Reader to show here, so Bloom can't show your completed book.\r\nPlease uninstall your existing version of 'Adobe Reader' and (re)install 'Adobe Reader'.\r\nUntil you get that fixed, you can still save the PDF Book and open it in some other program.");
         }
         _problemLabel.Visible = _problemPicture.Visible = true;
         if (this.Controls.Contains(this._adobeReader))//this actually gets in before the error
         {
             this.Controls.Remove(this._adobeReader);
         }
         _adobeReader = null;
         Enabled = false;
         return false;
     }
 }
コード例 #5
0
 private bool Initialize()
 {
     try
     {
         if (axAcroPDF1 != null)
         {
             Dispose();
         }
         this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();
         ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).BeginInit();
         m_parent.SuspendLayout();
         this.axAcroPDF1.Parent   = m_parent;
         this.axAcroPDF1.Visible  = false;
         this.axAcroPDF1.Enabled  = false;
         this.axAcroPDF1.Dock     = System.Windows.Forms.DockStyle.Fill;
         this.axAcroPDF1.Location = new System.Drawing.Point(0, 0);
         this.axAcroPDF1.Name     = "axAcroPDF1";
         this.axAcroPDF1.Size     = new System.Drawing.Size(m_parent.Bounds.Width, m_parent.Bounds.Height);
         this.axAcroPDF1.TabIndex = 0;
         m_parent.Controls.Add(this.axAcroPDF1);
         ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).EndInit();
         m_parent.ResumeLayout();
         axAcroPDF1.setShowScrollbars(true);
         axAcroPDF1.setShowToolbar(false);
         axAcroPDF1.setLayoutMode("SinglePage");
         axAcroPDF1.setPageMode("thumbs");
         axAcroPDF1.setView("FitH");
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
コード例 #6
0
        private void showPDFFile(string fname)
        {
            try
            {
                removePDFControls();
                AxAcroPDFLib.AxAcroPDF pdf = new AxAcroPDFLib.AxAcroPDF();
                pdf.Dock     = System.Windows.Forms.DockStyle.Fill;
                pdf.Enabled  = true;
                pdf.Location = new System.Drawing.Point(0, 0);
                pdf.Name     = "pdfReader";
                pdf.OcxState = pdf.OcxState;
                ////pdf.OcxState = ((System.Windows.Forms.AxHost.State)(new System.ComponentModel.ComponentResourceManager(typeof(ViewerWindow)).GetObject("pdf.OcxState")));
                pdf.TabIndex = 1;
                pnlPDFViewer.Controls.Add(pdf);

                pdf.setShowToolbar(false);
                pdf.LoadFile(fname);
                pdf.setView("Fit");
                pdf.Visible = true;
                pdf.setZoom(100);
                pdf.setPageMode("None");
            }
            catch (Exception ex)
            {
            }
        }
コード例 #7
0
ファイル: PageDocument.xaml.cs プロジェクト: junzheng/YF17A
        private void PageLoaded(object sender, RoutedEventArgs e)
        {
            host       = new System.Windows.Forms.Integration.WindowsFormsHost();
            pdfviewer  = new AxAcroPDFLib.AxAcroPDF();
            host.Child = pdfviewer;
            this.Stage.Children.Add(host);

            pdfviewer.setShowToolbar(false);
            pdfviewer.setShowScrollbars(true);

            PageDataExchange sInstance = PageDataExchange.getInstance();

            Dictionary <String, Object> bundle = sInstance.getExtra(PageDocument.TAG);
            Object action;

            bundle.TryGetValue(PageDataExchange.KEY_SENDER_VALUE, out action);


            if (action != null)
            {
                if (MenuControl.ACTION_MANUAL.Equals(action.ToString()))
                {
                    mDocumentFile = ManualFile;
                }
                else if (MenuControl.ACTION_ELECTRIC.Equals(action.ToString()))
                {
                    mDocumentFile = ElectricFile;
                }
            }

            String filePath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);

            pdfviewer.LoadFile(Path.Combine(filePath, mDocumentFile));
        }
コード例 #8
0
 private bool InitializeAdobeReader()
 {
     try
     {
         this._adobeReader = new AxAcroPDFLib.AxAcroPDF();
         ((System.ComponentModel.ISupportInitialize)(this._adobeReader)).BeginInit();
         this._adobeReader.Dock     = DockStyle.Fill;
         this._adobeReader.Enabled  = true;
         this._adobeReader.Location = new System.Drawing.Point(103, 3);
         this._adobeReader.Name     = "_adobeReader";
         //this._adobeReader.TabIndex = 5;
         this.Controls.Add(this._adobeReader);
         ((System.ComponentModel.ISupportInitialize)(this._adobeReader)).EndInit();
         return(true);
     }
     catch (Exception error)
     {
         if (error.Message.Contains("0x80040154"))
         {
             _problemLabel.Text = LocalizationManager.GetString("PublishTab.AdobeReaderControl.NotInstalled", "Please install Adobe Reader so that Bloom can show your completed book. Until then, you can still save the PDF Book and open it in some other program.");
         }
         else
         {
             _problemLabel.Text = LocalizationManager.GetString("PublishTab.AdobeReaderControl.UnknownError", "Sad News. Bloom wasn't able to get Adobe Reader to show here, so Bloom can't show your completed book.\r\nPlease uninstall your existing version of 'Adobe Reader' and (re)install 'Adobe Reader'.\r\nUntil you get that fixed, you can still save the PDF Book and open it in some other program.");
         }
         _problemLabel.Visible = _problemPicture.Visible = true;
         if (this.Controls.Contains(this._adobeReader))                //this actually gets in before the error
         {
             this.Controls.Remove(this._adobeReader);
         }
         _adobeReader = null;
         Enabled      = false;
         return(false);
     }
 }
コード例 #9
0
ファイル: PageDocument.xaml.cs プロジェクト: junzheng/YF17A
 private void PageUnloaded(object sender, RoutedEventArgs e)
 {
     this.Stage.Children.Remove(host);
     pdfviewer.Dispose();
     pdfviewer = null;
     host.Dispose();
     host = null;
 }
コード例 #10
0
 private void Dispose()
 {
     if (axAcroPDF1 != null)
     {
         axAcroPDF1.Dispose();
         axAcroPDF1 = null;
     }
 }
コード例 #11
0
 /// <summary>
 /// 获取控件,用于添加展示
 /// </summary>
 /// <returns></returns>
 System.Windows.Forms.Control IPreviewPdf.GetControl()
 {
     if (this.axAcroPDF1 == null)
     {
         this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();
     }
     return(this.axAcroPDF1);
 }
コード例 #12
0
 void IDisposable.Dispose()
 {
     if (axAcroPDF1 != null)
     {
         axAcroPDF1.Dispose();
         axAcroPDF1 = null;
     }
 }
コード例 #13
0
ファイル: PageDocument.xaml.cs プロジェクト: junzheng/YF17A
 private void PageUnloaded(object sender, RoutedEventArgs e)
 {
     this.Stage.Children.Remove(host);
     pdfviewer.Dispose();
     pdfviewer = null;
     host.Dispose();
     host = null;
 }
コード例 #14
0
 private void renderPDF(String caminho, AxAcroPDFLib.AxAcroPDF pdf)
 {
     if (File.Exists(caminho))
     {
         // Renderiza pdf
         pdf.LoadFile(caminho);
     }
     else
     {
         pdf.Hide();
     }
 }
コード例 #15
0
ファイル: Preview.designer.cs プロジェクト: pkurowsk/NI-FAFOS
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Preview));
     this.btnClose = new System.Windows.Forms.Button();
     this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();
     ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).BeginInit();
     this.SuspendLayout();
     //
     // btnClose
     //
     this.btnClose.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(23)))), ((int)(((byte)(49)))));
     this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.btnClose.ForeColor = System.Drawing.Color.White;
     this.btnClose.Location = new System.Drawing.Point(608, 571);
     this.btnClose.Margin = new System.Windows.Forms.Padding(2);
     this.btnClose.Name = "btnClose";
     this.btnClose.Size = new System.Drawing.Size(80, 51);
     this.btnClose.TabIndex = 1;
     this.btnClose.Text = "Close";
     this.btnClose.UseVisualStyleBackColor = false;
     this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
     //
     // axAcroPDF1
     //
     this.axAcroPDF1.Enabled = true;
     this.axAcroPDF1.Location = new System.Drawing.Point(12, 12);
     this.axAcroPDF1.Margin = new System.Windows.Forms.Padding(2);
     this.axAcroPDF1.Name = "axAcroPDF1";
     this.axAcroPDF1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF1.OcxState")));
     this.axAcroPDF1.Size = new System.Drawing.Size(906, 685);
     this.axAcroPDF1.TabIndex = 2;
     //
     // Preview
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.AutoScroll = true;
     this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.BackColor = System.Drawing.Color.White;
     this.ClientSize = new System.Drawing.Size(984, 609);
     this.Controls.Add(this.axAcroPDF1);
     this.Controls.Add(this.btnClose);
     this.Margin = new System.Windows.Forms.Padding(2);
     this.Name = "Preview";
     this.Text = "Preview";
     ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).EndInit();
     this.ResumeLayout(false);
 }
コード例 #16
0
 private void FormClosing(object sender, FormClosingEventArgs e)
 {
     if (_adobeReader != null)
     {
         // This purposely SUPPRESSES the Dispose of _adobeReader that otherwise automatically happens
         // as the window shuts down. For some reason Dispose of this object is VERY slow; around 16 seconds
         // on my fast desktop. I don't think it can hang on to any important resources once the app
         // quits, so just prevent the Dispose.
         // (I tried various other things, such as loading a non-existent file and catching the resulting
         // exception, hiding the _adobeReader, Disposing it in advance (in this method)...nothing else
         // prevented the long delay on shutdown.)
         this.Controls.Remove(_adobeReader);
         _adobeReader = null;
     }
 }
コード例 #17
0
ファイル: ManualsViewer.cs プロジェクト: ywjno/mynes-code
 public ManualsViewer()
 {
     InitializeComponent();
     // Create new pdf browser !
     try
     {
         pdfBrowser = new AxAcroPDFLib.AxAcroPDF();
         pdfBrowser.Parent = this;
         pdfBrowser.Dock = DockStyle.Fill;
         pdfBrowser.BringToFront();
         initialized = true;
         label1.Visible = false;
     }
     catch
     {
         initialized = false;
         label1.Visible = true;
     }
     Clear();
 }
コード例 #18
0
 public ManualsViewer()
 {
     InitializeComponent();
     // Create new pdf browser !
     try
     {
         pdfBrowser        = new AxAcroPDFLib.AxAcroPDF();
         pdfBrowser.Parent = this;
         pdfBrowser.Dock   = DockStyle.Fill;
         pdfBrowser.BringToFront();
         initialized    = true;
         label1.Visible = false;
     }
     catch
     {
         initialized    = false;
         label1.Visible = true;
     }
     Clear();
 }
コード例 #19
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PdfAcroViewer2));
     if (!this.designMode)
     {
         this.axAcroPDF = new AxAcroPDFLib.AxAcroPDF();
         ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF)).BeginInit();
     }
     this.SuspendLayout();
     //
     // axAcroPDF
     //
     if (!this.designMode)
     {
         this.axAcroPDF.Dock     = System.Windows.Forms.DockStyle.Fill;
         this.axAcroPDF.Enabled  = true;
         this.axAcroPDF.Location = new System.Drawing.Point(0, 0);
         this.axAcroPDF.Name     = "axAcroPDF";
         this.axAcroPDF.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF.OcxState")));
         this.axAcroPDF.Size     = new System.Drawing.Size(210, 297);
         this.axAcroPDF.TabIndex = 0;
     }
     //
     // PdfAcroViewer2
     //
     if (!this.designMode)
     {
         this.Controls.Add(this.axAcroPDF);
     }
     this.Name = "PdfAcroViewer2";
     this.Size = new System.Drawing.Size(210, 297);
     if (!this.designMode)
     {
         ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF)).EndInit();
     }
     this.ResumeLayout(false);
 }
コード例 #20
0
        // 将文件标记为书籍
        private void 添加信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count != 1)
            {
                return;
            }
            bool acrobatvalid = true;

            // 检测Acrobat控件是否能够使用
            try
            {
                AxAcroPDFLib.AxAcroPDF axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();
            }
            catch (Exception ex)
            {
                acrobatvalid = false;
            }

            INewBookView view;

            if (acrobatvalid)
            {
                view = new CreateBookFromFileForm();
            }
            else
            {
                view = new CreateBookFromFileNormalForm();
            }

            NewBookPresent p = new NewBookPresent(view, listView1.SelectedItems[0].Tag.ToString());

            if (view.ShowDialog() == DialogResult.OK)
            {
                listView1.Items.Remove(listView1.SelectedItems[0]);
            }
        }
コード例 #21
0
        private void Form1_Load(object sender, EventArgs e)
        {
            camList = new List <string>();
            getCamList(camList, comboBox1);
            start();
            Admin(false);
            string[] mySett = loadSett();
            PASSWORD = resByKey(find(mySett, "adminPass")); // считываем пароль админа
            string WD = resByKey(find(mySett, "workDir"));  // считываем рабочую диррикторию

            this.WindowState    = FormWindowState.Maximized;
            textBox1.Text       = WD;
            tabControl          = new TabControl();
            tabControl.Location = new Point(10, 10);
            tabControl.Size     = new Size(this.Size.Width - 280, 20);
            this.Controls.Add(tabControl);

            List <TabPage> listPage = new List <TabPage>();

            for (int i = 0; i < new DirectoryInfo(WD).GetFiles("*.pdf", System.IO.SearchOption.AllDirectories).Length; i++)
            {
                string headText = new DirectoryInfo(WD).GetFiles("*.pdf", System.IO.SearchOption.AllDirectories).GetValue(i).ToString();
                listPage.Add(new TabPage(headText));
                tabControl.Controls.Add(listPage.Last <TabPage>());
            }
            try
            {
                AxAcroPDFLib.AxAcroPDF AcroPDF = new AxAcroPDFLib.AxAcroPDF();
                AcroPDF.Size     = new Size(this.Width - 280, this.Size.Height - 100);
                AcroPDF.Location = new Point(10, 40);
                this.Controls.Add(AcroPDF);
                AcroPDF.LoadFile(WD + "/" + listPage.First <TabPage>().Text);
                AcroPDF.Show();

                tabControl.Selected += (s, ed) =>
                {
                    AcroPDF.LoadFile(WD + "/" + ed.TabPage.Text);
                    AcroPDF.Show();
                };
            }

            catch
            {
                MessageBox.Show("В указанной рабочей папке нет *.pdf файлов.");
            }

            string path = Directory.GetCurrentDirectory().ToString() + @"\Log\Users.txt";

            if (File.Exists(path))
            {
                string[] readText = File.ReadAllLines(path);
                foreach (string s in readText)
                {
                    Char delimiter = ',';
                    comboBox2.Items.Add(s.Split(delimiter)[0]);
                }
            }
            else
            {
                MessageBox.Show("Создайте файл Users");
            }
            //AcroPDFLib.AcroPDFClass a = new AcroPDFLib.AcroPDFClass();
        }
コード例 #22
0
 public void Dispose()
 {
     this.axAcroPDF1 = null;
 }
コード例 #23
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            /* The designer created code was modified to check the variable inVisualStudio2005.
             * Without this code Visual Studio 2005 will crash if the control is used in another designer.
             */
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PdfAcroViewer));
            if (!this.inVisualStudio2005)
            {
                if (this.acroPdfVersion >= 70)
                {
                    try
                    {
                        this.axAcroPDF7 = new AxAcroPDFLib.AxAcroPDF();
                        ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF7)).BeginInit();
                    }
                    catch
                    {
                        this.axAcroPDF7.Dispose();
                        this.axAcroPDF7 = null;
                    }
                }

                //if (this.acroPdfVersion >= 50 && this.axAcroPDF7 == null)
                //{
                //  try
                //  {
                //    this.axPdf6 = new AxPdfLib.AxPdf();
                //    ((System.ComponentModel.ISupportInitialize)(this.axPdf6)).BeginInit();
                //  }
                //  catch { }
                //}
                //if (this.axAcroPDF7 == null && this.axPdf6 == null)
                //  throw new InvalidOperationException("Cannot create control.");
            }
            this.SuspendLayout();
            //
            // axAcroPDF7
            //
            if (!this.inVisualStudio2005)
            {
                if (this.axAcroPDF7 != null)
                {
                    this.axAcroPDF7.Dock     = System.Windows.Forms.DockStyle.Fill;
                    this.axAcroPDF7.Enabled  = true;
                    this.axAcroPDF7.Location = new System.Drawing.Point(0, 0);
                    this.axAcroPDF7.Name     = "axAcroPDF7";
                    this.axAcroPDF7.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF7.OcxState")));
                    this.axAcroPDF7.Size     = new System.Drawing.Size(210, 297);
                    this.axAcroPDF7.TabIndex = 0;
                }
                //else if (this.axPdf6 != null)
                //{
                //  this.axPdf6.Dock = System.Windows.Forms.DockStyle.Fill;
                //  this.axPdf6.Enabled = true;
                //  this.axPdf6.Location = new System.Drawing.Point(0, 0);
                //  this.axPdf6.Name = "axPdf6";
                //  this.axPdf6.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axPdf1.OcxState")));
                //  this.axPdf6.Size = new System.Drawing.Size(210, 297);
                //  this.axPdf6.TabIndex = 0;
                //}
            }
            //
            // PdfAcroViewer
            //
            if (!this.inVisualStudio2005)
            {
#if Acro7
                this.Controls.Add(this.axAcroPDF7);
#else
                if (this.axAcroPDF7 != null)
                {
                    this.Controls.Add(this.axAcroPDF7);
                }
                else if (this.axPdf6 != null)
                {
                    this.Controls.Add(this.axPdf6);
                }
#endif
            }
            this.Name = "PdfAcroViewer";
            this.Size = new System.Drawing.Size(210, 297);
            if (!this.inVisualStudio2005)
            {
                try
                {
#if Acro7
                    ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF7)).EndInit();
#else
                    if (this.axAcroPDF7 != null)
                    {
                        ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF7)).EndInit();
                    }
                    else if (this.axPdf6 != null)
                    {
                        ((System.ComponentModel.ISupportInitialize)(this.axPdf6)).EndInit();
                    }
#endif
                }
                catch { }
            }
            this.ResumeLayout(false);
        }
コード例 #24
0
 public static AcroPDFLib.IAcroAXDocShim AsAcroPDF(this AxAcroPDFLib.AxAcroPDF source)
 {
     return((AcroPDFLib.IAcroAXDocShim)source.GetOcx());
 }
コード例 #25
0
    /// <summary> 
    /// Required method for Designer support - do not modify 
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PdfAcroViewer2));
      if (!this.designMode)
      {
        this.axAcroPDF = new AxAcroPDFLib.AxAcroPDF();
        ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF)).BeginInit();
      }
      this.SuspendLayout();
      // 
      // axAcroPDF
      // 
      if (!this.designMode)
      {
        this.axAcroPDF.Dock = System.Windows.Forms.DockStyle.Fill;
        this.axAcroPDF.Enabled = true;
        this.axAcroPDF.Location = new System.Drawing.Point(0, 0);
        this.axAcroPDF.Name = "axAcroPDF";
        this.axAcroPDF.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF.OcxState")));
        this.axAcroPDF.Size = new System.Drawing.Size(210, 297);
        this.axAcroPDF.TabIndex = 0;
      }
      // 
      // PdfAcroViewer2
      // 
      if (!this.designMode)
        this.Controls.Add(this.axAcroPDF);
      this.Name = "PdfAcroViewer2";
      this.Size = new System.Drawing.Size(210, 297);
      if (!this.designMode)
        ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF)).EndInit();
      this.ResumeLayout(false);

    }
コード例 #26
0
    /// <summary> 
    /// Required method for Designer support - do not modify 
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      /* The designer created code was modified to check the variable inVisualStudio2005.
       * Without this code Visual Studio 2005 will crash if the control is used in another designer.
       */
      System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PdfAcroViewer));
      if (!this.inVisualStudio2005)
      {
        if (this.acroPdfVersion >= 70)
        {
          try
          {
            this.axAcroPDF7 = new AxAcroPDFLib.AxAcroPDF();
            ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF7)).BeginInit();
          }
          catch
          {
            this.axAcroPDF7.Dispose();
            this.axAcroPDF7 = null;
          }
        }

        //if (this.acroPdfVersion >= 50 && this.axAcroPDF7 == null)
        //{
        //  try
        //  {
        //    this.axPdf6 = new AxPdfLib.AxPdf();
        //    ((System.ComponentModel.ISupportInitialize)(this.axPdf6)).BeginInit();
        //  }
        //  catch { }
        //}
        //if (this.axAcroPDF7 == null && this.axPdf6 == null)
        //  throw new InvalidOperationException("Cannot create control.");
      }
      this.SuspendLayout();
      // 
      // axAcroPDF7
      // 
      if (!this.inVisualStudio2005)
      {
        if (this.axAcroPDF7 != null)
        {
          this.axAcroPDF7.Dock = System.Windows.Forms.DockStyle.Fill;
          this.axAcroPDF7.Enabled = true;
          this.axAcroPDF7.Location = new System.Drawing.Point(0, 0);
          this.axAcroPDF7.Name = "axAcroPDF7";
          this.axAcroPDF7.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF7.OcxState")));
          this.axAcroPDF7.Size = new System.Drawing.Size(210, 297);
          this.axAcroPDF7.TabIndex = 0;
        }
        //else if (this.axPdf6 != null)
        //{
        //  this.axPdf6.Dock = System.Windows.Forms.DockStyle.Fill;
        //  this.axPdf6.Enabled = true;
        //  this.axPdf6.Location = new System.Drawing.Point(0, 0);
        //  this.axPdf6.Name = "axPdf6";
        //  this.axPdf6.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axPdf1.OcxState")));
        //  this.axPdf6.Size = new System.Drawing.Size(210, 297);
        //  this.axPdf6.TabIndex = 0;
        //}
      }
      // 
      // PdfAcroViewer
      // 
      if (!this.inVisualStudio2005)
      {
#if Acro7
          this.Controls.Add(this.axAcroPDF7);
#else
        if (this.axAcroPDF7 != null)
          this.Controls.Add(this.axAcroPDF7);
        else if (this.axPdf6 != null)
          this.Controls.Add(this.axPdf6);
#endif
      }
      this.Name = "PdfAcroViewer";
      this.Size = new System.Drawing.Size(210, 297);
      if (!this.inVisualStudio2005)
      {
        try
        {
#if Acro7
            ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF7)).EndInit();
#else
          if (this.axAcroPDF7 != null)
            ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF7)).EndInit();
          else if (this.axPdf6 != null)
            ((System.ComponentModel.ISupportInitialize)(this.axPdf6)).EndInit();
#endif
        }
        catch { }
      }
      this.ResumeLayout(false);
    }
コード例 #27
0
        public void GenerarRepMorosos(AxAcroPDFLib.AxAcroPDF VisorPDF, Int64 IdYear, Int64 IdCurso)
        {
            try
            {
                EliminarTemporal();
                VisorPDF.src = "";
                getDatos();

                Document pdf1 = new Document(PageSize.LETTER, 36.6929f, 36.6929f, 36.6929f, 36.6929f);

                string title = "Reporte de alumnos con mora" + "_" + DateTime.Now.ToString("yyyy_MM_dd_mm_hh_ss") + ".pdf";

                RutaArchivo = Path.GetTempPath() + "/" + title;

                PdfWriter       wri         = PdfWriter.GetInstance(pdf1, new FileStream(RutaArchivo, FileMode.Create));
                PageEventHelper eventHelper = new PageEventHelper();
                eventHelper.Reporte = 1;
                wri.PageEvent       = eventHelper;

                iTextSharp.text.Font fontEncabezado  = FontFactory.GetFont("Calibri", 11, iTextSharp.text.Font.BOLD, BaseColor.BLACK);
                iTextSharp.text.Font fontCuerpoSmall = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);

                iTextSharp.text.Font fontHeaderTabla      = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, BaseColor.BLACK);
                iTextSharp.text.Font fontHeaderTablaSmall = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK);
                iTextSharp.text.Font fontMotivo           = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);

                pdf1.Open();
                pdf1.AddTitle(title);

                DocActual = pdf1;


                //encabezado
                float[] medCellsEncabezado = new float[] { 150.0394f, 400.0394f, 150.0394f };

                PdfPTable tblEcabezado = new PdfPTable(3);

                tblEcabezado.WidthPercentage = 100;
                tblEcabezado.SetWidths(medCellsEncabezado);
                iTextSharp.text.Image imagenLogo = iTextSharp.text.Image.GetInstance(Properties.Resources.goll_Logo_png, BaseColor.WHITE);
                imagenLogo.BorderWidth = 0;
                imagenLogo.Alignment   = Element.ALIGN_LEFT;
                float percentage = 0.0f;
                percentage = 150 / imagenLogo.Width;
                imagenLogo.ScalePercent(percentage * 40);

                PdfPCell cImagenLogo = new PdfPCell(imagenLogo);
                cImagenLogo.BorderWidth = 0;
                tblEcabezado.AddCell(cImagenLogo);

                Paragraph myheader1 = new Paragraph("\n\nACADEMIA DE INGLES Y COMPUTACIÓN GOLL", fontEncabezado);
                Paragraph myheader2 = new Paragraph("\nREPORTE DE ALUMNOS CON PAGOS PENDIENTES", fontEncabezado);
                Paragraph myheader3 = new Paragraph("\n" + CursoDAL.getCursoById(IdCurso).Nombre.ToUpper() + " " + Convert.ToDateTime(YearDAL.getYearById(IdYear).Desde).ToString("yyyy") + "\n\n", fontEncabezado);

                myheader1.Alignment = Element.ALIGN_CENTER;
                myheader2.Alignment = Element.ALIGN_CENTER;
                myheader3.Alignment = Element.ALIGN_CENTER;

                myheader1.SetLeading(0, 0.8f);
                myheader2.SetLeading(0, 0.8f);
                myheader3.SetLeading(0, 0.8f);

                PdfPCell clEncabezado = new PdfPCell(myheader1);
                clEncabezado.AddElement(myheader1);
                clEncabezado.AddElement(myheader2);
                clEncabezado.AddElement(myheader3);

                clEncabezado.BorderWidth = 0;

                tblEcabezado.AddCell(clEncabezado);

                iTextSharp.text.Image imagenSV = iTextSharp.text.Image.GetInstance(Properties.Resources.Goll_Logo, BaseColor.WHITE);
                imagenSV.BorderWidth = 0;
                imagenSV.Alignment   = Element.ALIGN_TOP;
                float percentageSV = 0.0f;
                percentageSV = 150 / imagenSV.Width;
                imagenSV.ScalePercent(percentageSV * 70);

                PdfPCell cImagenSV = new PdfPCell(imagenSV);
                cImagenSV.BorderWidth = 0;
                tblEcabezado.AddCell(cImagenSV);
                DocActual.Add(tblEcabezado);
                //header de tabla

                PdfPTable tabla = new PdfPTable(3);
                PdfPCell  celda = new PdfPCell();
                celda.HorizontalAlignment = 1;
                celda.VerticalAlignment   = 5;
                tabla.WidthPercentage     = 100;

                celda.BackgroundColor = BaseColor.LIGHT_GRAY;

                List <Matricula> matriculas = MatriculaDAL.searchMatriculasParametro("", IdYear, IdCurso);
                DateTime         serverDate = YearDAL.getServerDate();

                foreach (Matricula matricula in matriculas)
                {
                    float[] medColumnas = new float[] { 180f, 180f, 80f, 140f };

                    tabla = new PdfPTable(4);
                    tabla.WidthPercentage = 100;
                    tabla.SetWidths(medColumnas);

                    tabla.AddCell(GetCellHeaderTable("Alumno", 1, 1, fontHeaderTabla));
                    tabla.AddCell(GetCellHeaderTable("Dirección", 1, 1, fontHeaderTabla));
                    tabla.AddCell(GetCellHeaderTable("Teléfono", 1, 1, fontHeaderTabla));
                    tabla.AddCell(GetCellHeaderTable("Total Pendiente", 1, 1, fontHeaderTablaSmall));
                    List <Cuota> atrasadas = matricula.Cuotas.Where(a => (Convert.ToDateTime(a.FhRegistro) < serverDate.AddDays(Properties.Settings.Default.DaysMora)) && a.Total < a.Precio).ToList();
                    if (atrasadas.Count > 0)
                    {
                        tabla.AddCell(GetCellBodyTable("" + matricula.Estudiante.Persona.Nombre.ToUpper(), fontCuerpoSmall));
                        tabla.AddCell(GetCellBodyTable("" + matricula.Estudiante.Persona.Direccion.ToUpper(), fontCuerpoSmall));
                        tabla.AddCell(GetCellBodyTable("" + matricula.Estudiante.Telefono.ToUpper(), fontCuerpoSmall));
                        string  pendiente    = "";
                        string  totales      = "";
                        decimal mensualiades = 0;
                        foreach (Cuota cuota in atrasadas)
                        {
                            pendiente    += Convert.ToDateTime(cuota.FhRegistro).ToString("MMMM", new CultureInfo("ES-es")) + " $" + Decimal.Round((cuota.Precio - cuota.Total), 2) + "\n";
                            mensualiades += Decimal.Round((cuota.Precio - cuota.Total));
                        }
                        totales += "TOTAL EN CUOTAS $" + mensualiades;
                        totales += "        TOTAL EN MORA $" + Decimal.Round(Properties.Settings.Default.Mora * atrasadas.Count, 2);
                        totales += "        TOTAL A PAGAR $" + Decimal.Round((mensualiades + Properties.Settings.Default.Mora * atrasadas.Count), 2);

                        tabla.AddCell(GetCellBodyTable(pendiente.ToUpper(), fontMotivo));
                        tabla.AddCell(GetCellBodyTable(totales.ToUpper(), 4, 1, fontHeaderTabla));
                        DocActual.Add(tabla);
                        DocActual.Add(new Paragraph("\n", fontEncabezado));
                        //  DocActual.Add(new Chunk("\n"));
                    }
                }
                pdf1.Close();
                DocActual.Close();
                VisorPDF.src = RutaArchivo;
                VisorPDF.setZoom(95);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #28
0
ファイル: BasicIacOCXCS.cs プロジェクト: dannisliang/VS
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(BasicIacOCXCS));
     this.panelLeft         = new System.Windows.Forms.Panel();
     this.goButtonLeft      = new System.Windows.Forms.Button();
     this.browseButtonLeft  = new System.Windows.Forms.Button();
     this.addressLeft       = new System.Windows.Forms.TextBox();
     this.AddressLabelLeft  = new System.Windows.Forms.Label();
     this.pdfWindowLeft     = new AxAcroPDFLib.AxAcroPDF();
     this.panelRight        = new System.Windows.Forms.Panel();
     this.goButtonRight     = new System.Windows.Forms.Button();
     this.browseButtonRight = new System.Windows.Forms.Button();
     this.addressRight      = new System.Windows.Forms.TextBox();
     this.addressLabelRight = new System.Windows.Forms.Label();
     this.pdfWindowRight    = new AxAcroPDFLib.AxAcroPDF();
     this.panelLeft.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.pdfWindowLeft)).BeginInit();
     this.panelRight.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.pdfWindowRight)).BeginInit();
     this.SuspendLayout();
     //
     // panelLeft
     //
     this.panelLeft.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.panelLeft.Controls.Add(this.goButtonLeft);
     this.panelLeft.Controls.Add(this.browseButtonLeft);
     this.panelLeft.Controls.Add(this.addressLeft);
     this.panelLeft.Controls.Add(this.AddressLabelLeft);
     this.panelLeft.Controls.Add(this.pdfWindowLeft);
     this.panelLeft.Location = new System.Drawing.Point(8, 8);
     this.panelLeft.Name     = "panelLeft";
     this.panelLeft.Size     = new System.Drawing.Size(416, 616);
     this.panelLeft.TabIndex = 0;
     //
     // goButtonLeft
     //
     this.goButtonLeft.Location = new System.Drawing.Point(264, 40);
     this.goButtonLeft.Name     = "goButtonLeft";
     this.goButtonLeft.Size     = new System.Drawing.Size(112, 24);
     this.goButtonLeft.TabIndex = 4;
     this.goButtonLeft.Text     = "Go";
     this.goButtonLeft.Click   += new System.EventHandler(this.goButtonLeft_Click);
     //
     // browseButtonLeft
     //
     this.browseButtonLeft.Location = new System.Drawing.Point(112, 40);
     this.browseButtonLeft.Name     = "browseButtonLeft";
     this.browseButtonLeft.Size     = new System.Drawing.Size(112, 24);
     this.browseButtonLeft.TabIndex = 3;
     this.browseButtonLeft.Text     = "Browse";
     this.browseButtonLeft.Click   += new System.EventHandler(this.browseButtonLeft_Click);
     //
     // addressLeft
     //
     this.addressLeft.Location = new System.Drawing.Point(56, 8);
     this.addressLeft.Name     = "addressLeft";
     this.addressLeft.Size     = new System.Drawing.Size(344, 20);
     this.addressLeft.TabIndex = 2;
     this.addressLeft.Text     = "";
     //
     // AddressLabelLeft
     //
     this.AddressLabelLeft.Location = new System.Drawing.Point(8, 8);
     this.AddressLabelLeft.Name     = "AddressLabelLeft";
     this.AddressLabelLeft.Size     = new System.Drawing.Size(48, 23);
     this.AddressLabelLeft.TabIndex = 1;
     this.AddressLabelLeft.Text     = "Address ";
     //
     // pdfWindowLeft
     //
     this.pdfWindowLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                        | System.Windows.Forms.AnchorStyles.Left)
                                                                       | System.Windows.Forms.AnchorStyles.Right)));
     this.pdfWindowLeft.ContainingControl = this;
     this.pdfWindowLeft.Enabled           = true;
     this.pdfWindowLeft.Location          = new System.Drawing.Point(8, 72);
     this.pdfWindowLeft.Name     = "pdfWindowLeft";
     this.pdfWindowLeft.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("pdfWindowLeft.OcxState")));
     this.pdfWindowLeft.Size     = new System.Drawing.Size(392, 528);
     this.pdfWindowLeft.TabIndex = 0;
     //
     // panelRight
     //
     this.panelRight.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.panelRight.Controls.Add(this.goButtonRight);
     this.panelRight.Controls.Add(this.browseButtonRight);
     this.panelRight.Controls.Add(this.addressRight);
     this.panelRight.Controls.Add(this.addressLabelRight);
     this.panelRight.Controls.Add(this.pdfWindowRight);
     this.panelRight.Location = new System.Drawing.Point(440, 8);
     this.panelRight.Name     = "panelRight";
     this.panelRight.Size     = new System.Drawing.Size(440, 616);
     this.panelRight.TabIndex = 1;
     //
     // goButtonRight
     //
     this.goButtonRight.Location = new System.Drawing.Point(272, 40);
     this.goButtonRight.Name     = "goButtonRight";
     this.goButtonRight.Size     = new System.Drawing.Size(120, 24);
     this.goButtonRight.TabIndex = 4;
     this.goButtonRight.Text     = "Go";
     this.goButtonRight.Click   += new System.EventHandler(this.goButtonRight_Click);
     //
     // browseButtonRight
     //
     this.browseButtonRight.Location = new System.Drawing.Point(112, 40);
     this.browseButtonRight.Name     = "browseButtonRight";
     this.browseButtonRight.Size     = new System.Drawing.Size(128, 24);
     this.browseButtonRight.TabIndex = 3;
     this.browseButtonRight.Text     = "Browse";
     this.browseButtonRight.Click   += new System.EventHandler(this.browseButtonRight_Click);
     //
     // addressRight
     //
     this.addressRight.Location = new System.Drawing.Point(56, 8);
     this.addressRight.Name     = "addressRight";
     this.addressRight.Size     = new System.Drawing.Size(376, 20);
     this.addressRight.TabIndex = 2;
     this.addressRight.Text     = "";
     //
     // addressLabelRight
     //
     this.addressLabelRight.Location = new System.Drawing.Point(8, 8);
     this.addressLabelRight.Name     = "addressLabelRight";
     this.addressLabelRight.Size     = new System.Drawing.Size(48, 24);
     this.addressLabelRight.TabIndex = 1;
     this.addressLabelRight.Text     = "Address ";
     //
     // pdfWindowRight
     //
     this.pdfWindowRight.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                         | System.Windows.Forms.AnchorStyles.Left)
                                                                        | System.Windows.Forms.AnchorStyles.Right)));
     this.pdfWindowRight.ContainingControl = this;
     this.pdfWindowRight.Enabled           = true;
     this.pdfWindowRight.Location          = new System.Drawing.Point(8, 72);
     this.pdfWindowRight.Name     = "pdfWindowRight";
     this.pdfWindowRight.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("pdfWindowRight.OcxState")));
     this.pdfWindowRight.Size     = new System.Drawing.Size(416, 528);
     this.pdfWindowRight.TabIndex = 0;
     //
     // BasicIacOCXCS
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(888, 630);
     this.Controls.Add(this.panelRight);
     this.Controls.Add(this.panelLeft);
     this.Name = "BasicIacOCXCS";
     this.Text = "Basic IAC OCX C# Example";
     this.panelLeft.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.pdfWindowLeft)).EndInit();
     this.panelRight.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.pdfWindowRight)).EndInit();
     this.ResumeLayout(false);
 }
コード例 #29
-1
ファイル: PdfForm.designer.cs プロジェクト: zuifengke/Printer
 /// <summary>
 /// 设计器支持所需的方法 - 不要
 /// 使用代码编辑器修改此方法的内容。
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PdfForm));
     this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();
     ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).BeginInit();
     this.SuspendLayout();
     //
     // axAcroPDF1
     //
     this.axAcroPDF1.Dock = System.Windows.Forms.DockStyle.Fill;
     this.axAcroPDF1.Enabled = true;
     this.axAcroPDF1.Location = new System.Drawing.Point(0, 0);
     this.axAcroPDF1.Name = "axAcroPDF1";
     this.axAcroPDF1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF1.OcxState")));
     this.axAcroPDF1.Size = new System.Drawing.Size(939, 620);
     this.axAcroPDF1.TabIndex = 0;
     //
     // PdfForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize = new System.Drawing.Size(939, 620);
     this.Controls.Add(this.axAcroPDF1);
     this.Cursor = System.Windows.Forms.Cursors.Default;
     this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
     this.Name = "PdfForm";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Text = "WinWordDocForm";
     this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
     this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.WinWordDocForm_FormClosing);
     ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).EndInit();
     this.ResumeLayout(false);
 }