Beispiel #1
0
        // TODO: Pending on an issue with our custom PDFSharp library:
        //       https://github.com/Didstopia/PDFSharp/issues/3
        //[InlineData(SampleBookWithPasswordRemotePath)]
        public async void TestBookParsingAsync(string filePath)
        {
            // Create the book and start testing it
            PDFBook book = await PDFReader.OpenBookAsync(filePath);

            TestBook(book);
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Button btn = sender as Button;
     string content = btn.Content as string;
     PDFReader pdfReader = new PDFReader();
     pdfReader.showPdf(content + ".pdf");
 }
        //Чтение выбранной книги
        private void _Book_Click(object sender, RoutedEventArgs e)
        {
            int  index      = Books.IndexOf((Book)(sender as Button).Tag);
            Book chosenBook = Books[index];

            switch (chosenBook.GetSourceType())
            {
            case Book.ResourceType.Local:
                ReaderGrid.Visibility = Visibility.Visible;
                PDFReader.LoadFile(chosenBook.GetSource());
                PDFReader.Show();
                PDFReader.Focus();
                break;

            case Book.ResourceType.Internet:
                try {
                    PDFBrowser.Navigate(chosenBook.GetSource());
                    WebReaderGrid.Visibility = Visibility.Visible;
                }
                catch (UriFormatException ex) {
                    MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                break;
            }
            _Back_.Visibility = Visibility.Visible;
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            //@"D:\Development\Spike Projects\Office\PDF\ITextSharp\ITextSharpLibrary.Help\IText 5.5.13 Read Me.pdf");
            string fileName = @"..\..\..\ITextSharpLibrary.Help\IText 5.5.13 Read Me.pdf"; // AbsolutePathToRelative();
            string text     = PDFReader.ReadText(fileName);

            Console.Write(text);
            Console.ReadKey();
        }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XPDFForm"/> class from a stream.
        /// </summary>
        /// <param name="stream">The stream.</param>
        internal XPDFForm(Stream stream)
        {
            // Create a dummy unique path
            _path = "*" + Guid.NewGuid().ToString("B");

            if (PDFReader.TestPDFFile(stream) == 0)
            {
                throw new ArgumentException("The specified stream has no valid PDF file header.", "stream");
            }

            _externalDocument = PDFReader.Open(stream);
        }
Beispiel #6
0
    public void ExternalOpenPDF()
    {
                #if UNITY_ANDROID
        StartCoroutine(PDFReader.OpenDocLocal(namePDF));
                #endif
                #if UNITY_IPHONE
        PDFReader.OpenDocInMenu(streamingPdf, true);
                #endif

        Debug.Log("OPEN PDF");
        googleAnalytics.LogEvent("Literature", namePDF, namePDF, 1);
    }
 //Возврат в меню
 private void _Back__Click(object sender, RoutedEventArgs e)
 {
     if (ReaderGrid.Visibility == Visibility.Visible)
     {
         ReaderGrid.Visibility = Visibility.Hidden;
         PDFReader.Hide();
     }
     else if (WebReaderGrid.Visibility == Visibility.Visible)
     {
         WebReaderGrid.Visibility = Visibility.Hidden;
     }
     _Back_.Visibility = Visibility.Hidden;
 }
Beispiel #8
0
 public static void ReadInvoice(string path, string type)
 {
     if (type.Equals("Ocr"))
     {
         image    = new ImageReader(path);
         ReadText = image.ReadText;
     }
     else
     {
         pdf      = new PDFReader(path);
         ReadText = pdf.ReadText;
     }
 }
        static void Main(string[] args)
        {
            DateTime   dat   = DateTime.Parse("06/mag/2019", System.Globalization.CultureInfo.GetCultureInfo("it-IT"));
            string     path  = "C:\\Users\\Kawik.B\\Documents\\Timesheets";
            Repository repo  = new Repository();
            var        files = Directory.GetFiles(path);
            //var works = repo.InsertWorks();
            //var travels = repo.InsertTravels();
            //var timesheets = repo.GetTimesheets(works, travels);
            PDFReader pDFReader = new PDFReader();

            pDFReader.ReadAcroFieldsFromPDF(files);

            using (var context = new AccountantContext())
            {
                context.Database.Log = Console.WriteLine;
                context.Works.AddRange(pDFReader.KeyValueWorks.Values);
                context.Travels.AddRange(pDFReader.KeyValueTravels.Values);
                context.Timesheets.AddRange(repo.GetTimesheets(pDFReader.KeyValueWorks.Values, pDFReader.KeyValueTravels.Values));
                context.SaveChanges();
            }
            Console.ReadLine();
        }
Beispiel #10
0
        /// <summary>
        /// Initializes a new instance of the XPDFForm class from the specified path to an external PDF document.
        /// Although PDFSharp internally caches XPDFForm objects it is recommended to reuse XPDFForm objects
        /// in your code and change the PageNumber property if more than one page is needed form the external
        /// document. Furthermore, because XPDFForm can occupy very much memory, it is recommended to
        /// dispose XPDFForm objects if not needed anymore.
        /// </summary>
        internal XPDFForm(string path)
        {
            path = ExtractPageNumber(path, out int pageNumber);

#if !NETFX_CORE
            path = Path.GetFullPath(path);
            if (!File.Exists(path))
            {
                throw new FileNotFoundException(PSSR.FileNotFound(path));
            }
#endif

            if (PDFReader.TestPDFFile(path) == 0)
            {
                throw new ArgumentException("The specified file has no valid PDF file header.", "path");
            }

            _path = path;
            if (pageNumber != 0)
            {
                PageNumber = pageNumber;
            }
        }
 //Режим чтения
 private void _ReadingMode__Click(object sender, RoutedEventArgs e)
 {
     PDFReader.Focus();
     if (!IsReadingModeActive)
     {
         WindowStyle = WindowStyle.None;
         if (settings.IsFullscreen)
         {
             WindowState = WindowState.Normal;
         }
         WindowState         = WindowState.Maximized;
         IsReadingModeActive = true;
     }
     else
     {
         WindowStyle = WindowStyle.SingleBorderWindow;
         WindowState = WindowState.Normal;
         if (settings.IsFullscreen)
         {
             WindowState = WindowState.Maximized;
         }
         IsReadingModeActive = false;
     }
 }
        private void dataGridSearchResult_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.dataGridSearchResult.SelectedItem == null)
            {
                return;
            }
            int i = dataGridSearchResult.SelectedIndex;
            DataSet_Case.T_CaseRow ThisCase = dataGridSearchResult.SelectedItem as DataSet_Case.T_CaseRow;

            string strFileName = ThisCase.CasePDF;
            DirectoryInfo di = new DirectoryInfo(System.Environment.CurrentDirectory);
            string strPath = di.Parent.Parent.FullName;
            if (System.IO.File.Exists(strPath + @"/PDF/" + strFileName))
            {
                PDFReader m_PDFReader = new PDFReader();
                m_PDFReader.showPdf(strFileName);
            }
            else
            {
                MessageBox.Show("没有该文件");
            }
            dataGridSearchResult.SelectedIndex = -1;
        }
        private void dataGridSearchResult_Click(object sender, RoutedEventArgs e)
        {
            if (this.dataGridSearchResult.SelectedItem == null)
            {
                return;
            }
            if (e.OriginalSource.GetType() != typeof(System.Windows.Documents.Hyperlink))
                return;
            //todo:
            int i = dataGridSearchResult.SelectedIndex;
            DataSet_Case.T_CaseRow ThisCase = dataGridSearchResult.SelectedItem as DataSet_Case.T_CaseRow;

            string strFileName = ThisCase.CasePDF;
            DirectoryInfo di = new DirectoryInfo(System.Environment.CurrentDirectory);
            string strPath = di.Parent.Parent.FullName;
            if (System.IO.File.Exists(strPath + @"/PDF/" + strFileName))
            {
                PDFReader m_PDFReader = new PDFReader();
                m_PDFReader.showPdf(strFileName);
            }
            else
            {
                MessageBox.Show("没有该文件");
            }
        }
Beispiel #14
0
        // TODO: Pending on an issue with our custom PDFSharp library:
        //       https://github.com/Didstopia/PDFSharp/issues/3
        //[InlineData(SampleBookWithPasswordRemotePath)]
        public void TestBookParsing(string filePath)
        {
            PDFBook book = PDFReader.OpenBook(filePath);

            TestBook(book);
        }
Beispiel #15
0
 public MainModel()
 {
     PDFReader = new PDFReader();
 }
Beispiel #16
0
 private void S1_Load(object sender, EventArgs e)
 {
     PDFReader.LoadFile(@"C:\Users\10442\Desktop\925 ppt\A comparative review of IPv4 and IPv6 for research test bed.pdf");
 }