Exemplo n.º 1
0
 public async Task<string> Extract(StorageFile file, int pageNumber)
 {
     var doc = new PdfLoadedDocument();
     await doc.OpenAsync(file);
     var page = doc.Pages[pageNumber];
     var extractedText = page.ExtractText();
     return extractedText;
 }
Exemplo n.º 2
0
        public async Task <string> Extract(StorageFile file, int pageNumber)
        {
            var doc = new PdfLoadedDocument();
            await doc.OpenAsync(file);

            var page          = doc.Pages[pageNumber];
            var extractedText = page.ExtractText();

            return(extractedText);
        }
Exemplo n.º 3
0
 public async Task<string> Extract(StorageFile file, int startPageNumber, int endPageNumber)
 {
     var doc = new PdfLoadedDocument();
     await doc.OpenAsync(file);
     var sb = new StringBuilder();
     for (var i = startPageNumber; i <= endPageNumber; i++)
     {
         var page = doc.Pages[i];
         sb.Append(page.ExtractText());
     }
     return sb.ToString();
 }
Exemplo n.º 4
0
        public async Task <string> Extract(StorageFile file, int startPageNumber, int endPageNumber)
        {
            var doc = new PdfLoadedDocument();
            await doc.OpenAsync(file);

            var sb = new StringBuilder();

            for (var i = startPageNumber; i <= endPageNumber; i++)
            {
                var page = doc.Pages[i];
                sb.Append(page.ExtractText());
            }
            return(sb.ToString());
        }
Exemplo n.º 5
0
        public static async void SaveChangesFile(string text)
        {
            PdfLoadedDocument loadedDocument = new PdfLoadedDocument();
            await loadedDocument.OpenAsync(openFile).ConfigureAwait(true);

            loadedDocument.Pages.RemoveAt(0);
            Syncfusion.Pdf.PdfPage page     = (Syncfusion.Pdf.PdfPage)loadedDocument.Pages.Add();
            PdfGraphics            graphics = page.Graphics;

            Syncfusion.Pdf.Graphics.PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);

            graphics.DrawString(text, font, PdfBrushes.Black, new PointF(0, 0));
            await loadedDocument.Save().ConfigureAwait(true);

            loadedDocument.Dispose();
        }
Exemplo n.º 6
0
        public static async Task <string> Read(StorageFile openFile)
        {
            SaveFilePdf.openFile = openFile;
            string extractedText = "";

            if (openFile != null)
            {
                PdfLoadedDocument loadedDocument = new PdfLoadedDocument();
                await loadedDocument.OpenAsync(openFile).ConfigureAwait(true);

                PdfPageBase page = loadedDocument.Pages[0];
                extractedText = page.ExtractText();
                loadedDocument.Close(true);
                loadedDocument.Dispose();
                var    mru      = Windows.Storage.AccessCache.StorageApplicationPermissions.MostRecentlyUsedList;
                string mruToken = mru.Add(openFile, "Pdf file");
            }
            return(extractedText);
        }