예제 #1
0
        public ProcessController(AccessManager amgr)
        {
            var vfs = amgr.GetFullAccessFileSystem();

            _pdfHandler  = new PdfHandler(vfs);
            _outputFiles = new OutputFiles(vfs);
        }
예제 #2
0
        private void pdfBtn_Click(object sender, EventArgs e)
        {
            var filePath       = string.Empty;
            var openFileDialog = new OpenFileDialog();

            //filtering file types
            openFileDialog.Filter = "Image Files | *.pdf";
            //default Directory
            openFileDialog.InitialDirectory = @"C:\";
            //File Dialog Title
            openFileDialog.Title = "Please select an PDF file to upload.";
            //Selecting Multiple Images
            openFileDialog.Multiselect = true;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                foreach (String file in openFileDialog.FileNames)
                {
                    try
                    {
                        FileInfo fi = new FileInfo(file);



                        images.AddRange(PdfHandler.pdfToImages(file, projet.idProjet));
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
            updateImages();
        }
        // Warning - will not work - see comment above ProblemFour method invokation in Main()
        public static void Main()
        {
            var mongoHandler = new MongoDbHandler();
            var sqlHandler = new SqlServerHandler();
            var mySqlHandler = new MySqlHandler();
            var pdfHandler = new PdfHandler();
            var xmlToSql = new XmlToSqlServerLoader();
            var excellHandler = new ExcellHandler();
            var mongoToSql = new MongoToSqlServerLoader();
            var zipExtractor = new ZipExtractor();
            var jsonHandler = new JsonHandler();
            var sqliteHandler = new SqliteHandler();
            var xmlHandler = new XmlHandler();

            if (!Directory.Exists(OutputDirectory))
            {
                Directory.CreateDirectory(OutputDirectory);
            }

            //// Mongolab.com credentials - Username: TeamXenon , Passsword: xenon123

            ProblemOne(mongoHandler, mongoToSql, zipExtractor, excellHandler);

            ProblemTwo(pdfHandler);

            ProblemThree(xmlHandler);

            //// NOTE!!! - you need to go to CarParts.Data.MySql project and in its App.config file
            //// you should change the password in the connectionString tag with which you connect to your localhost instance of the MySQL Workbench server.
            ProblemFour(sqlHandler, mySqlHandler, jsonHandler);

            ProblemFive(mongoHandler, xmlToSql);

            ProblemSix(excellHandler, sqlHandler, sqliteHandler, mySqlHandler);
        }
예제 #4
0
 /// <summary>
 /// Initialize a new instance of the <see cref="App"/> class.
 /// </summary>
 /// <param name="appResourcesService">A service with access to local resources.</param>
 /// <param name="logger">A logger from the built in LoggingFactory.</param>
 /// <param name="dataService">A service with access to data storage.</param>
 /// <param name="processService">A service with access to the process.</param>
 /// <param name="pdfService">A service with access to the PDF generator.</param>
 /// <param name="profileService">A service with access to profile information.</param>
 /// <param name="registerService">A service with access to register information.</param>
 /// <param name="prefillService">A service with access to prefill mechanisms.</param>
 /// <param name="instanceService">A service with access to instances</param>
 /// <param name="settings">General settings</param>
 /// <param name="textService">A service with access to text</param>
 /// <param name="httpContextAccessor">A context accessor</param>
 public App(
     IAppResources appResourcesService,
     ILogger <App> logger,
     IData dataService,
     IProcess processService,
     IPDF pdfService,
     IProfile profileService,
     IRegister registerService,
     IPrefill prefillService,
     IInstance instanceService,
     IOptions <GeneralSettings> settings,
     IText textService,
     IHttpContextAccessor httpContextAccessor) : base(
         appResourcesService,
         logger,
         dataService,
         processService,
         pdfService,
         prefillService,
         instanceService,
         registerService,
         settings,
         profileService,
         textService,
         httpContextAccessor)
 {
     _logger                = logger;
     _validationHandler     = new ValidationHandler(httpContextAccessor);
     _dataProcessingHandler = new DataProcessingHandler();
     _instantiationHandler  = new InstantiationHandler(profileService, registerService);
     _pdfHandler            = new PdfHandler();
 }
        static void attachInvoiceToPdf(Invoice invoice)
        {
            PdfHandler   handler      = new PdfHandler();          // <1>
            InputStream  inputPdf     = new FileInputStream("../../resources/acme_invoice-42.pdf");
            OutputStream resultingPdf = new FileOutputStream("acme_invoice-42_ZUGFeRD.pdf");

            handler.appendInvoice(invoice, inputPdf, resultingPdf);                  // <2>
        }
        public MainWindow()
        {
            tempFolder = Path.GetTempPath();

            pdfHandler = new PdfHandler();

            service = ChromeDriverService.CreateDefaultService();
            service.HideCommandPromptWindow = true;

            InitializeComponent();
        }
예제 #7
0
        public void Main(string file)
        {
            var wordHandler  = new WordHandler();
            var pdfHandler   = new PdfHandler();
            var excelHandler = new ExcelHandler();

            wordHandler.SetSuccessor(pdfHandler);
            pdfHandler.SetSuccessor(excelHandler);

            wordHandler.Process(file);
        }
예제 #8
0
        public static void Run()
        {
            File file = new File("my-image", ".pdf");

            IFileHandler rootOfChain = new JpegHandler();
            IFileHandler pngHandler  = new PngHandler();
            IFileHandler pdfHandler  = new PdfHandler();

            rootOfChain.SetNext(pngHandler);
            pngHandler.SetNext(pdfHandler);

            rootOfChain.Handle(file);
        }
        public ActionResult QuestionPaperView(int id)
        {
            var data = PdfHandler.DisplayPdf(id);

            return(data);
        }
 private static void ProblemTwo(PdfHandler pdfHandler)
 {
     pdfHandler.GenerateSalesInfoPdf();
     Console.WriteLine("Successfully generated pdf file.");
 }
예제 #11
0
 public ActionResult <Int32> GetNumberOfPages([FromBody] String source)
 {
     return(PdfHandler.GetNumberOfPages(Convert.FromBase64String(source)));
 }
예제 #12
0
 public ActionResult <List <String> > TextExtractPaged([FromBody] TextExtractModel textExtract)
 {
     return(PdfHandler.ExtractTextPaged(Convert.FromBase64String(textExtract.Source)));
 }
예제 #13
0
 public ActionResult <List <RegexFound> > RegexPaged([FromBody] RegexModel regexModel)
 {
     return(PdfHandler.RegexPaged(Convert.FromBase64String(regexModel.Source), regexModel.Pattern));
 }
예제 #14
0
 public ActionResult <List <int> > RegexAbsolute([FromBody] RegexModel regexModel)
 {
     return(PdfHandler.RegexAbsolute(Convert.FromBase64String(regexModel.Source), regexModel.Pattern));
 }
예제 #15
0
 public ActionResult <byte[]> Extract([FromBody] MergeModel mergeModel)
 {
     return(PdfHandler.Extract(Convert.FromBase64String(mergeModel.Source), mergeModel.Range));
 }
		static void attachInvoiceToPdf (Invoice invoice)
		{
			PdfHandler handler = new PdfHandler ();    // <1>
			InputStream inputPdf = new FileInputStream ("../../resources/acme_invoice-42.pdf");
			OutputStream resultingPdf = new FileOutputStream ("acme_invoice-42_ZUGFeRD.pdf");
			handler.appendInvoice (invoice, inputPdf, resultingPdf);     // <2>
		}