Exemple #1
0
        private void button4_DragDrop(object sender, DragEventArgs e)
        {
            if ((e.Data.GetData(DataFormats.FileDrop) as System.Array).GetValue(0).ToString().Split('\\')[(e.Data.GetData(DataFormats.FileDrop) as System.Array).GetValue(0).ToString().Split('\\').Length - 1].Split('.')[(e.Data.GetData(DataFormats.FileDrop) as System.Array).GetValue(0).ToString().Split('\\')[(e.Data.GetData(DataFormats.FileDrop) as System.Array).GetValue(0).ToString().Split('\\').Length - 1].Split('.').Length - 1].ToString() == "pdf")
            // if ((e.Data.GetData(DataFormats.FileDrop) as System.Array).GetValue(0).ToString().Split('\\')[(e.Data.GetData(DataFormats.FileDrop) as System.Array).GetValue(0).ToString().Split('\\').Length - 1].Split('.')[1] == "pdf")
            {
                //   belgeac();

                gelen = yapici.PdfAc((e.Data.GetData(DataFormats.FileDrop) as System.Array).GetValue(0).ToString());// PdfReader.Open(ofd.FileName, PdfDocumentOpenMode.Import);
                // lblSNo.Text = "Pdf Sayfa Sayısı : " + gelen.PageCount.ToString();
                string BelgeAdi = gelen.FullPath.ToString().Split('\\')[gelen.FullPath.ToString().Split('\\').Length - 1].ToString();

                sinif pdfdsy = null;
                for (int i = 0; i < gelen.PageCount; i++)
                {
                    pdfdsy          = new sinif();
                    pdfdsy.tamadres = gelen.FullPath.ToString();
                    pdfdsy.belgeadi = (e.Data.GetData(DataFormats.FileDrop) as System.Array).GetValue(0).ToString().Split('\\')[(e.Data.GetData(DataFormats.FileDrop) as System.Array).GetValue(0).ToString().Split('\\').Length - 1];
                    pdfdsy.sayfano  = i + 1;
                    if (chkGelenler.Items.Count > 0)
                    {
                        pdfdsy.sirano = chkGelenler.Items.Count + 1;
                    }
                    else
                    {
                        pdfdsy.sirano = i;
                    }
                    chkGelenler.Items.Add(pdfdsy);

                    //BelgeAdi + " - " + i.ToString() + ". Sayfa");
                }
            }
            else
            {
                MessageBox.Show("PDF dosyası değil");
            }
        }
Exemple #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            lblSonuc.Text = "";
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "PDF Files|*.pdf";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                gelen = yapici.PdfAc(ofd.FileName);// PdfReader.Open(ofd.FileName, PdfDocumentOpenMode.Import);
                // lblSNo.Text = "Pdf Sayfa Sayısı : " + gelen.PageCount.ToString();
                string BelgeAdi = ofd.FileName.ToString().Split('\\')[ofd.FileName.ToString().Split('\\').Length - 1].ToString();



                sinif pdfdsy = null;
                for (int i = 0; i < gelen.PageCount; i++)
                {
                    pdfdsy          = new sinif();
                    pdfdsy.tamadres = ofd.FileName;
                    pdfdsy.belgeadi = BelgeAdi;
                    pdfdsy.sayfano  = (i + 1);
                    if (chkGelenler.Items.Count > 0)
                    {
                        pdfdsy.sirano = chkGelenler.Items.Count + 1;
                    }
                    else
                    {
                        pdfdsy.sirano = i;
                    }

                    chkGelenler.Items.Add(pdfdsy);

                    //BelgeAdi + " - " + i.ToString() + ". Sayfa");
                }
            }
        }