Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Creating a Doc");

            using (var doc = new WebSupergoo.ABCpdf8.Doc())
            {
                // is it working ?
            }

            Console.WriteLine("OK");
        }
Example #2
0
        public void ExtractPdfPages(string filename, int pagestart, int pagecount)
        {
            var pages           = ExtractPages(File.ReadAllBytes(filename), pagestart, pagecount);
            var savelocation    = Path.GetDirectoryName(filename);
            var extractfilename = String.Format("{0}_{1}-{2}.pdf", Path.GetFileName(filename), pagestart, pagestart + pagecount - 1);

            using (var doc = new WebSupergoo.ABCpdf8.Doc())
            {
                doc.Read(pages);
                doc.Save(Path.Combine(savelocation, extractfilename));
            }
        }
Example #3
0
        public void ConvertPdfToSinglePages(string filename)
        {
            var pages        = SplitPdfPages(File.ReadAllBytes(filename)).ToList();
            var savelocation = Path.GetDirectoryName(filename);

            for (int i = 1; i <= pages.Count(); i++)
            {
                using (var doc = new WebSupergoo.ABCpdf8.Doc())
                {
                    doc.Read(pages[i - 1]);
                    doc.Save(Path.Combine(savelocation, i + ".pdf"));
                }
            }
        }
Example #4
0
        public string ConvertPdfToString(byte[] originalFileBytes)
        {
            var stringBuilder = new StringBuilder();

            // Use Version 8 PDF Converter as Version 9 removes carriage returns on some PDFs, causing issues with the Regex matching.
            using (var doc = new WebSupergoo.ABCpdf8.Doc())
            {
                doc.Read(originalFileBytes);

                for (var currentPageNumber = 1; currentPageNumber <= doc.PageCount; currentPageNumber++)
                {
                    doc.PageNumber = currentPageNumber;
                    stringBuilder.Append(doc.GetText("Text"));
                }
            }
            return(stringBuilder.ToString());
        }